diff options
author | fluxgen <fluxgen> | 2003-07-28 18:28:03 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-07-28 18:28:03 (GMT) |
commit | b72bf7b854ea7e4f308264ca596c86cf013915a6 (patch) | |
tree | 5aafbc66c1fef15f0233a491912f2884e31d455b | |
parent | f71e53fbe919125d40f9c5578ce14b75680f7037 (diff) | |
download | fluxbox-b72bf7b854ea7e4f308264ca596c86cf013915a6.zip fluxbox-b72bf7b854ea7e4f308264ca596c86cf013915a6.tar.bz2 |
added iconmenu to workspace menu
-rw-r--r-- | src/Screen.cc | 31 | ||||
-rw-r--r-- | src/Screen.hh | 4 |
2 files changed, 32 insertions, 3 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 6242b4a..73703eb 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.209 2003/07/28 16:29:24 rathnor Exp $ | 25 | // $Id: Screen.cc,v 1.210 2003/07/28 18:28:03 fluxgen Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -56,6 +56,7 @@ | |||
56 | #include "SlitTheme.hh" | 56 | #include "SlitTheme.hh" |
57 | #include "CommandParser.hh" | 57 | #include "CommandParser.hh" |
58 | #include "MenuTheme.hh" | 58 | #include "MenuTheme.hh" |
59 | #include "IconMenuItem.hh" | ||
59 | 60 | ||
60 | //use GNU extensions | 61 | //use GNU extensions |
61 | #ifndef _GNU_SOURCE | 62 | #ifndef _GNU_SOURCE |
@@ -234,6 +235,7 @@ void setupWorkspacemenu(BScreen &scr, FbTk::Menu &menu) { | |||
234 | menu.setLabel("Workspace"); | 235 | menu.setLabel("Workspace"); |
235 | RefCount<Command> new_workspace(new AddWorkspaceCmd(scr)); | 236 | RefCount<Command> new_workspace(new AddWorkspaceCmd(scr)); |
236 | RefCount<Command> remove_last(new RemoveLastWorkspaceCmd(scr)); | 237 | RefCount<Command> remove_last(new RemoveLastWorkspaceCmd(scr)); |
238 | //!! TODO: NLS | ||
237 | menu.insert("New Workspace", new_workspace); | 239 | menu.insert("New Workspace", new_workspace); |
238 | menu.insert("Remove Last", remove_last); | 240 | menu.insert("Remove Last", remove_last); |
239 | // for each workspace add workspace name and it's menu to our workspace menu | 241 | // for each workspace add workspace name and it's menu to our workspace menu |
@@ -385,6 +387,9 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
385 | 387 | ||
386 | workspacemenu.reset(createMenuFromScreen(*this)); | 388 | workspacemenu.reset(createMenuFromScreen(*this)); |
387 | workspacemenu->setInternalMenu(); | 389 | workspacemenu->setInternalMenu(); |
390 | //!! TODO: NLS | ||
391 | m_iconmenu.reset(createMenuFromScreen(*this, "Icons")); | ||
392 | m_iconmenu->setInternalMenu(); | ||
388 | 393 | ||
389 | if (*resource.workspaces != 0) { | 394 | if (*resource.workspaces != 0) { |
390 | for (int i = 0; i < *resource.workspaces; ++i) { | 395 | for (int i = 0; i < *resource.workspaces; ++i) { |
@@ -401,6 +406,9 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
401 | } | 406 | } |
402 | 407 | ||
403 | setupWorkspacemenu(*this, *workspacemenu); | 408 | setupWorkspacemenu(*this, *workspacemenu); |
409 | //!! TODO: NLS | ||
410 | workspacemenu->insert("Icons", m_iconmenu.get()); | ||
411 | workspacemenu->update(); | ||
404 | 412 | ||
405 | m_current_workspace = m_workspaces_list.front(); | 413 | m_current_workspace = m_workspaces_list.front(); |
406 | 414 | ||
@@ -713,6 +721,7 @@ void BScreen::addIcon(FluxboxWindow *w) { | |||
713 | if (! w) return; | 721 | if (! w) return; |
714 | 722 | ||
715 | m_icon_list.push_back(w); | 723 | m_icon_list.push_back(w); |
724 | updateIconMenu(); | ||
716 | } | 725 | } |
717 | 726 | ||
718 | 727 | ||
@@ -726,6 +735,21 @@ void BScreen::removeIcon(FluxboxWindow *w) { | |||
726 | if (erase_it != m_icon_list.end()) | 735 | if (erase_it != m_icon_list.end()) |
727 | m_icon_list.erase(erase_it); | 736 | m_icon_list.erase(erase_it); |
728 | 737 | ||
738 | updateIconMenu(); | ||
739 | } | ||
740 | |||
741 | |||
742 | void BScreen::updateIconMenu() { | ||
743 | m_iconmenu->removeAll(); | ||
744 | Icons::iterator it = m_icon_list.begin(); | ||
745 | Icons::iterator it_end = m_icon_list.end(); | ||
746 | for (; it != it_end; ++it) { | ||
747 | FluxboxWindow::ClientList::iterator client_it = (*it)->clientList().begin(); | ||
748 | FluxboxWindow::ClientList::iterator client_it_end = (*it)->clientList().end(); | ||
749 | for (; client_it != client_it_end; ++client_it) | ||
750 | m_iconmenu->insert(new IconMenuItem(**client_it)); | ||
751 | } | ||
752 | m_iconmenu->update(); | ||
729 | } | 753 | } |
730 | 754 | ||
731 | void BScreen::removeWindow(FluxboxWindow *win) { | 755 | void BScreen::removeWindow(FluxboxWindow *win) { |
@@ -737,6 +761,7 @@ void BScreen::removeWindow(FluxboxWindow *win) { | |||
737 | 761 | ||
738 | 762 | ||
739 | void BScreen::removeClient(WinClient &client) { | 763 | void BScreen::removeClient(WinClient &client) { |
764 | |||
740 | WinClient *cyc = *cycling_window; | 765 | WinClient *cyc = *cycling_window; |
741 | WinClient *focused = Fluxbox::instance()->getFocusedWindow(); | 766 | WinClient *focused = Fluxbox::instance()->getFocusedWindow(); |
742 | focused_list.remove(&client); | 767 | focused_list.remove(&client); |
@@ -750,7 +775,7 @@ void BScreen::removeClient(WinClient &client) { | |||
750 | else | 775 | else |
751 | Fluxbox::instance()->revertFocus(focused->screen()); | 776 | Fluxbox::instance()->revertFocus(focused->screen()); |
752 | } | 777 | } |
753 | // update client lists | 778 | // update client lists on all workspaces |
754 | for_each(getWorkspacesList().begin(), getWorkspacesList().end(), | 779 | for_each(getWorkspacesList().begin(), getWorkspacesList().end(), |
755 | mem_fun(&Workspace::updateClientmenu)); | 780 | mem_fun(&Workspace::updateClientmenu)); |
756 | 781 | ||
@@ -764,6 +789,8 @@ void BScreen::removeClient(WinClient &client) { | |||
764 | break; | 789 | break; |
765 | } | 790 | } |
766 | } | 791 | } |
792 | // the client could be on icon menu so we update it | ||
793 | updateIconMenu(); | ||
767 | } | 794 | } |
768 | 795 | ||
769 | FluxboxWindow *BScreen::getIcon(unsigned int index) { | 796 | FluxboxWindow *BScreen::getIcon(unsigned int index) { |
diff --git a/src/Screen.hh b/src/Screen.hh index ebd5a60..225a329 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -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.hh,v 1.117 2003/07/28 15:06:34 rathnor Exp $ | 25 | // $Id: Screen.hh,v 1.118 2003/07/28 18:28:03 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef SCREEN_HH | 27 | #ifndef SCREEN_HH |
28 | #define SCREEN_HH | 28 | #define SCREEN_HH |
@@ -344,6 +344,7 @@ private: | |||
344 | bool doSkipWindow(const WinClient &winclient, int options); | 344 | bool doSkipWindow(const WinClient &winclient, int options); |
345 | 345 | ||
346 | void renderGeomWindow(); | 346 | void renderGeomWindow(); |
347 | void updateIconMenu(); | ||
347 | 348 | ||
348 | ScreenSubject | 349 | ScreenSubject |
349 | m_clientlist_sig, ///< client signal | 350 | m_clientlist_sig, ///< client signal |
@@ -385,6 +386,7 @@ private: | |||
385 | 386 | ||
386 | Workspace *m_current_workspace; | 387 | Workspace *m_current_workspace; |
387 | std::auto_ptr<FbTk::Menu> workspacemenu; | 388 | std::auto_ptr<FbTk::Menu> workspacemenu; |
389 | std::auto_ptr<FbTk::Menu> m_iconmenu; | ||
388 | 390 | ||
389 | WorkspaceNames m_workspace_names; | 391 | WorkspaceNames m_workspace_names; |
390 | Workspaces m_workspaces_list; | 392 | Workspaces m_workspaces_list; |