aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu/drawable_control.cpp
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-04-11 21:19:48 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-13 22:40:52 +0100
commite0e9997a5e92ce2a31f0ff4d139109be4434105b (patch)
treee8c3baa67eb65ffc16a9c96fdbb067d142f194bd /src/menu/drawable_control.cpp
parent40caf6163ff2e1274d71146c207fbde0c099b089 (diff)
downloadusdx-e0e9997a5e92ce2a31f0ff4d139109be4434105b.tar.gz
usdx-e0e9997a5e92ce2a31f0ff4d139109be4434105b.tar.xz
usdx-e0e9997a5e92ce2a31f0ff4d139109be4434105b.zip
menu: generalized frame_background to background
background could now be a background for all DrawableControl instances each subclass should call the parents draw() during executing the draw() method for background painting TODO: background should know the size of the control to only draw the background there
Diffstat (limited to '')
-rw-r--r--src/menu/drawable_control.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp
index 9d00d3f1..a0b4ad27 100644
--- a/src/menu/drawable_control.cpp
+++ b/src/menu/drawable_control.cpp
@@ -37,7 +37,8 @@ namespace usdx
DrawableControl::DrawableControl(Container* parent)
: Control(parent), position(0, 0), size(0, 0),
- clipping_required(false), parent(parent)
+ clipping_required(false), background(NULL),
+ parent(parent)
{
ContainerHelper(this).add(parent);
}
@@ -45,7 +46,8 @@ namespace usdx
DrawableControl::DrawableControl(Container* parent,
const ContainerHelper& helper)
: Control(parent), position(0, 0), size(0, 0),
- clipping_required(false), parent(parent)
+ clipping_required(false), background(NULL),
+ parent(parent)
{
helper.add(parent);
}
@@ -53,6 +55,11 @@ namespace usdx
DrawableControl::~DrawableControl()
{
remove_parent();
+
+ if (background) {
+ delete background;
+ background = NULL;
+ }
}
bool DrawableControl::get_clipping_required(void) const
@@ -66,6 +73,14 @@ namespace usdx
clipping_required = value;
}
+ void DrawableControl::draw(void)
+ {
+ boost::mutex::scoped_lock lock(background_mutex);
+ if (background) {
+ background->repaint();
+ }
+ }
+
void DrawableControl::repaint(void)
{
{
@@ -164,4 +179,19 @@ namespace usdx
c->add(self);
}
}
+
+ void DrawableControl::set_background(Background* background)
+ {
+ boost::mutex::scoped_lock lock(background_mutex);
+ if (this->background) {
+ delete this->background;
+ }
+
+ this->background = background;
+ }
+
+ const Background* DrawableControl::get_background(void) const
+ {
+ return background;
+ }
};