aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-12-10 23:08:06 (GMT)
committerfluxgen <fluxgen>2003-12-10 23:08:06 (GMT)
commit5ffb6290c12adc5c45a50758f90549fdfc693216 (patch)
tree6bed529f1d556b571dc0b6bfee5665aca408a6d9 /src/Screen.cc
parentcb8e8e8d054b044db602326278055dc10f1c0c57 (diff)
downloadfluxbox-5ffb6290c12adc5c45a50758f90549fdfc693216.zip
fluxbox-5ffb6290c12adc5c45a50758f90549fdfc693216.tar.bz2
cleaning in the menu code
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 25d91ed..c95b96b 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.246 2003/12/10 22:28:07 fluxgen Exp $ 25// $Id: Screen.cc,v 1.247 2003/12/10 23:08:03 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -133,17 +133,6 @@ int anotherWMRunning(Display *display, XErrorEvent *) {
133 return -1; 133 return -1;
134} 134}
135 135
136FbTk::Menu *createMenuFromScreen(BScreen &screen, const char *label = 0) {
137 FbTk::Menu *menu = new FbMenu(*screen.menuTheme(),
138 screen.screenNumber(),
139 screen.imageControl(),
140 *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()));
141 if (label)
142 menu->setLabel(label);
143
144 return menu;
145}
146
147class FocusModelMenuItem : public FbTk::MenuItem { 136class FocusModelMenuItem : public FbTk::MenuItem {
148public: 137public:
149 FocusModelMenuItem(const char *label, BScreen &screen, 138 FocusModelMenuItem(const char *label, BScreen &screen,
@@ -353,10 +342,10 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
353 342
354 // setup workspaces and workspace menu 343 // setup workspaces and workspace menu
355 344
356 workspacemenu.reset(createMenuFromScreen(*this)); 345 workspacemenu.reset(createMenu(""));
357 workspacemenu->setInternalMenu(); 346 workspacemenu->setInternalMenu();
358 //!! TODO: NLS 347 //!! TODO: NLS
359 m_iconmenu.reset(createMenuFromScreen(*this, "Icons")); 348 m_iconmenu.reset(createMenu("Icons"));
360 m_iconmenu->setInternalMenu(); 349 m_iconmenu->setInternalMenu();
361 350
362 if (*resource.workspaces != 0) { 351 if (*resource.workspaces != 0) {
@@ -392,7 +381,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
392 fluxbox->load_rc(*this); 381 fluxbox->load_rc(*this);
393 382
394 // TODO: nls 383 // TODO: nls
395 m_configmenu.reset(createMenuFromScreen(*this, "Configuration")); 384 m_configmenu.reset(createMenu("Configuration"));
396 setupConfigmenu(*m_configmenu.get()); 385 setupConfigmenu(*m_configmenu.get());
397 m_configmenu->setInternalMenu(); 386 m_configmenu->setInternalMenu();
398 387
@@ -569,6 +558,16 @@ void BScreen::update(FbTk::Subject *subj) {
569 renderGeomWindow(); 558 renderGeomWindow();
570} 559}
571 560
561FbTk::Menu *BScreen::createMenu(const std::string &label) {
562 FbTk::Menu *menu = new FbMenu(*menuTheme(),
563 imageControl(),
564 *layerManager().getLayer(Fluxbox::instance()->getMenuLayer()));
565 if (!label.empty())
566 menu->setLabel(label.c_str());
567
568 return menu;
569}
570
572void BScreen::reconfigure() { 571void BScreen::reconfigure() {
573 m_menutheme->setAlpha(*resource.menu_alpha); 572 m_menutheme->setAlpha(*resource.menu_alpha);
574 Fluxbox::instance()->loadRootCommand(*this); 573 Fluxbox::instance()->loadRootCommand(*this);
@@ -1548,7 +1547,7 @@ void BScreen::initMenu() {
1548 m_rootmenu_list.clear(); 1547 m_rootmenu_list.clear();
1549 1548
1550 } else 1549 } else
1551 m_rootmenu.reset(createMenuFromScreen(*this)); 1550 m_rootmenu.reset(createMenu(""));
1552 1551
1553 bool defaultMenu = true; 1552 bool defaultMenu = true;
1554 Fluxbox * const fb = Fluxbox::instance(); 1553 Fluxbox * const fb = Fluxbox::instance();
@@ -1759,7 +1758,7 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) {
1759 "no menu label defined\n")); 1758 "no menu label defined\n"));
1760 cerr<<"Row: "<<row<<endl; 1759 cerr<<"Row: "<<row<<endl;
1761 } else { 1760 } else {
1762 FbTk::Menu *submenu = createMenuFromScreen(*this); 1761 FbTk::Menu *submenu = createMenu("");
1763 1762
1764 if (str_cmd.size()) 1763 if (str_cmd.size())
1765 submenu->setLabel(str_cmd.c_str()); 1764 submenu->setLabel(str_cmd.c_str());
@@ -1873,7 +1872,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1873 // be deleted toghether with the parent 1872 // be deleted toghether with the parent
1874 const char *focusmenu_label = i18n->getMessage(ConfigmenuSet, ConfigmenuFocusModel, 1873 const char *focusmenu_label = i18n->getMessage(ConfigmenuSet, ConfigmenuFocusModel,
1875 "Focus Model"); 1874 "Focus Model");
1876 FbTk::Menu *focus_menu = createMenuFromScreen(*this, focusmenu_label); 1875 FbTk::Menu *focus_menu = createMenu(focusmenu_label ? focusmenu_label : "");
1877 1876
1878 focus_menu->insert(new FocusModelMenuItem(i18n->getMessage(ConfigmenuSet, 1877 focus_menu->insert(new FocusModelMenuItem(i18n->getMessage(ConfigmenuSet,
1879 ConfigmenuClickToFocus, 1878 ConfigmenuClickToFocus,