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:
parent
cfe9ae636e
commit
0fdb513786
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtkmm/box.h>
|
#include <gtkmm/box.h>
|
||||||
|
#include "gtkmm2ext/widget_state.h"
|
||||||
|
|
||||||
namespace Gtkmm2ext {
|
namespace Gtkmm2ext {
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ public:
|
||||||
virtual std::string drag_text () const = 0;
|
virtual std::string drag_text () const = 0;
|
||||||
|
|
||||||
/** Set the child's visual state */
|
/** 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 */
|
/** A VBox whose contents can be dragged and dropped */
|
||||||
|
@ -526,14 +527,7 @@ private:
|
||||||
void setup_child_state (T* c)
|
void setup_child_state (T* c)
|
||||||
{
|
{
|
||||||
assert (c);
|
assert (c);
|
||||||
|
c->set_visual_state (Selected, selected (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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_selection ()
|
void clear_selection ()
|
||||||
|
|
24
libs/gtkmm2ext/gtkmm2ext/widget_state.h
Normal file
24
libs/gtkmm2ext/gtkmm2ext/widget_state.h
Normal 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__ */
|
Loading…
Reference in New Issue
Block a user