diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-20 21:46:52 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-20 21:46:52 +0100 |
commit | 8977e88b64e5f08a27cb10b8606f1d9c9ca27679 (patch) | |
tree | 33fdf68a529d1143e4880ae3353cd6e5bfeb3371 /src/menu/drawable_control.cpp | |
parent | a6b096260ae3dea25233852c90b04b8298b92688 (diff) | |
download | usdx-8977e88b64e5f08a27cb10b8606f1d9c9ca27679.tar.gz usdx-8977e88b64e5f08a27cb10b8606f1d9c9ca27679.tar.xz usdx-8977e88b64e5f08a27cb10b8606f1d9c9ca27679.zip |
menu/drawable_control: add static member for debug boxes
Diffstat (limited to '')
-rw-r--r-- | src/menu/drawable_control.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp index 0708599b..72c3ec77 100644 --- a/src/menu/drawable_control.cpp +++ b/src/menu/drawable_control.cpp @@ -39,7 +39,7 @@ namespace usdx DrawableControl::DrawableControl(Container* parent) : Control(parent), position(0, 0), size(0, 0), clipping_required(false), focusable(true), background(NULL), - parent(parent) + debug_box(NULL), parent(parent) { ContainerHelper(this).add(parent); } @@ -48,7 +48,7 @@ namespace usdx const ContainerHelper& helper) : Control(parent), position(0, 0), size(0, 0), clipping_required(false), focusable(true), background(NULL), - parent(parent) + debug_box(NULL), parent(parent) { helper.add(parent); } @@ -61,6 +61,11 @@ namespace usdx delete background; background = NULL; } + + if (debug_box) { + delete debug_box; + debug_box = NULL; + } } bool DrawableControl::is_clipping_required(void) const @@ -120,10 +125,14 @@ namespace usdx if (Application::get_config()->get_debug_boxes()) { - boost::shared_lock<boost::shared_mutex> lock(size_mutex); - StaticRectangle s(RgbColor(255, 0, 0), size); - s.set_stroke_width(2.0f); - s.repaint(); + if (debug_box == NULL) { + boost::shared_lock<boost::shared_mutex> lock(size_mutex); + + debug_box = new StaticRectangle(RgbColor(255, 0, 0), size); + debug_box->set_stroke_width(2.0f); + } + + debug_box->repaint(); } } |