13
0

move CairoWidget::ActiveState and Visual state up into gtkmm2ext foruse by DnDVBox etc.

git-svn-id: svn://localhost/ardour2/branches/3.0@10371 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-11-01 01:21:40 +00:00
parent cfe9ae636e
commit 0fdb513786
2 changed files with 27 additions and 9 deletions

View File

@ -18,6 +18,7 @@
*/
#include <gtkmm/box.h>
#include "gtkmm2ext/widget_state.h"
namespace Gtkmm2ext {
@ -37,7 +38,7 @@ public:
virtual std::string drag_text () const = 0;
/** Set the child's visual state */
virtual void set_visual_state (Gtk::StateType) = 0;
virtual void set_visual_state (VisualState, bool onoff) = 0;
};
/** A VBox whose contents can be dragged and dropped */
@ -526,14 +527,7 @@ private:
void setup_child_state (T* c)
{
assert (c);
if (c == _active) {
c->set_visual_state (Gtk::STATE_ACTIVE);
} else if (selected (c)) {
c->set_visual_state (Gtk::STATE_SELECTED);
} else {
c->set_visual_state (Gtk::STATE_NORMAL);
}
c->set_visual_state (Selected, selected (c));
}
void clear_selection ()

View File

@ -0,0 +1,24 @@
#ifndef __gtkmm2ext_widget_state_h__
#define __gtkmm2ext_widget_state_h__
namespace Gtkmm2ext {
/* widget states: unlike GTK, visual states like "Selected" or "Prelight"
are orthogonal to active states.
*/
enum ActiveState {
Active = 1,
Mid,
};
enum VisualState {
/* these can be OR-ed together */
Selected = 0x1,
Prelight = 0x2,
Insensitive = 0x4,
};
};
#endif /* __gtkmm2ext_widget_state_h__ */