all repos — fluxbox @ 2940869cd7cc1688be5114451380275c9a85f5d1

custom fork of the fluxbox windowmanager

merge MenuTheme with FbTk::MenuTheme
Mark Tiefenbruck mark@fluxbox.org
commit

2940869cd7cc1688be5114451380275c9a85f5d1

parent

62bcfaf0e4fd7d77873343d880fc526ec58cdaa6

M src/AlphaMenu.ccsrc/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) {
M src/AlphaMenu.hhsrc/AlphaMenu.hh

@@ -31,7 +31,7 @@ #include "FbTk/MenuItem.hh"

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
M src/FbMenu.ccsrc/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 @@ m_shape->update();

} void FbMenu::reconfigure() { - m_shape->setPlaces(dynamic_cast<const MenuTheme&>(theme()).shapePlaces()); + m_shape->setPlaces(theme().shapePlaces()); FbTk::Menu::reconfigure(); }
M src/FbMenu.hhsrc/FbMenu.hh

@@ -28,16 +28,15 @@ #include "Menu.hh"

#include "XLayerItem.hh" #include <memory> +namespace FbTk { class MenuTheme; - -namespace FbTk { 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);
M src/FbTk/MenuTheme.ccsrc/FbTk/MenuTheme.cc

@@ -54,6 +54,7 @@ framefont_justify(*this, "menu.frame.justify", "Menu.Frame.Justify"),

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 @@ m_delayopen(0), // no delay as default

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);
M src/FbTk/MenuTheme.hhsrc/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 @@ #include "GContext.hh"

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 @@ /**

@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 @@ inline GContext &disableTextGC() { return d_text_gc; }

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 @@ inline void setDelayClose(int msec) { m_delayclose = msec; }

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 @@ m_hl_selected_pixmap->pixmap().dontFree();

} private: - FbTk::ThemeItem<FbTk::Color> t_text, f_text, h_text, d_text, u_text; - FbTk::ThemeItem<FbTk::Texture> title, frame, hilite; - FbTk::ThemeItem<FbTk::Font> titlefont, framefont; - FbTk::ThemeItem<FbTk::Justify> framefont_justify, titlefont_justify; - FbTk::ThemeItem<FbTk::Justify> bullet_pos; - FbTk::ThemeItem<BulletType> m_bullet; - FbTk::ThemeItem<unsigned int> m_title_height, m_item_height; - FbTk::ThemeItem<unsigned int> m_border_width; - FbTk::ThemeItem<unsigned int> m_bevel_width; - FbTk::ThemeItem<FbTk::Color> m_border_color; - FbTk::ThemeItem<FbTk::PixmapWithMask> m_bullet_pixmap, m_selected_pixmap, m_unselected_pixmap; - FbTk::ThemeItem<FbTk::PixmapWithMask> m_hl_bullet_pixmap, m_hl_selected_pixmap, m_hl_unselected_pixmap; + ThemeItem<Color> t_text, f_text, h_text, d_text, u_text; + ThemeItem<Texture> title, frame, hilite; + ThemeItem<Font> titlefont, framefont; + ThemeItem<Justify> framefont_justify, titlefont_justify; + ThemeItem<Justify> bullet_pos; + ThemeItem<BulletType> m_bullet; + ThemeItem<Shape::ShapePlace> m_shapeplace; + ThemeItem<unsigned int> m_title_height, m_item_height; + ThemeItem<unsigned int> m_border_width; + ThemeItem<unsigned int> m_bevel_width; + ThemeItem<Color> m_border_color; + ThemeItem<PixmapWithMask> m_bullet_pixmap, m_selected_pixmap, m_unselected_pixmap; + ThemeItem<PixmapWithMask> 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;
M src/LayerMenu.ccsrc/LayerMenu.cc

@@ -30,7 +30,7 @@ #include "FbTk/RefCount.hh"

#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;
M src/LayerMenu.hhsrc/LayerMenu.hh

@@ -64,7 +64,7 @@

/// 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(); };
M src/Makefile.amsrc/Makefile.am

@@ -116,7 +116,6 @@ Xinerama.hh \

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 \
D src/MenuTheme.cc

@@ -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); -}
D src/MenuTheme.hh

@@ -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<FbTk::Shape::ShapePlace> m_shapeplace; -}; - -#endif // MENUTHEME_HH -
M src/Screen.ccsrc/Screen.cc

@@ -39,7 +39,7 @@ #include "ScreenPlacement.hh"

// themes #include "FbWinFrameTheme.hh" -#include "MenuTheme.hh" +#include "FbTk/MenuTheme.hh" #include "RootTheme.hh" #include "WinButtonTheme.hh" #include "SlitTheme.hh"

@@ -357,7 +357,7 @@ // the order of windowtheme and winbutton theme is important

// 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,
M src/Screen.hhsrc/Screen.hh

@@ -29,8 +29,8 @@ #define SCREEN_HH

#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 @@ void saveMenu(FbTk::Menu &menu) { m_rootmenu_list.push_back(&menu); }

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 @@ Workspaces m_workspaces_list;

std::auto_ptr<FbWinFrameTheme> m_windowtheme; std::auto_ptr<WinButtonTheme> m_winbutton_theme; - std::auto_ptr<MenuTheme> m_menutheme; + std::auto_ptr<FbTk::MenuTheme> m_menutheme; std::auto_ptr<RootTheme> m_root_theme; FbRootWindow m_root_window;
M src/ToggleMenu.hhsrc/ToggleMenu.hh

@@ -32,7 +32,7 @@ * so that each toggle item gets updated

*/ 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() {}
M src/Xinerama.hhsrc/Xinerama.hh

@@ -63,7 +63,7 @@ /// Create a xinerama menu

template <typename ItemType> 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 @@ };

template <typename ItemType> -XineramaHeadMenu<ItemType>::XineramaHeadMenu(MenuTheme &tm, BScreen &screen, FbTk::ImageControl &imgctrl, +XineramaHeadMenu<ItemType>::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)