diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-13 22:27:20 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-18 19:34:21 +0100 |
commit | 45637b81cfac4a630ebc5814a8a1498ac1a28529 (patch) | |
tree | 2cedc1344560c4304e0b7b4e4602ef0fefcab94c /src | |
parent | 91337be4652b0f8c822de58d3c646423b1967bf0 (diff) | |
download | usdx-45637b81cfac4a630ebc5814a8a1498ac1a28529.tar.gz usdx-45637b81cfac4a630ebc5814a8a1498ac1a28529.tar.xz usdx-45637b81cfac4a630ebc5814a8a1498ac1a28529.zip |
drawable_control: add focusable property
drawable controls could now disable the ability to receive focus
Diffstat (limited to '')
-rw-r--r-- | src/menu/drawable_control.cpp | 14 | ||||
-rw-r--r-- | src/menu/drawable_control.hpp | 8 | ||||
-rw-r--r-- | src/menu/software_mouse_pointer.cpp | 1 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp index 74ef77a3..47df96db 100644 --- a/src/menu/drawable_control.cpp +++ b/src/menu/drawable_control.cpp @@ -38,7 +38,7 @@ namespace usdx DrawableControl::DrawableControl(Container* parent) : Control(parent), position(0, 0), size(0, 0), - clipping_required(false), background(NULL), + clipping_required(false), focusable(true), background(NULL), parent(parent) { ContainerHelper(this).add(parent); @@ -47,7 +47,7 @@ namespace usdx DrawableControl::DrawableControl(Container* parent, const ContainerHelper& helper) : Control(parent), position(0, 0), size(0, 0), - clipping_required(false), background(NULL), + clipping_required(false), focusable(true), background(NULL), parent(parent) { helper.add(parent); @@ -75,6 +75,16 @@ namespace usdx clipping_required = value; } + bool DrawableControl::is_focusable(void) const + { + return focusable; + } + + void DrawableControl::set_focusable(const bool value) + { + focusable = value; + } + void DrawableControl::draw(void) { boost::shared_lock<boost::shared_mutex> lock(background_mutex); diff --git a/src/menu/drawable_control.hpp b/src/menu/drawable_control.hpp index 9f33b376..cd1f45e0 100644 --- a/src/menu/drawable_control.hpp +++ b/src/menu/drawable_control.hpp @@ -61,6 +61,11 @@ namespace usdx bool clipping_required; /** + * Whether the control should be able to get the focus. + */ + bool focusable; + + /** * Background of the control. The background is drawn, before the real * content is drawn. */ @@ -88,6 +93,9 @@ namespace usdx bool is_clipping_required(void) const; void set_clipping_required(const bool); + bool is_focusable(void) const; + void set_focusable(const bool); + /** * Function get called, if the control should draw itself it the * current position on the OpenGL screen. If clipping is required, the diff --git a/src/menu/software_mouse_pointer.cpp b/src/menu/software_mouse_pointer.cpp index c99f4315..9c9bfc38 100644 --- a/src/menu/software_mouse_pointer.cpp +++ b/src/menu/software_mouse_pointer.cpp @@ -45,6 +45,7 @@ namespace usdx set_position(0, 0); set_size(40, 40); + set_focusable(false); texture_normal = new Disposer<Texture>(new Texture("game/themes/Deluxe/interface/cursor.png")); texture_pressed = new Disposer<Texture>(new Texture("game/themes/Deluxe/interface/cursor_pressed.png")); |