aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-01-12 23:56:49 (GMT)
committerfluxgen <fluxgen>2003-01-12 23:56:49 (GMT)
commit035ed4d4528f001a56e78036e3f5f17b40886715 (patch)
treec500aefe46398190206e68b9de564f2d2b300c73 /src/Screen.cc
parent8f9dc59683fb9f1156bc3ded85cd560d10907005 (diff)
downloadfluxbox-035ed4d4528f001a56e78036e3f5f17b40886715.zip
fluxbox-035ed4d4528f001a56e78036e3f5f17b40886715.tar.bz2
added root theme so it can redraw the background
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc46
1 files changed, 38 insertions, 8 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index c5fac5e..e96dce8 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.99 2003/01/12 18:47:02 fluxgen Exp $ 25// $Id: Screen.cc,v 1.100 2003/01/12 23:56:49 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -239,6 +239,7 @@ getString() {
239} 239}
240 240
241namespace { 241namespace {
242
242class AddWorkspaceCmd:public FbTk::Command { 243class AddWorkspaceCmd:public FbTk::Command {
243public: 244public:
244 explicit AddWorkspaceCmd(BScreen &scrn):m_screen(scrn) { } 245 explicit AddWorkspaceCmd(BScreen &scrn):m_screen(scrn) { }
@@ -262,15 +263,47 @@ private:
262void setupWorkspacemenu(BScreen &scr, FbTk::Menu &menu) { 263void setupWorkspacemenu(BScreen &scr, FbTk::Menu &menu) {
263 menu.removeAll(); // clear all items 264 menu.removeAll(); // clear all items
264 using namespace FbTk; 265 using namespace FbTk;
265 266 menu.setLabel("Workspace");
266 RefCount<Command> new_workspace(new AddWorkspaceCmd(scr)); 267 RefCount<Command> new_workspace(new AddWorkspaceCmd(scr));
267 RefCount<Command> remove_last(new RemoveLastWorkspaceCmd(scr)); 268 RefCount<Command> remove_last(new RemoveLastWorkspaceCmd(scr));
268 menu.insert("New Workspace", new_workspace); 269 menu.insert("New Workspace", new_workspace);
269 menu.insert("Remove Last", remove_last); 270 menu.insert("Remove Last", remove_last);
271 menu.update();
270} 272}
271 273
272}; 274};
273 275
276/// for root command
277class RootTheme: public FbTk::Theme {
278public:
279 explicit RootTheme(BScreen &scr):FbTk::Theme(scr.getScreenNumber()),
280 m_root_command(*this, "rootCommand", "RootCommand"),
281 m_scr(scr) { }
282 void reconfigTheme() {
283 // override resource root command?
284 if (m_scr.getRootCommand() == "") {
285 // do root command
286 FbCommands::ExecuteCmd cmd(*m_root_command);
287 cmd.execute();
288 } else {
289 FbCommands::ExecuteCmd cmd(m_scr.getRootCommand());
290 cmd.execute();
291 }
292 }
293private:
294 FbTk::ThemeItem<std::string> m_root_command;
295 BScreen &m_scr;
296};
297
298template <>
299void FbTk::ThemeItem<std::string>::load() { }
300
301template <>
302void FbTk::ThemeItem<std::string>::setDefaultValue() { *(*this) = ""; }
303
304template <>
305void FbTk::ThemeItem<std::string>::setFromString(const char *str) { *(*this) = (str ? str : ""); }
306
274BScreen::ScreenResource::ScreenResource(ResourceManager &rm, 307BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
275 const std::string &scrname, const std::string &altscrname): 308 const std::string &scrname, const std::string &altscrname):
276 toolbar_on_top(rm, false, scrname+".toolbar.onTop", altscrname+".Toolbar.OnTop"), 309 toolbar_on_top(rm, false, scrname+".toolbar.onTop", altscrname+".Toolbar.OnTop"),
@@ -296,7 +329,6 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
296 tab_placement(rm, Tab::PTOP, scrname+".tab.placement", altscrname+".Tab.Placement"), 329 tab_placement(rm, Tab::PTOP, scrname+".tab.placement", altscrname+".Tab.Placement"),
297 tab_alignment(rm, Tab::ALEFT, scrname+".tab.alignment", altscrname+".Tab.Alignment"), 330 tab_alignment(rm, Tab::ALEFT, scrname+".tab.alignment", altscrname+".Tab.Alignment"),
298 toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead") 331 toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead")
299 // toolbar_placement(rm, Toolbar::BOTTOMCENTER, scrname+".toolbar.placement", altscrname+".Toolbar.Placement")
300{ 332{
301 333
302}; 334};
@@ -310,9 +342,10 @@ BScreen::BScreen(ResourceManager &rm,
310 m_currentworkspace_sig(*this), // current workspace signal 342 m_currentworkspace_sig(*this), // current workspace signal
311 theme(0), m_windowtheme(scrn), 343 theme(0), m_windowtheme(scrn),
312 m_menutheme(new FbTk::MenuTheme(scrn)), 344 m_menutheme(new FbTk::MenuTheme(scrn)),
313 resource(rm, screenname, altscreenname) 345 resource(rm, screenname, altscreenname),
346 m_root_theme(new RootTheme(*this))
314{ 347{
315 Display *disp = BaseDisplay::getXDisplay(); 348 Display *disp = FbTk::App::instance()->display();
316 349
317 event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask | 350 event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
318 SubstructureRedirectMask | KeyPressMask | KeyReleaseMask | 351 SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
@@ -441,7 +474,6 @@ BScreen::BScreen(ResourceManager &rm,
441 current_workspace = workspacesList.front(); 474 current_workspace = workspacesList.front();
442 475
443#ifdef SLIT 476#ifdef SLIT
444 // must create this one before configure menu
445 m_slit.reset(new Slit(*this)); 477 m_slit.reset(new Slit(*this));
446#endif // SLIT 478#endif // SLIT
447 479
@@ -454,8 +486,6 @@ BScreen::BScreen(ResourceManager &rm,
454 486
455 workspacemenu->setItemSelected(2, true); 487 workspacemenu->setItemSelected(2, true);
456 488
457
458 // m_toolbar->setPlacement(*resource.toolbar_placement);
459 m_toolbar->reconfigure(); 489 m_toolbar->reconfigure();
460 490
461 initMenu(); // create and initiate rootmenu 491 initMenu(); // create and initiate rootmenu