Merge ui::Widget::m_align with m_flags field

Here we remove Widget::setFlags() member function, as it's not used.
This commit is contained in:
David Capello 2015-06-24 12:06:33 -03:00
parent e6d22e7e38
commit e4df25f4df
3 changed files with 31 additions and 32 deletions

View File

@ -32,35 +32,34 @@
namespace ui {
// Alignment flags
enum {
HORIZONTAL = 0x0001,
VERTICAL = 0x0002,
LEFT = 0x0004,
CENTER = 0x0008,
RIGHT = 0x0010,
TOP = 0x0020,
MIDDLE = 0x0040,
BOTTOM = 0x0080,
HOMOGENEOUS = 0x0100,
WORDWRAP = 0x0200,
};
// Widget flags
enum {
HIDDEN = 0x0001, // Is hidden (not visible, not clickeable).
SELECTED = 0x0002, // Is selected.
DISABLED = 0x0004, // Is disabled (not usable).
HAS_FOCUS = 0x0008, // Has the input focus.
HAS_MOUSE = 0x0010, // Has the mouse.
HAS_CAPTURE = 0x0020, // Captured the mouse .
FOCUS_STOP = 0x0040, // The widget support the focus on it.
FOCUS_MAGNET = 0x0080, // The widget wants the focus by default (e.g. when the dialog is shown by first time).
EXPANSIVE = 0x0100, // Is expansive (want more space).
DECORATIVE = 0x0200, // To decorate windows.
INITIALIZED = 0x0400, // The widget was already initialized by a theme.
DIRTY = 0x0800, // The widget (or one child) is dirty (update_region != empty).
HAS_TEXT = 0x1000, // The widget has text (at least setText() was called one time).
HIDDEN = 0x00000001, // Is hidden (not visible, not clickeable).
SELECTED = 0x00000002, // Is selected.
DISABLED = 0x00000004, // Is disabled (not usable).
HAS_FOCUS = 0x00000008, // Has the input focus.
HAS_MOUSE = 0x00000010, // Has the mouse.
HAS_CAPTURE = 0x00000020, // Captured the mouse .
FOCUS_STOP = 0x00000040, // The widget support the focus on it.
FOCUS_MAGNET = 0x00000080, // The widget wants the focus by default (e.g. when the dialog is shown by first time).
EXPANSIVE = 0x00000100, // Is expansive (want more space).
DECORATIVE = 0x00000200, // To decorate windows.
INITIALIZED = 0x00000400, // The widget was already initialized by a theme.
DIRTY = 0x00000800, // The widget (or one child) is dirty (update_region != empty).
HAS_TEXT = 0x00001000, // The widget has text (at least setText() was called one time).
PROPERTIES_MASK = 0x0000ffff,
HORIZONTAL = 0x00010000,
VERTICAL = 0x00020000,
LEFT = 0x00040000,
CENTER = 0x00080000,
RIGHT = 0x00100000,
TOP = 0x00200000,
MIDDLE = 0x00400000,
BOTTOM = 0x00800000,
HOMOGENEOUS = 0x01000000,
WORDWRAP = 0x02000000,
ALIGN_MASK = 0xffff0000,
};
class GuiSystem {

View File

@ -64,7 +64,6 @@ Widget::Widget(WidgetType type)
: m_type(type)
, m_flags(0)
, m_theme(CurrentTheme::get())
, m_align(0)
, m_font(nullptr)
, m_bgColor(gfx::ColorNone)
, m_bounds(0, 0, 0, 0)

View File

@ -65,13 +65,15 @@ namespace ui {
void setId(const char* id) { m_id = id; }
int flags() const { return m_flags; }
void setFlags(int flags) { m_flags = flags; }
bool hasFlags(int flags) const { return ((m_flags & flags) == flags); }
void enableFlags(int flags) { m_flags |= flags; }
void disableFlags(int flags) { m_flags &= ~flags; }
int getAlign() const { return m_align; }
void setAlign(int align) { m_align = align; }
int getAlign() const { return (m_flags & ALIGN_MASK); }
void setAlign(int align) {
m_flags = ((m_flags & PROPERTIES_MASK) |
(align & ALIGN_MASK));
}
// Text property.
@ -379,7 +381,6 @@ namespace ui {
std::string m_id; // Widget's id
int m_flags; // Special boolean properties (see flags in ui/base.h)
Theme* m_theme; // Widget's theme
int m_align; // Widget alignment
std::string m_text; // Widget text
mutable she::Font* m_font; // Cached font returned by the theme
gfx::Color m_bgColor; // Background color