diff options
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r-- | src/Toolbar.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 540ceb9..440eff5 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -156,16 +156,22 @@ getString() const { | |||
156 | } // end namespace FbTk | 156 | } // end namespace FbTk |
157 | 157 | ||
158 | namespace { | 158 | namespace { |
159 | class SetToolbarPlacementCmd: public FbTk::Command<void> { | 159 | |
160 | class PlaceToolbarMenuItem: public FbTk::RadioMenuItem { | ||
160 | public: | 161 | public: |
161 | SetToolbarPlacementCmd(Toolbar &tbar, Toolbar::Placement place):m_tbar(tbar), m_place(place) { } | 162 | PlaceToolbarMenuItem(const FbTk::FbString &label, Toolbar &toolbar, |
162 | void execute() { | 163 | Toolbar::Placement place): |
163 | m_tbar.setPlacement(m_place); | 164 | FbTk::RadioMenuItem(label), m_toolbar(toolbar), m_place(place) { |
164 | m_tbar.reconfigure(); | 165 | setCloseOnClick(false); |
166 | } | ||
167 | bool isSelected() const { return m_toolbar.placement() == m_place; } | ||
168 | void click(int button, int time, unsigned int mods) { | ||
169 | m_toolbar.setPlacement(m_place); | ||
170 | m_toolbar.reconfigure(); | ||
165 | Fluxbox::instance()->save_rc(); | 171 | Fluxbox::instance()->save_rc(); |
166 | } | 172 | } |
167 | private: | 173 | private: |
168 | Toolbar &m_tbar; | 174 | Toolbar &m_toolbar; |
169 | Toolbar::Placement m_place; | 175 | Toolbar::Placement m_place; |
170 | }; | 176 | }; |
171 | 177 | ||
@@ -909,11 +915,10 @@ void Toolbar::setupMenus(bool skip_new_placement) { | |||
909 | if (str == "") { | 915 | if (str == "") { |
910 | placementMenu().insert(""); | 916 | placementMenu().insert(""); |
911 | placementMenu().setItemEnabled(i, false); | 917 | placementMenu().setItemEnabled(i, false); |
912 | } else { | 918 | } else |
913 | RefCommand setplace(new SetToolbarPlacementCmd(*this, placement)); | 919 | placementMenu().insert(new PlaceToolbarMenuItem(str, *this, |
914 | placementMenu().insert(str, setplace); | 920 | placement)); |
915 | 921 | ||
916 | } | ||
917 | place_menu.pop_front(); | 922 | place_menu.pop_front(); |
918 | } | 923 | } |
919 | } | 924 | } |