aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbMenu.cc25
-rw-r--r--src/FbMenu.hh7
-rw-r--r--src/FbTk/Menu.cc4
-rw-r--r--src/FbTk/Menu.hh7
4 files changed, 10 insertions, 33 deletions
diff --git a/src/FbMenu.cc b/src/FbMenu.cc
index 65fbecd..941ca0e 100644
--- a/src/FbMenu.cc
+++ b/src/FbMenu.cc
@@ -25,36 +25,13 @@
25#include "FbMenu.hh" 25#include "FbMenu.hh"
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28#include "FbTk/MenuTheme.hh"
29#include "Screen.hh" 28#include "Screen.hh"
30 29
31#include "FbTk/Shape.hh"
32
33FbMenu::FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, 30FbMenu::FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
34 FbTk::XLayer &layer): 31 FbTk::XLayer &layer):
35 FbTk::Menu(tm, imgctrl), 32 FbTk::Menu(tm, imgctrl),
36 m_layeritem(fbwindow(), layer), 33 m_layeritem(fbwindow(), layer) {
37 m_shape(new FbTk::Shape(fbwindow(), tm.shapePlaces())) {
38
39}
40
41FbMenu::~FbMenu() {
42
43}
44
45void FbMenu::updateMenu(int index) {
46 FbTk::Menu::updateMenu(index);
47 m_shape->update();
48}
49
50void FbMenu::clearWindow() {
51 FbTk::Menu::clearWindow();
52 m_shape->update();
53}
54 34
55void FbMenu::reconfigure() {
56 m_shape->setPlaces(theme().shapePlaces());
57 FbTk::Menu::reconfigure();
58} 35}
59 36
60void FbMenu::buttonReleaseEvent(XButtonEvent &be) { 37void FbMenu::buttonReleaseEvent(XButtonEvent &be) {
diff --git a/src/FbMenu.hh b/src/FbMenu.hh
index ef8670d..9469311 100644
--- a/src/FbMenu.hh
+++ b/src/FbMenu.hh
@@ -30,7 +30,6 @@
30 30
31namespace FbTk { 31namespace FbTk {
32class MenuTheme; 32class MenuTheme;
33class Shape;
34} 33}
35 34
36/// a layered and shaped menu 35/// a layered and shaped menu
@@ -38,16 +37,12 @@ class FbMenu:public FbTk::Menu {
38public: 37public:
39 FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, 38 FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
40 FbTk::XLayer &layer); 39 FbTk::XLayer &layer);
41 virtual ~FbMenu(); 40 virtual ~FbMenu() { }
42 void updateMenu(int index = -1);
43 void clearWindow();
44 void raise() { m_layeritem.raise(); } 41 void raise() { m_layeritem.raise(); }
45 void lower() { m_layeritem.lower(); } 42 void lower() { m_layeritem.lower(); }
46 void reconfigure();
47 void buttonReleaseEvent(XButtonEvent &be); 43 void buttonReleaseEvent(XButtonEvent &be);
48private: 44private:
49 FbTk::XLayerItem m_layeritem; 45 FbTk::XLayerItem m_layeritem;
50 std::auto_ptr<FbTk::Shape> m_shape;
51}; 46};
52 47
53#endif // FBMENU_HH 48#endif // FBMENU_HH
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 485b56c..00dcc54 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -92,6 +92,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
92 m_screen_height(DisplayHeight(FbTk::App::instance()->display(), tm.screenNum())), 92 m_screen_height(DisplayHeight(FbTk::App::instance()->display(), tm.screenNum())),
93 m_alignment(ALIGNDONTCARE), 93 m_alignment(ALIGNDONTCARE),
94 m_active_index(-1), 94 m_active_index(-1),
95 m_shape(new Shape(fbwindow(), tm.shapePlaces())),
95 m_need_update(true) { 96 m_need_update(true) {
96 // setup timers 97 // setup timers
97 98
@@ -496,6 +497,7 @@ void Menu::updateMenu(int active_index) {
496 497
497 clearWindow(); 498 clearWindow();
498 m_need_update = false; 499 m_need_update = false;
500 m_shape->update();
499} 501}
500 502
501 503
@@ -563,6 +565,7 @@ void Menu::clearWindow() {
563 for (size_t i = 0; i < menuitems.size(); i++) { 565 for (size_t i = 0; i < menuitems.size(); i++) {
564 clearItem(i, false); // no clear 566 clearItem(i, false); // no clear
565 } 567 }
568 m_shape->update();
566} 569}
567 570
568void Menu::redrawFrame(FbDrawable &drawable) { 571void Menu::redrawFrame(FbDrawable &drawable) {
@@ -1091,6 +1094,7 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1091 1094
1092 1095
1093void Menu::reconfigure() { 1096void Menu::reconfigure() {
1097 m_shape->setPlaces(theme().shapePlaces());
1094 1098
1095 if (FbTk::Transparent::haveComposite()) { 1099 if (FbTk::Transparent::haveComposite()) {
1096 menu.window.setOpaque(alpha()); 1100 menu.window.setOpaque(alpha());
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index f16c443..54c6d62 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -203,13 +203,12 @@ private:
203 void startHide(); 203 void startHide();
204 void stopHide(); 204 void stopHide();
205 205
206
207 typedef std::vector<MenuItem *> Menuitems;
208 MenuTheme &m_theme; 206 MenuTheme &m_theme;
209 Menu *m_parent; 207 Menu *m_parent;
210 ImageControl &m_image_ctrl; 208 ImageControl &m_image_ctrl;
211 Menuitems menuitems;
212 209
210 typedef std::vector<MenuItem *> Menuitems;
211 Menuitems menuitems;
213 TypeAhead<Menuitems, MenuItem *> m_type_ahead; 212 TypeAhead<Menuitems, MenuItem *> m_type_ahead;
214 Menuitems m_matches; 213 Menuitems m_matches;
215 214
@@ -242,6 +241,8 @@ private:
242 241
243 int m_active_index; ///< current highlighted index 242 int m_active_index; ///< current highlighted index
244 243
244 std::auto_ptr<FbTk::Shape> m_shape;
245
245 Drawable m_root_pm; 246 Drawable m_root_pm;
246 static Menu *shown; ///< used for determining if there's a menu open at all 247 static Menu *shown; ///< used for determining if there's a menu open at all
247 static Menu *s_focused; ///< holds current input focused menu, so one can determine if a menu is focused 248 static Menu *s_focused; ///< holds current input focused menu, so one can determine if a menu is focused