From 2940869cd7cc1688be5114451380275c9a85f5d1 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Thu, 27 Dec 2007 23:16:17 -0800 Subject: merge MenuTheme with FbTk::MenuTheme --- src/AlphaMenu.cc | 2 +- src/AlphaMenu.hh | 2 +- src/FbMenu.cc | 6 ++--- src/FbMenu.hh | 5 ++-- src/FbTk/MenuTheme.cc | 4 ++- src/FbTk/MenuTheme.hh | 75 ++++++++++++++++++++++++++------------------------- src/LayerMenu.cc | 2 +- src/LayerMenu.hh | 2 +- src/Makefile.am | 1 - src/MenuTheme.cc | 31 --------------------- src/MenuTheme.hh | 40 --------------------------- src/Screen.cc | 4 +-- src/Screen.hh | 8 +++--- src/ToggleMenu.hh | 2 +- src/Xinerama.hh | 4 +-- 15 files changed, 60 insertions(+), 128 deletions(-) delete mode 100644 src/MenuTheme.cc delete mode 100644 src/MenuTheme.hh diff --git a/src/AlphaMenu.cc b/src/AlphaMenu.cc index fdea426..8903fa4 100644 --- a/src/AlphaMenu.cc +++ b/src/AlphaMenu.cc @@ -36,7 +36,7 @@ #include "FbTk/I18n.hh" #include "Window.hh" -AlphaMenu::AlphaMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl, +AlphaMenu::AlphaMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer): ToggleMenu(tm, imgctrl, layer) { diff --git a/src/AlphaMenu.hh b/src/AlphaMenu.hh index 19df646..97d0cbe 100644 --- a/src/AlphaMenu.hh +++ b/src/AlphaMenu.hh @@ -31,7 +31,7 @@ class AlphaMenu : public ToggleMenu { public: - AlphaMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl, + AlphaMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer); // we override these to update the menu when the active window changes diff --git a/src/FbMenu.cc b/src/FbMenu.cc index 8065294..65fbecd 100644 --- a/src/FbMenu.cc +++ b/src/FbMenu.cc @@ -25,12 +25,12 @@ #include "FbMenu.hh" #include "fluxbox.hh" -#include "MenuTheme.hh" +#include "FbTk/MenuTheme.hh" #include "Screen.hh" #include "FbTk/Shape.hh" -FbMenu::FbMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl, +FbMenu::FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer): FbTk::Menu(tm, imgctrl), m_layeritem(fbwindow(), layer), @@ -53,7 +53,7 @@ void FbMenu::clearWindow() { } void FbMenu::reconfigure() { - m_shape->setPlaces(dynamic_cast(theme()).shapePlaces()); + m_shape->setPlaces(theme().shapePlaces()); FbTk::Menu::reconfigure(); } diff --git a/src/FbMenu.hh b/src/FbMenu.hh index 6e43d8f..ef8670d 100644 --- a/src/FbMenu.hh +++ b/src/FbMenu.hh @@ -28,16 +28,15 @@ #include "XLayerItem.hh" #include -class MenuTheme; - namespace FbTk { +class MenuTheme; class Shape; } /// a layered and shaped menu class FbMenu:public FbTk::Menu { public: - FbMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl, + FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer); virtual ~FbMenu(); void updateMenu(int index = -1); diff --git a/src/FbTk/MenuTheme.cc b/src/FbTk/MenuTheme.cc index 18e51aa..239313c 100644 --- a/src/FbTk/MenuTheme.cc +++ b/src/FbTk/MenuTheme.cc @@ -54,6 +54,7 @@ MenuTheme::MenuTheme(int screen_num): titlefont_justify(*this, "menu.title.justify", "Menu.Title.Justify"), bullet_pos(*this, "menu.bullet.position", "Menu.Bullet.Position"), m_bullet(*this, "menu.bullet", "Menu.Bullet"), + m_shapeplace(*this, "menu.roundCorners", "Menu.RoundCorners"), m_title_height(*this, "menu.titleHeight", "Menu.TitleHeight"), m_item_height(*this, "menu.itemHeight", "Menu.ItemHeight"), m_border_width(*this, "menu.borderWidth", "Menu.BorderWidth"), @@ -78,11 +79,12 @@ MenuTheme::MenuTheme(int screen_num): m_delayclose(0), // no delay as default m_real_title_height(*m_title_height), m_real_item_height(*m_item_height) -{ +{ // set default values *m_border_width = 0; *m_bevel_width = 0; *m_border_width = 0; + *m_shapeplace = FbTk::Shape::NONE; ThemeManager::instance().loadTheme(*this); diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh index 0bb77ef..d76c2fb 100644 --- a/src/FbTk/MenuTheme.hh +++ b/src/FbTk/MenuTheme.hh @@ -27,6 +27,7 @@ #include "Theme.hh" #include "Color.hh" #include "Font.hh" +#include "Shape.hh" #include "Texture.hh" #include "Text.hh" #include "Subject.hh" @@ -35,7 +36,7 @@ namespace FbTk { -class MenuTheme:public FbTk::Theme { +class MenuTheme:public Theme { public: //!! TODO // this isn't actually used with a theme item @@ -54,40 +55,40 @@ public: @name text colors */ ///@{ - inline const FbTk::Color &titleTextColor() const { return *t_text; } - inline const FbTk::Color &frameTextColor() const { return *f_text; } - inline const FbTk::Color &frameUnderlineColor() const { return *u_text; } - inline const FbTk::Color &highlightTextColor() const { return *h_text; } - inline const FbTk::Color &disableTextColor() const { return *d_text; } + inline const Color &titleTextColor() const { return *t_text; } + inline const Color &frameTextColor() const { return *f_text; } + inline const Color &frameUnderlineColor() const { return *u_text; } + inline const Color &highlightTextColor() const { return *h_text; } + inline const Color &disableTextColor() const { return *d_text; } ///@} /** @name textures */ ///@{ - inline const FbTk::Texture &titleTexture() const { return *title; } - inline const FbTk::Texture &frameTexture() const { return *frame; } - inline const FbTk::Texture &hiliteTexture() const { return *hilite; } + inline const Texture &titleTexture() const { return *title; } + inline const Texture &frameTexture() const { return *frame; } + inline const Texture &hiliteTexture() const { return *hilite; } ///@} - inline const FbTk::PixmapWithMask &bulletPixmap() const { return *m_bullet_pixmap; } - inline const FbTk::PixmapWithMask &selectedPixmap() const { return *m_selected_pixmap; } - inline const FbTk::PixmapWithMask &unselectedPixmap() const { return *m_unselected_pixmap; } + inline const PixmapWithMask &bulletPixmap() const { return *m_bullet_pixmap; } + inline const PixmapWithMask &selectedPixmap() const { return *m_selected_pixmap; } + inline const PixmapWithMask &unselectedPixmap() const { return *m_unselected_pixmap; } - inline const FbTk::PixmapWithMask &highlightBulletPixmap() const { return *m_hl_bullet_pixmap; } - inline const FbTk::PixmapWithMask &highlightSelectedPixmap() const { return *m_hl_selected_pixmap; } - inline const FbTk::PixmapWithMask &highlightUnselectedPixmap() const { return *m_hl_unselected_pixmap; } + inline const PixmapWithMask &highlightBulletPixmap() const { return *m_hl_bullet_pixmap; } + inline const PixmapWithMask &highlightSelectedPixmap() const { return *m_hl_selected_pixmap; } + inline const PixmapWithMask &highlightUnselectedPixmap() const { return *m_hl_unselected_pixmap; } /** @name fonts */ ///@{ - inline const FbTk::Font &titleFont() const { return *titlefont; } - inline FbTk::Font &titleFont() { return *titlefont; } - inline const FbTk::Font &frameFont() const { return *framefont; } - inline FbTk::Font &frameFont() { return *framefont; } + inline const Font &titleFont() const { return *titlefont; } + inline Font &titleFont() { return *titlefont; } + inline const Font &frameFont() const { return *framefont; } + inline Font &frameFont() { return *framefont; } ///@} - inline FbTk::Justify frameFontJustify() const { return *framefont_justify; } - inline FbTk::Justify titleFontJustify() const { return *titlefont_justify; } + inline Justify frameFontJustify() const { return *framefont_justify; } + inline Justify titleFontJustify() const { return *titlefont_justify; } /** @name graphic contexts @@ -107,7 +108,7 @@ public: inline GContext &hiliteGC() { return hilite_gc; } ///@} inline BulletType bullet() const { return *m_bullet; } - inline FbTk::Justify bulletPos() const { return *bullet_pos; } + inline Justify bulletPos() const { return *bullet_pos; } inline unsigned int titleHeight() const { return m_real_title_height; } inline unsigned int itemHeight() const { return m_real_item_height; } @@ -126,7 +127,8 @@ public: inline int delayOpen() const { return m_delayopen; } inline int delayClose() const { return m_delayclose; } - inline const FbTk::Color &borderColor() const { return *m_border_color; } + inline const Color &borderColor() const { return *m_border_color; } + inline Shape::ShapePlace shapePlaces() const { return *m_shapeplace; } // special override inline void setSelectedPixmap(Pixmap pm, bool is_imagecached) { @@ -142,21 +144,22 @@ public: } private: - FbTk::ThemeItem t_text, f_text, h_text, d_text, u_text; - FbTk::ThemeItem title, frame, hilite; - FbTk::ThemeItem titlefont, framefont; - FbTk::ThemeItem framefont_justify, titlefont_justify; - FbTk::ThemeItem bullet_pos; - FbTk::ThemeItem m_bullet; - FbTk::ThemeItem m_title_height, m_item_height; - FbTk::ThemeItem m_border_width; - FbTk::ThemeItem m_bevel_width; - FbTk::ThemeItem m_border_color; - FbTk::ThemeItem m_bullet_pixmap, m_selected_pixmap, m_unselected_pixmap; - FbTk::ThemeItem m_hl_bullet_pixmap, m_hl_selected_pixmap, m_hl_unselected_pixmap; + ThemeItem t_text, f_text, h_text, d_text, u_text; + ThemeItem title, frame, hilite; + ThemeItem titlefont, framefont; + ThemeItem framefont_justify, titlefont_justify; + ThemeItem bullet_pos; + ThemeItem m_bullet; + ThemeItem m_shapeplace; + ThemeItem m_title_height, m_item_height; + ThemeItem m_border_width; + ThemeItem m_bevel_width; + ThemeItem m_border_color; + ThemeItem m_bullet_pixmap, m_selected_pixmap, m_unselected_pixmap; + ThemeItem m_hl_bullet_pixmap, m_hl_selected_pixmap, m_hl_unselected_pixmap; Display *m_display; - FbTk::GContext t_text_gc, f_text_gc, u_text_gc, h_text_gc, d_text_gc, hilite_gc; + GContext t_text_gc, f_text_gc, u_text_gc, h_text_gc, d_text_gc, hilite_gc; unsigned char m_alpha; MenuMode m_menumode; diff --git a/src/LayerMenu.cc b/src/LayerMenu.cc index 4a02214..d8612e5 100644 --- a/src/LayerMenu.cc +++ b/src/LayerMenu.cc @@ -30,7 +30,7 @@ #include "FbTk/SimpleCommand.hh" #include "FbTk/I18n.hh" -LayerMenu::LayerMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl, +LayerMenu::LayerMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, LayerObject *object, bool save_rc): ToggleMenu(tm, imgctrl, layer) { _FB_USES_NLS; diff --git a/src/LayerMenu.hh b/src/LayerMenu.hh index 7882fd7..fa4987b 100644 --- a/src/LayerMenu.hh +++ b/src/LayerMenu.hh @@ -64,7 +64,7 @@ private: /// Create a layer menu inside from the given menu class LayerMenu : public ToggleMenu { public: - LayerMenu(class MenuTheme &tm, FbTk::ImageControl &imgctrl, + LayerMenu(class FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, LayerObject *item, bool save_rc); void show(); }; diff --git a/src/Makefile.am b/src/Makefile.am index c128f9f..9b0b1aa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -116,7 +116,6 @@ fluxbox_SOURCES = AtomHandler.hh ArrowButton.hh ArrowButton.cc \ Xutil.hh Xutil.cc \ CurrentWindowCmd.hh CurrentWindowCmd.cc \ WorkspaceCmd.hh WorkspaceCmd.cc \ - MenuTheme.hh MenuTheme.cc \ CommandDialog.hh CommandDialog.cc SendToMenu.hh SendToMenu.cc \ AlphaMenu.hh AlphaMenu.cc ObjectResource.hh \ CompareWindow.hh \ diff --git a/src/MenuTheme.cc b/src/MenuTheme.cc deleted file mode 100644 index d7f8388..0000000 --- a/src/MenuTheme.cc +++ /dev/null @@ -1,31 +0,0 @@ -// MenuTheme.cc -// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -// $Id$ - -#include "MenuTheme.hh" -#include "StringUtil.hh" - -MenuTheme::MenuTheme(int screen_num):FbTk::MenuTheme(screen_num), - m_shapeplace(*this, "menu.roundCorners", "Menu.RoundCorners") { - *m_shapeplace = FbTk::Shape::NONE; - FbTk::ThemeManager::instance().loadTheme(*this); -} diff --git a/src/MenuTheme.hh b/src/MenuTheme.hh deleted file mode 100644 index d6a870b..0000000 --- a/src/MenuTheme.hh +++ /dev/null @@ -1,40 +0,0 @@ -// MenuTheme.hh -// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -// $Id$ - -#ifndef MENUTHEME_HH -#define MENUTHEME_HH - -#include "FbTk/MenuTheme.hh" -#include "FbTk/Shape.hh" - -/// this class extends FbTk MenuTheme and adds shape item -class MenuTheme:public FbTk::MenuTheme { -public: - explicit MenuTheme(int screen_num); - FbTk::Shape::ShapePlace shapePlaces() const { return *m_shapeplace; } -private: - FbTk::ThemeItem m_shapeplace; -}; - -#endif // MENUTHEME_HH - diff --git a/src/Screen.cc b/src/Screen.cc index 03d8fd2..a09f4d1 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -39,7 +39,7 @@ // themes #include "FbWinFrameTheme.hh" -#include "MenuTheme.hh" +#include "FbTk/MenuTheme.hh" #include "RootTheme.hh" #include "WinButtonTheme.hh" #include "SlitTheme.hh" @@ -357,7 +357,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm, // because winbutton need to rescale the pixmaps in winbutton theme // after fbwinframe have resized them m_winbutton_theme(new WinButtonTheme(scrn, *m_windowtheme)), - m_menutheme(new MenuTheme(scrn)), + m_menutheme(new FbTk::MenuTheme(scrn)), m_root_window(scrn), m_geom_window(m_root_window, 0, 0, 10, 10, diff --git a/src/Screen.hh b/src/Screen.hh index 41a7b90..689150c 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -29,8 +29,8 @@ #include "FbWinFrame.hh" #include "FbRootWindow.hh" -#include "MenuTheme.hh" +#include "FbTk/MenuTheme.hh" #include "FbTk/EventHandler.hh" #include "FbTk/Resource.hh" #include "FbTk/Subject.hh" @@ -279,8 +279,8 @@ public: FbWinFrameTheme &winFrameTheme() { return *m_windowtheme.get(); } const FbWinFrameTheme &winFrameTheme() const { return *m_windowtheme.get(); } - MenuTheme &menuTheme() { return *m_menutheme.get(); } - const MenuTheme &menuTheme() const { return *m_menutheme.get(); } + FbTk::MenuTheme &menuTheme() { return *m_menutheme.get(); } + const FbTk::MenuTheme &menuTheme() const { return *m_menutheme.get(); } const RootTheme &rootTheme() const { return *m_root_theme.get(); } WinButtonTheme &winButtonTheme() { return *m_winbutton_theme.get(); } const WinButtonTheme &winButtonTheme() const { return *m_winbutton_theme.get(); } @@ -520,7 +520,7 @@ private: std::auto_ptr m_windowtheme; std::auto_ptr m_winbutton_theme; - std::auto_ptr m_menutheme; + std::auto_ptr m_menutheme; std::auto_ptr m_root_theme; FbRootWindow m_root_window; diff --git a/src/ToggleMenu.hh b/src/ToggleMenu.hh index 66f33c4..cb33667 100644 --- a/src/ToggleMenu.hh +++ b/src/ToggleMenu.hh @@ -32,7 +32,7 @@ */ class ToggleMenu: public FbMenu { public: - ToggleMenu(class MenuTheme &tm, FbTk::ImageControl &imgctrl, + ToggleMenu(class FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer):FbMenu(tm, imgctrl, layer) {} virtual ~ToggleMenu() {} diff --git a/src/Xinerama.hh b/src/Xinerama.hh index f57c584..24b4ca1 100644 --- a/src/Xinerama.hh +++ b/src/Xinerama.hh @@ -63,7 +63,7 @@ private: template class XineramaHeadMenu : public FbMenu { public: - XineramaHeadMenu(MenuTheme &tm, BScreen &screen, FbTk::ImageControl &imgctrl, + XineramaHeadMenu(FbTk::MenuTheme &tm, BScreen &screen, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, ItemType &item, const FbTk::FbString & title = ""); private: @@ -72,7 +72,7 @@ private: template -XineramaHeadMenu::XineramaHeadMenu(MenuTheme &tm, BScreen &screen, FbTk::ImageControl &imgctrl, +XineramaHeadMenu::XineramaHeadMenu(FbTk::MenuTheme &tm, BScreen &screen, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, ItemType &item, const FbTk::FbString & title): FbMenu(tm, imgctrl, layer), m_object(item) -- cgit v0.11.2