summaryrefslogtreecommitdiff
diff options
authorThomi Richards <thomi.richards@canonical.com>2012-02-08 16:54:32 +1300
committerThomi Richards <thomi.richards@canonical.com>2012-02-08 16:54:32 +1300
commit09397ca8aed8fc8db36ac57ffc70ea77c7af6132 (patch)
tree44ea091f719eecdcdf9c8aafbb9deefb28f49391
parent33ad49606671a9711a5711a7fbfd77ff350dd43b (diff)
Trying to replace various panel-height definitions with one nux::ROProperty.
(bzr r1923.2.1)
-rw-r--r--plugins/unityshell/src/DashController.cpp10
-rw-r--r--plugins/unityshell/src/DashController.h1
-rw-r--r--plugins/unityshell/src/HudController.cpp7
-rw-r--r--plugins/unityshell/src/HudController.h1
-rw-r--r--plugins/unityshell/src/Launcher.cpp14
-rw-r--r--plugins/unityshell/src/PanelStyle.cpp8
-rw-r--r--plugins/unityshell/src/PanelStyle.h4
7 files changed, 28 insertions, 17 deletions
diff --git a/plugins/unityshell/src/DashController.cpp b/plugins/unityshell/src/DashController.cpp
index 7411909c8..a0141ac47 100644
--- a/plugins/unityshell/src/DashController.cpp
+++ b/plugins/unityshell/src/DashController.cpp
@@ -22,6 +22,7 @@
#include <Nux/HLayout.h>
#include "DashSettings.h"
+#include "PanelStyle.h"
#include "PluginAdapter.h"
#include "UBusMessages.h"
#include "UScreen.h"
@@ -38,7 +39,6 @@ nux::logging::Logger logger("unity.dash.controller");
Controller::Controller()
: launcher_width(64)
- , panel_height(24)
, window_(0)
, visible_(false)
, need_show_(false)
@@ -168,10 +168,11 @@ nux::Geometry Controller::GetIdealWindowGeometry()
// We want to cover as much of the screen as possible to grab any mouse events outside
// of our window
+ panel::Style &panel_style = panel::Style::Instance();
return nux::Geometry (monitor_geo.x + launcher_width,
- monitor_geo.y + panel_height,
+ monitor_geo.y + panel_style.panel_height,
monitor_geo.width - launcher_width,
- monitor_geo.height - panel_height);
+ monitor_geo.height - panel_style.panel_height);
}
void Controller::Relayout(GdkScreen*screen)
@@ -181,7 +182,8 @@ void Controller::Relayout(GdkScreen*screen)
nux::Geometry geo = GetIdealWindowGeometry();
window_->SetGeometry(geo);
view_->Relayout();
- view_->SetMonitorOffset(launcher_width, panel_height);
+ panel::Style &panel_style = panel::Style::Instance();
+ view_->SetMonitorOffset(launcher_width, panel_style.panel_height);
}
void Controller::OnMouseDownOutsideWindow(int x, int y,
diff --git a/plugins/unityshell/src/DashController.h b/plugins/unityshell/src/DashController.h
index 30031978e..77df11dd7 100644
--- a/plugins/unityshell/src/DashController.h
+++ b/plugins/unityshell/src/DashController.h
@@ -52,7 +52,6 @@ public:
std::vector<char> GetAllShortcuts();
nux::Property<int> launcher_width;
- nux::Property<int> panel_height;
sigc::signal<void> on_realize;
diff --git a/plugins/unityshell/src/HudController.cpp b/plugins/unityshell/src/HudController.cpp
index 3a0bc4567..55aba0bc7 100644
--- a/plugins/unityshell/src/HudController.cpp
+++ b/plugins/unityshell/src/HudController.cpp
@@ -21,6 +21,7 @@
#include <NuxCore/Logger.h>
#include <Nux/HLayout.h>
#include "PluginAdapter.h"
+#include "PanelStyle.h"
#include "UBusMessages.h"
#include "UScreen.h"
namespace unity
@@ -35,7 +36,6 @@ nux::logging::Logger logger("unity.hud.controller");
Controller::Controller()
: launcher_width(66)
- , panel_height(24)
, hud_service_("com.canonical.hud", "/com/canonical/hud")
, window_(0)
, visible_(false)
@@ -153,10 +153,11 @@ nux::Geometry Controller::GetIdealWindowGeometry()
// We want to cover as much of the screen as possible to grab any mouse events outside
// of our window
+ panel::Style &panel_style = panel::Style::Instance();
return nux::Geometry (monitor_geo.x,
- monitor_geo.y + panel_height,
+ monitor_geo.y + panel_style.panel_height,
monitor_geo.width,
- monitor_geo.height - panel_height);
+ monitor_geo.height - panel_style.panel_height);
}
void Controller::Relayout(GdkScreen*screen)
diff --git a/plugins/unityshell/src/HudController.h b/plugins/unityshell/src/HudController.h
index 211842404..f2c491ab0 100644
--- a/plugins/unityshell/src/HudController.h
+++ b/plugins/unityshell/src/HudController.h
@@ -49,7 +49,6 @@ public:
nux::BaseWindow* window() const;
nux::Property<int> launcher_width;
- nux::Property<int> panel_height;
void ShowHideHud();
void ShowHud();
diff --git a/plugins/unityshell/src/Launcher.cpp b/plugins/unityshell/src/Launcher.cpp
index 5f50e9cc3..9aaa03afb 100644
--- a/plugins/unityshell/src/Launcher.cpp
+++ b/plugins/unityshell/src/Launcher.cpp
@@ -37,6 +37,7 @@
#include "Launcher.h"
#include "AbstractLauncherIcon.h"
+#include "PanelStyle.h"
#include "SpacerLauncherIcon.h"
#include "LauncherModel.h"
#include "QuicklistManager.h"
@@ -75,7 +76,6 @@ const int STARTING_BLINK_LAMBDA = 3;
const int PULSE_BLINK_LAMBDA = 2;
const float BACKLIGHT_STRENGTH = 0.9f;
-const int panel_height = 24;
const int ICON_PADDING = 6;
const int RIGHT_LINE_WIDTH = 1;
@@ -1697,7 +1697,7 @@ void Launcher::SetHover(bool hovered)
bool Launcher::MouseOverTopScrollArea()
{
- return _mouse_position.y < panel_height;
+ return _mouse_position.y < panel::Style::Instance().panel_height;
}
bool Launcher::MouseOverTopScrollExtrema()
@@ -1707,7 +1707,7 @@ bool Launcher::MouseOverTopScrollExtrema()
bool Launcher::MouseOverBottomScrollArea()
{
- return _mouse_position.y > GetGeometry().height - panel_height;
+ return _mouse_position.y > GetGeometry().height - panel::Style::Instance().panel_height;
}
bool Launcher::MouseOverBottomScrollExtrema()
@@ -1774,9 +1774,9 @@ void Launcher::Resize()
{
UScreen* uscreen = UScreen::GetDefault();
auto geo = uscreen->GetMonitorGeometry(monitor());
-
+ unity::panel::Style &panel_style = panel::Style::Instance();
int width = _icon_size + ICON_PADDING*2 + RIGHT_LINE_WIDTH - 2;
- nux::Geometry new_geometry(geo.x, geo.y + panel_height, width, geo.height - panel_height);
+ nux::Geometry new_geometry(geo.x, geo.y + panel_style.panel_height, width, geo.height - panel_style.panel_height);
SetMaximumHeight(new_geometry.height);
_parent->SetGeometry(new_geometry);
SetGeometry(new_geometry);
@@ -1785,7 +1785,7 @@ void Launcher::Resize()
_pointer_barrier->x1 = new_geometry.x;
_pointer_barrier->x2 = new_geometry.x;
- _pointer_barrier->y1 = new_geometry.y - panel_height;
+ _pointer_barrier->y1 = new_geometry.y - panel_style.panel_height;
_pointer_barrier->y2 = new_geometry.y + new_geometry.height;
_pointer_barrier->threshold = options()->edge_stop_velocity();
@@ -1979,7 +1979,7 @@ void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP);
texxform.uoffset = (1.0f / launcher_sheen_->GetWidth()); // TODO (gord) don't use absolute values here
- texxform.voffset = (1.0f / launcher_sheen_->GetHeight()) * panel_height;
+ texxform.voffset = (1.0f / launcher_sheen_->GetHeight()) * panel::Style::Instance().panel_height;
GfxContext.QRP_1Tex(base.x, base.y, base.width, base.height,
launcher_sheen_->GetDeviceTexture(),
texxform,
diff --git a/plugins/unityshell/src/PanelStyle.cpp b/plugins/unityshell/src/PanelStyle.cpp
index e45ccdc94..c05160b67 100644
--- a/plugins/unityshell/src/PanelStyle.cpp
+++ b/plugins/unityshell/src/PanelStyle.cpp
@@ -53,7 +53,8 @@ nux::Color ColorFromGdkRGBA(GdkRGBA const& color)
}
Style::Style()
- : _theme_name(NULL)
+ : panel_height(sigc::mem_fun(this, &Style::getPanelHeight))
+ , _theme_name(NULL)
{
if (style_instance)
{
@@ -291,5 +292,10 @@ GdkPixbuf* Style::GetHomeButton()
return pixbuf;
}
+int Style::getPanelHeight() const
+{
+ return 24;
+}
+
} // namespace panel
} // namespace unity
diff --git a/plugins/unityshell/src/PanelStyle.h b/plugins/unityshell/src/PanelStyle.h
index 489dcddd8..43e641728 100644
--- a/plugins/unityshell/src/PanelStyle.h
+++ b/plugins/unityshell/src/PanelStyle.h
@@ -22,6 +22,7 @@
#define PANEL_STYLE_H
#include <Nux/Nux.h>
+#include <NuxCore/Property.h>
#include <gtk/gtk.h>
@@ -64,6 +65,8 @@ public:
bool IsAmbianceOrRadiance();
+ nux::ROProperty<int> panel_height;
+
private:
void Refresh();
@@ -73,6 +76,7 @@ private:
nux::BaseTexture* GetWindowButtonForTheme(WindowButtonType type,
WindowState state);
+ int getPanelHeight() const;
private:
GtkStyleContext* _style_context;
char* _theme_name;