2 Copyright (C) 2000-2007 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <gtkmm/main.h>
25 #include <gtkmm2ext/stateful_button.h>
29 using namespace Gtkmm2ext;
32 StateButton::StateButton () : visual_state (0), _self_managed (false), _is_realized (false)
38 StateButton::set_visual_state (int n)
41 /* not yet realized */
46 if (n == visual_state) {
50 string name = get_widget_name ();
51 name = name.substr (0, name.find_last_of ('-'));
65 set_widget_name (name);
69 /* ----------------------------------------------------------------- */
72 StatefulToggleButton::on_realize ()
74 ToggleButton::on_realize ();
77 visual_state++; // to force transition
78 set_visual_state (visual_state - 1);
82 StatefulButton::on_realize ()
84 Button::on_realize ();
87 visual_state++; // to force transition
88 set_visual_state (visual_state - 1);
92 StatefulToggleButton::on_toggled ()