setItemSelected(4, screen.doFullMax());
setItemSelected(5, screen.doFocusNew());
setItemSelected(6, screen.doFocusLast());
- setItemSelected(7, screen.doToolbarHide());
+ setItemSelected(7, screen.hideToolbar());
}
Configmenu::~Configmenu(void) {
break;
}
case 6:{ //toggle toolbar hide
- screen.saveToolbarHide(!(screen.doToolbarHide()));
- setItemSelected(index, screen.doToolbarHide());
+ screen.setHideToolbar(!screen.hideToolbar());
+ setItemSelected(index, screen.hideToolbar());
break;
}
} // switch
#define FONT_ELEMENT_SIZE 50
#endif // FONT_ELEMENT_SIZE
+#include <strstream>
#include <string>
#include <algorithm>
current_workspace = workspacesList->first();
workspacemenu->setItemSelected(2, True);
- toolbar = new Toolbar(*this);
+ toolbar = new Toolbar(*this, config);
#ifdef SLIT
slit = new Slit(*this, config);
return fs;
}
+void BScreen::load() {
+ std::ostrstream rscreen, rname, rclass;
+ std::string s;
+ bool b;
+ long l;
+ rscreen << "session.screen" << getScreenNumber() << '.' << ends;
+
+ rname << rscreen.str() << "hideToolbar" << ends;
+ rclass << rscreen.str() << "HideToolbar" << ends;
+ if (config.getValue(rname.str(), rclass.str(), b))
+ resource.hide_toolbar = b;
+
+}
void BScreen::reconfigure(void) {
+ load();
LoadStyle();
XGCValues gcv;
*(session_stack + i++) = tmp->getWindowID();
*(session_stack + i++) = rootmenu->getWindowID();
- if (toolbar->isOnTop())
+ if (toolbar->onTop())
*(session_stack + i++) = toolbar->getWindowID();
#ifdef SLIT
}
}
-void BScreen::saveToolbarHide(Bool b){
- resource.toolbar_total_hide = b;
- if (toolbar != NULL){
- if (b)
- toolbar->unMapToolbar();
- else
- toolbar->mapToolbar();
- }
-
+void BScreen::setHideToolbar(bool b) {
+ resource.hide_toolbar = b;
+ if (resource.hide_toolbar)
+ getToolbar()->unMapToolbar();
+ else
+ getToolbar()->mapToolbar();
+ ostrstream s;
+ s << "session.screen" << getScreenNumber() << ".hideToolbar" << ends;
+ config.setValue(s.str(), resource.hide_toolbar ? "True" : "False");
}
+
ToolbarStyle tstyle;
MenuStyle mstyle;
- Bool toolbar_on_top, toolbar_auto_hide, sloppy_focus, auto_raise,
+ Bool sloppy_focus, auto_raise,
auto_edge_balance, image_dither, ordered_dither, opaque_move, full_max,
- focus_new, focus_last, toolbar_total_hide;
+ focus_new, focus_last;
+ bool hide_toolbar;
BColor border_color;
Resource styleconfig;
int workspaces, toolbar_placement, toolbar_width_percent, placement_policy,
edge_snap_threshold, row_direction, col_direction;
-#ifdef SLIT
- Bool slit_on_top, slit_auto_hide;
- int slit_placement, slit_direction;
-#endif // SLIT
-
unsigned int handle_width, bevel_width, frame_width, border_width;
unsigned int zones; // number of zones to be used when alt-resizing a window
XFontSet createFontSet(const char *);
void readDatabaseFont(const char *, const char *, XFontStruct **);
- void InitMenu(void);
- void LoadStyle(void);
+ void InitMenu();
+ void LoadStyle();
public:
BScreen(Openbox &, int, Resource &);
- ~BScreen(void);
-
- inline const Bool &isToolbarOnTop(void) const
- { return resource.toolbar_on_top; }
- inline const Bool &doToolbarAutoHide(void) const
- { return resource.toolbar_auto_hide; }
- inline const Bool &doToolbarHide(void) const
- {return resource.toolbar_total_hide;}
- inline const Bool &isSloppyFocus(void) const
+ ~BScreen();
+
+ inline const Bool &isSloppyFocus() const
{ return resource.sloppy_focus; }
- inline const Bool &isRootColormapInstalled(void) const
+ inline const Bool &isRootColormapInstalled() const
{ return root_colormap_installed; }
- inline const Bool &doAutoRaise(void) const { return resource.auto_raise; }
- inline const Bool &isScreenManaged(void) const { return managed; }
- inline const Bool &doImageDither(void) const
+ inline const Bool &doAutoRaise() const { return resource.auto_raise; }
+ inline const Bool &isScreenManaged() const { return managed; }
+ inline const Bool &doImageDither() const
{ return resource.image_dither; }
- inline const Bool &doOrderedDither(void) const
+ inline const Bool &doOrderedDither() const
{ return resource.ordered_dither; }
- inline const Bool &doOpaqueMove(void) const { return resource.opaque_move; }
- inline const Bool &doFullMax(void) const { return resource.full_max; }
- inline const Bool &doFocusNew(void) const { return resource.focus_new; }
- inline const Bool &doFocusLast(void) const { return resource.focus_last; }
+ inline const Bool &doOpaqueMove() const { return resource.opaque_move; }
+ inline const Bool &doFullMax() const { return resource.full_max; }
+ inline const Bool &doFocusNew() const { return resource.focus_new; }
+ inline const Bool &doFocusLast() const { return resource.focus_last; }
inline const GC &getOpGC() const { return opGC; }
- inline Openbox &getOpenbox(void) { return openbox; }
- inline BColor *getBorderColor(void) { return &resource.border_color; }
- inline BImageControl *getImageControl(void) { return image_control; }
- inline Rootmenu *getRootmenu(void) { return rootmenu; }
+ inline Openbox &getOpenbox() { return openbox; }
+ inline BColor *getBorderColor() { return &resource.border_color; }
+ inline BImageControl *getImageControl() { return image_control; }
+ inline Rootmenu *getRootmenu() { return rootmenu; }
#ifdef SLIT
- inline Slit *getSlit(void) { return slit; }
+ inline Slit *getSlit() { return slit; }
#endif // SLIT
- inline int getWindowZones(void) const
+ inline int getWindowZones() const
{ return resource.zones; }
inline void saveWindowZones(int z) { resource.zones = z; }
- inline Toolbar *getToolbar(void) { return toolbar; }
+ inline Toolbar *getToolbar() { return toolbar; }
inline Workspace *getWorkspace(int w) { return workspacesList->find(w); }
- inline Workspace *getCurrentWorkspace(void) { return current_workspace; }
+ inline Workspace *getCurrentWorkspace() { return current_workspace; }
- inline Workspacemenu *getWorkspacemenu(void) { return workspacemenu; }
+ inline Workspacemenu *getWorkspacemenu() { return workspacemenu; }
- inline const unsigned int &getHandleWidth(void) const
+ inline const unsigned int &getHandleWidth() const
{ return resource.handle_width; }
- inline const unsigned int &getBevelWidth(void) const
+ inline const unsigned int &getBevelWidth() const
{ return resource.bevel_width; }
- inline const unsigned int &getFrameWidth(void) const
+ inline const unsigned int &getFrameWidth() const
{ return resource.frame_width; }
- inline const unsigned int &getBorderWidth(void) const
+ inline const unsigned int &getBorderWidth() const
{ return resource.border_width; }
inline const int getCurrentWorkspaceID()
{ return current_workspace->getWorkspaceID(); }
- inline const int getWorkspaceCount(void) { return workspacesList->count(); }
- inline const int getIconCount(void) { return iconList->count(); }
- inline const int &getNumberOfWorkspaces(void) const
+ inline const int getWorkspaceCount() { return workspacesList->count(); }
+ inline const int getIconCount() { return iconList->count(); }
+ inline const int &getNumberOfWorkspaces() const
{ return resource.workspaces; }
- inline const int &getToolbarPlacement(void) const
- { return resource.toolbar_placement; }
- inline const int &getToolbarWidthPercent(void) const
- { return resource.toolbar_width_percent; }
- inline const int &getPlacementPolicy(void) const
+ inline const int &getPlacementPolicy() const
{ return resource.placement_policy; }
- inline const int &getEdgeSnapThreshold(void) const
+ inline const int &getEdgeSnapThreshold() const
{ return resource.edge_snap_threshold; }
- inline const int &getRowPlacementDirection(void) const
+ inline const int &getRowPlacementDirection() const
{ return resource.row_direction; }
- inline const int &getColPlacementDirection(void) const
+ inline const int &getColPlacementDirection() const
{ return resource.col_direction; }
inline void saveRootCommand(const char *cmd) {
else
resource.root_command = NULL;
}
- inline const char *getRootCommand(void) const
+ inline const char *getRootCommand() const
{ return resource.root_command; }
inline void setRootColormapInstalled(Bool r) { root_colormap_installed = r; }
inline void saveSloppyFocus(Bool s) { resource.sloppy_focus = s; }
inline void saveAutoRaise(Bool a) { resource.auto_raise = a; }
inline void saveWorkspaces(int w) { resource.workspaces = w; }
- inline void saveToolbarOnTop(Bool r) { resource.toolbar_on_top = r; }
- inline void saveToolbarAutoHide(Bool r) { resource.toolbar_auto_hide = r; }
- inline void saveToolbarWidthPercent(int w)
- { resource.toolbar_width_percent = w; }
- inline void saveToolbarPlacement(int p) { resource.toolbar_placement = p; }
inline void savePlacementPolicy(int p) { resource.placement_policy = p; }
inline void saveRowPlacementDirection(int d) { resource.row_direction = d; }
inline void saveColPlacementDirection(int d) { resource.col_direction = d; }
inline void saveFullMax(Bool f) { resource.full_max = f; }
inline void saveFocusNew(Bool f) { resource.focus_new = f; }
inline void saveFocusLast(Bool f) { resource.focus_last = f; }
- inline void iconUpdate(void) { iconmenu->update(); }
+ inline void iconUpdate() { iconmenu->update(); }
#ifdef HAVE_STRFTIME
- inline char *getStrftimeFormat(void) { return resource.strftime_format; }
+ inline char *getStrftimeFormat() { return resource.strftime_format; }
void saveStrftimeFormat(const char *);
#else // !HAVE_STRFTIME
- inline int getDateFormat(void) { return resource.date_format; }
+ inline int getDateFormat() { return resource.date_format; }
inline void saveDateFormat(int f) { resource.date_format = f; }
- inline Bool isClock24Hour(void) { return resource.clock24hour; }
+ inline Bool isClock24Hour() { return resource.clock24hour; }
inline void saveClock24Hour(Bool c) { resource.clock24hour = c; }
#endif // HAVE_STRFTIME
- inline WindowStyle *getWindowStyle(void) { return &resource.wstyle; }
- inline MenuStyle *getMenuStyle(void) { return &resource.mstyle; }
- inline ToolbarStyle *getToolbarStyle(void) { return &resource.tstyle; }
+ inline bool hideToolbar() const { return resource.hide_toolbar; }
+ void setHideToolbar(bool);
+
+ inline WindowStyle *getWindowStyle() { return &resource.wstyle; }
+ inline MenuStyle *getMenuStyle() { return &resource.mstyle; }
+ inline ToolbarStyle *getToolbarStyle() { return &resource.tstyle; }
OpenboxWindow *getIcon(int);
- int addWorkspace(void);
- int removeLastWorkspace(void);
+ int addWorkspace();
+ int removeLastWorkspace();
- void removeWorkspaceNames(void);
+ void removeWorkspaceNames();
void addWorkspaceName(const char *);
void addNetizen(Netizen *);
void removeNetizen(Window);
void changeWorkspaceID(int);
void raiseWindows(Window *, int);
void reassociateWindow(OpenboxWindow *, int, Bool);
- void prevFocus(void);
- void nextFocus(void);
- void raiseFocus(void);
- void reconfigure(void);
- void rereadMenu(void);
- void shutdown(void);
+ void prevFocus();
+ void nextFocus();
+ void raiseFocus();
+ void reconfigure();
+ void load();
+ void rereadMenu();
+ void shutdown();
void showPosition(int, int);
void showGeometry(unsigned int, unsigned int);
- void hideGeometry(void);
- void saveToolbarHide( Bool b);
- void updateNetizenCurrentWorkspace(void);
- void updateNetizenWorkspaceCount(void);
- void updateNetizenWindowFocus(void);
+ void hideGeometry();
+ void updateNetizenCurrentWorkspace();
+ void updateNetizenWorkspaceCount();
+ void updateNetizenWindowFocus();
void updateNetizenWindowAdd(Window, unsigned long);
void updateNetizenWindowDel(Window);
void updateNetizenConfigNotify(XEvent *);
void Slit::setPlacement(int p) {
m_placement = p;
- cout << "setting " << p << " " << m_placement << endl;
ostrstream s;
s << "session.screen" << screen.getScreenNumber() << ".slit.placement" <<
ends;
rname << rscreen.str() << "slit.placement" << ends;
rclass << rscreen.str() << "Slit.Placement" << ends;
if (config.getValue(rname.str(), rclass.str(), s)) {
- cout << "getting " << s.c_str() << endl;
if (0 == strncasecmp(s.c_str(), "TopLeft", s.length()))
m_placement = TopLeft;
else if (0 == strncasecmp(s.c_str(), "CenterLeft", s.length()))
# endif // HAVE_SYS_TIME_H
#endif // TIME_WITH_SYS_TIME
+#include <strstream>
+#include <string>
+
+Toolbar::Toolbar(BScreen &scrn, Resource &conf) : screen(scrn),
+ openbox(scrn.getOpenbox()), config(conf)
+{
+ // default values
+ m_width_percent =66;
+ m_placement = BottomCenter;
+ m_ontop = false;
+ m_hidden = m_autohide = false;
-Toolbar::Toolbar(BScreen &scrn) : screen(scrn), openbox(scrn.getOpenbox()) {
// get the clock updating every minute
clock_timer = new BTimer(openbox, *this);
timeval now;
image_ctrl = screen.getImageControl();
- on_top = screen.isToolbarOnTop();
- hidden = do_auto_hide = screen.doToolbarAutoHide();
-
- editing = False;
+ m_editing = False;
new_workspace_name = (char *) 0;
new_name_pos = 0;
frame.grab_x = frame.grab_y = 0;
mapToolbar();
}
-inline void Toolbar::mapToolbar(){
- if(!screen.doToolbarHide()){
- do_hide=false;//not hidden, so windows should not maximize over the toolbar
+int Toolbar::getX() const {
+ return ((m_hidden) ? frame.x_hidden : frame.x);
+}
+
+int Toolbar::getY() const {
+ if (screen.hideToolbar()) return screen.size().h();
+ else if (m_hidden) return frame.y_hidden;
+ else return frame.y;
+}
+
+unsigned int Toolbar::getExposedHeight() const {
+ if (screen.hideToolbar()) return 0;
+ else if (m_autohide) return frame.bevel_w;
+ else return frame.height;
+}
+
+void Toolbar::mapToolbar(){
+ if (!screen.hideToolbar()) {
+ //not hidden, so windows should not maximize over the toolbar
XMapSubwindows(display, frame.window);
XMapWindow(display, frame.window);
- }else
- do_hide=true;
+ }
}
-inline void Toolbar::unMapToolbar(){
- do_hide=true; //hidden so we can maximize over the toolbar
+
+void Toolbar::unMapToolbar(){
+ //hidden so we can maximize over the toolbar
XUnmapWindow(display, frame.window);
}
-Toolbar::~Toolbar(void) {
+Toolbar::~Toolbar() {
unMapToolbar();
if (frame.base) image_ctrl->removeImage(frame.base);
if (frame.label) image_ctrl->removeImage(frame.label);
}
-void Toolbar::reconfigure(void) {
+void Toolbar::setOnTop(bool b) {
+ m_ontop = b;
+ ostrstream s;
+ s << "session.screen" << screen.getScreenNumber() << ".toolbar.onTop" << ends;
+ config.setValue(s.str(), m_ontop ? "True" : "False");
+}
+
+void Toolbar::setAutoHide(bool b) {
+ m_autohide = b;
+ ostrstream s;
+ s << "session.screen" << screen.getScreenNumber() << ".toolbar.autoHide" <<
+ ends;
+ config.setValue(s.str(), m_autohide ? "True" : "False");
+}
+
+void Toolbar::setWidthPercent(int w) {
+ m_width_percent = w;
+ ostrstream s;
+ s << "session.screen" << screen.getScreenNumber() << ".toolbar.widthPercent"
+ << ends;
+ config.setValue(s.str(), m_width_percent);
+}
+
+void Toolbar::setPlacement(int p) {
+ m_placement = p;
+ ostrstream s;
+ s << "session.screen" << screen.getScreenNumber() << ".toolbar.placement" <<
+ ends;
+ const char *placement;
+ switch (m_placement) {
+ case TopLeft: placement = "TopLeft"; break;
+ case BottomLeft: placement = "BottomLeft"; break;
+ case TopCenter: placement = "TopCenter"; break;
+ case TopRight: placement = "TopRight"; break;
+ case BottomRight: placement = "BottomRight"; break;
+ case BottomCenter: default: placement = "BottomCenter"; break;
+ }
+ config.setValue(s.str(), placement);
+}
+
+void Toolbar::load() {
+ std::ostrstream rscreen, rname, rclass;
+ std::string s;
+ bool b;
+ long l;
+ rscreen << "session.screen" << screen.getScreenNumber() << '.' << ends;
+
+ rname << rscreen.str() << "toolbar.widthPercent" << ends;
+ rclass << rscreen.str() << "Toolbar.WidthPercent" << ends;
+ if (config.getValue(rname.str(), rclass.str(), l) && (l > 0 && l <= 100))
+ m_width_percent = l;
+
+ rname.seekp(0); rclass.seekp(0);
+ rname << rscreen.str() << "toolbar.placement" << ends;
+ rclass << rscreen.str() << "Toolbar.Placement" << ends;
+ if (config.getValue(rname.str(), rclass.str(), s)) {
+ if (0 == strncasecmp(s.c_str(), "TopLeft", s.length()))
+ m_placement = TopLeft;
+ else if (0 == strncasecmp(s.c_str(), "BottomLeft", s.length()))
+ m_placement = BottomLeft;
+ else if (0 == strncasecmp(s.c_str(), "TopCenter", s.length()))
+ m_placement = TopCenter;
+ else if (0 == strncasecmp(s.c_str(), "TopRight", s.length()))
+ m_placement = TopRight;
+ else if ( 0 == strncasecmp(s.c_str(), "BottomRight", s.length()))
+ m_placement = BottomRight;
+ else if ( 0 == strncasecmp(s.c_str(), "BottomCenter", s.length()))
+ m_placement = BottomCenter;
+ }
+
+ rname.seekp(0); rclass.seekp(0);
+ rname << rscreen.str() << "toolbar.onTop" << ends;
+ rclass << rscreen.str() << "Toolbar.OnTop" << ends;
+ if (config.getValue(rname.str(), rclass.str(), b))
+ m_ontop = b;
+
+ rname.seekp(0); rclass.seekp(0);
+ rname << rscreen.str() << "toolbar.autoHide" << ends;
+ rclass << rscreen.str() << "Toolbar.AutoHide" << ends;
+ if (config.getValue(rname.str(), rclass.str(), b))
+ m_hidden = m_autohide = b;
+}
+
+void Toolbar::reconfigure() {
frame.bevel_w = screen.getBevelWidth();
- frame.width = screen.size().w() * screen.getToolbarWidthPercent() / 100;
+ frame.width = screen.size().w() * m_width_percent / 100;
if (i18n->multibyte())
frame.height =
frame.label_h = frame.height;
frame.height += (frame.bevel_w * 2);
- switch (screen.getToolbarPlacement()) {
+ switch (m_placement) {
case TopLeft:
frame.x = 0;
frame.y = 0;
(frame.width - (frame.clock_w + (frame.button_w * 4) +
frame.workspace_label_w + (frame.bevel_w * 8) + 6));
- if (hidden) {
+ if (m_hidden) {
XMoveResizeWindow(display, frame.window, frame.x_hidden, frame.y_hidden,
frame.width, frame.height);
} else {
}
-void Toolbar::edit(void) {
+void Toolbar::edit() {
Window window;
int foo;
- editing = True;
+ m_editing = True;
if (XGetInputFocus(display, &window, &foo) &&
window == frame.workspace_label)
return;
checkClock(True, True);
}
#endif // HAVE_STRFTIME
- else if (! on_top) {
+ else if (! m_ontop) {
Window w[1] = { frame.window };
screen.raiseWindows(w, 1);
}
- } else if (be->button == 2 && (! on_top)) {
+ } else if (be->button == 2 && (! m_ontop)) {
XLowerWindow(display, frame.window);
} else if (be->button == 3) {
if (! toolbarmenu->isVisible()) {
void Toolbar::enterNotifyEvent(XCrossingEvent *) {
- if (! do_auto_hide)
+ if (! m_autohide)
return;
- if (hidden) {
+ if (m_hidden) {
if (! hide_timer->isTiming()) hide_timer->start();
} else {
if (hide_timer->isTiming()) hide_timer->stop();
}
void Toolbar::leaveNotifyEvent(XCrossingEvent *) {
- if (! do_auto_hide)
+ if (! m_autohide)
return;
- if (hidden) {
+ if (m_hidden) {
if (hide_timer->isTiming()) hide_timer->stop();
} else if (! toolbarmenu->isVisible()) {
if (! hide_timer->isTiming()) hide_timer->start();
void Toolbar::exposeEvent(XExposeEvent *ee) {
if (ee->window == frame.clock) checkClock(True);
- else if (ee->window == frame.workspace_label && (! editing))
+ else if (ee->window == frame.workspace_label && (! m_editing))
redrawWorkspaceLabel();
else if (ee->window == frame.window_label) redrawWindowLabel();
else if (ee->window == frame.psbutton) redrawPrevWorkspaceButton();
void Toolbar::keyPressEvent(XKeyEvent *ke) {
- if (ke->window == frame.workspace_label && editing) {
+ if (ke->window == frame.workspace_label && m_editing) {
openbox.grab();
if (! new_workspace_name) {
if (ks == XK_Return || new_name_pos == 127) {
*(new_workspace_name + new_name_pos) = 0;
- editing = False;
+ m_editing = False;
openbox.setNoFocus(False);
if (openbox.getFocusedWindow()) {
}
-void Toolbar::timeout(void) {
+void Toolbar::timeout() {
checkClock(True);
timeval now;
}
-void Toolbar::HideHandler::timeout(void) {
- toolbar->hidden = ! toolbar->hidden;
- if (toolbar->hidden)
+void Toolbar::HideHandler::timeout() {
+ toolbar->m_hidden = !toolbar->m_hidden;
+ if (toolbar->m_hidden)
XMoveWindow(toolbar->display, toolbar->frame.window,
toolbar->frame.x_hidden, toolbar->frame.y_hidden);
else
update();
- if (toolbar.isOnTop()) setItemSelected(1, True);
- if (toolbar.doAutoHide()) setItemSelected(2, True);
+ if (toolbar.onTop()) setItemSelected(1, True);
+ if (toolbar.autoHide()) setItemSelected(2, True);
}
-Toolbarmenu::~Toolbarmenu(void) {
+Toolbarmenu::~Toolbarmenu() {
delete placementmenu;
}
switch (item->function()) {
case 1: { // always on top
- Bool change = ((toolbar.isOnTop()) ? False : True);
- toolbar.on_top = change;
+ Bool change = ((toolbar.onTop()) ? False : True);
+ toolbar.setOnTop(change);
setItemSelected(1, change);
- if (toolbar.isOnTop()) toolbar.screen.raiseWindows((Window *) 0, 0);
+ if (toolbar.onTop()) toolbar.screen.raiseWindows((Window *) 0, 0);
break;
}
case 2: { // auto hide
- Bool change = ((toolbar.doAutoHide()) ? False : True);
- toolbar.do_auto_hide = change;
+ Bool change = ((toolbar.autoHide()) ? False : True);
+ toolbar.setAutoHide(change);
setItemSelected(2, change);
#ifdef SLIT
}
-void Toolbarmenu::internal_hide(void) {
+void Toolbarmenu::internal_hide() {
Basemenu::internal_hide();
- if (toolbar.doAutoHide() && ! toolbar.isEditing())
+ if (toolbar.autoHide() && ! toolbar.isEditing())
toolbar.hide_handler.timeout();
}
-void Toolbarmenu::reconfigure(void) {
+void Toolbarmenu::reconfigure() {
placementmenu->reconfigure();
Basemenu::reconfigure();
BasemenuItem *item = find(index);
if (! item) return;
- toolbarmenu.toolbar.screen.saveToolbarPlacement(item->function());
+ toolbarmenu.toolbar.setPlacement(item->function());
hide();
toolbarmenu.toolbar.reconfigure();
#include "Basemenu.h"
#include "Timer.h"
+#include "Resource.h"
#include "Screen.h"
// forward declaration
protected:
virtual void itemSelected(int, int);
- virtual void internal_hide(void);
+ virtual void internal_hide();
public:
Toolbarmenu(Toolbar &);
- ~Toolbarmenu(void);
+ ~Toolbarmenu();
- inline Basemenu *getPlacementmenu(void) { return placementmenu; }
+ inline Basemenu *getPlacementmenu() { return placementmenu; }
- void reconfigure(void);
+ void reconfigure();
};
class Toolbar : public TimeoutHandler {
private:
- Bool on_top, editing, hidden, do_auto_hide, do_hide;
+ bool m_ontop, m_editing, m_hidden, m_autohide;
+ int m_width_percent, m_placement;
Display *display;
struct frame {
class HideHandler : public TimeoutHandler {
public:
Toolbar *toolbar;
-
- virtual void timeout(void);
+ virtual void timeout();
} hide_handler;
Openbox &openbox;
+ Resource &config;
BImageControl *image_ctrl;
BScreen &screen;
BTimer *clock_timer, *hide_timer;
public:
- Toolbar(BScreen &);
- virtual ~Toolbar(void);
-
- inline Toolbarmenu *getMenu(void) { return toolbarmenu; }
+ Toolbar(BScreen &, Resource &);
+ virtual ~Toolbar();
- inline const Bool &isEditing(void) const { return editing; }
- inline const Bool &isOnTop(void) const { return on_top; }
- inline const Bool &isHidden(void) const { return hidden; }
- inline const Bool &doAutoHide(void) const { return do_auto_hide; }
+ inline Toolbarmenu *getMenu() { return toolbarmenu; }
- inline const Window &getWindowID(void) const { return frame.window; }
+ inline const Window &getWindowID() const { return frame.window; }
- inline const unsigned int &getWidth(void) const { return frame.width; }
- inline const unsigned int &getHeight(void) const { return frame.height; }
- inline const unsigned int getExposedHeight(void) const {
- if (do_hide) return 0;
- else if (do_auto_hide) return frame.bevel_w;
- else return frame.height;
- }
+ inline unsigned int getWidth() const { return frame.width; }
+ inline unsigned int getHeight() const { return frame.height; }
+ unsigned int getExposedHeight() const;
- inline const int &getX(void) const
- { return ((hidden) ? frame.x_hidden : frame.x); }
- // const int getY(void) const;
- inline const int getY(void) const {
- if (do_hide) return screen.size().h();
- else if (hidden) return frame.y_hidden;
- else return frame.y;
- }
-
+ int getX() const;
+ int getY() const;
void buttonPressEvent(XButtonEvent *);
void buttonReleaseEvent(XButtonEvent *);
void redrawNextWorkspaceButton(Bool = False, Bool = False);
void redrawPrevWindowButton(Bool = False, Bool = False);
void redrawNextWindowButton(Bool = False, Bool = False);
- void edit(void);
- void reconfigure(void);
- void mapToolbar(void);
- void unMapToolbar(void);
+ void edit();
+ void reconfigure();
+ void load();
+ void mapToolbar();
+ void unMapToolbar();
#ifdef HAVE_STRFTIME
void checkClock(Bool = False);
#else // HAVE_STRFTIME
void checkClock(Bool = False, Bool = False);
#endif // HAVE_STRFTIME
- virtual void timeout(void);
+ virtual void timeout();
+
+ inline bool onTop() const { return m_ontop; }
+ void setOnTop(bool);
+ inline bool autoHide() const { return m_autohide; }
+ void setAutoHide(bool);
+
+ inline int widthPercent() const { return m_width_percent; }
+ void setWidthPercent(int);
+
+ inline int placement() const { return m_placement; }
+ void setPlacement(int);
+
+ inline bool isEditing() const { return m_editing; }
+ inline bool isHidden() const { return m_hidden; }
+
enum { TopLeft = 1, BottomLeft, TopCenter,
BottomCenter, TopRight, BottomRight };
};
dy += (((screen->size().h() - screen->getToolbar()->getExposedHeight())
- dh) / 2) - frame.border_w;
- switch (screen->getToolbarPlacement()) {
+ switch (screen->getToolbar()->placement()) {
case Toolbar::TopLeft:
case Toolbar::TopCenter:
case Toolbar::TopRight:
dx = screen->size().w() - snap_w;
int dtty, dbby, dty, dby;
- switch (screen->getToolbarPlacement()) {
+ switch (screen->getToolbar()->placement()) {
case Toolbar::TopLeft:
case Toolbar::TopCenter:
case Toolbar::TopRight:
rc_file = bstrdup(rc);
}
config.setFile(rc_file);
- config.load();
no_focus = False;
sprintf(rc_string, "session.screen%d.workspaces", screen_number);
config.setValue(rc_string, screen->getWorkspaceCount());
- sprintf(rc_string, "session.screen%d.toolbar.onTop", screen_number);
- config.setValue(rc_string, screen->getToolbar()->isOnTop() ?
- "True" : "False");
-
- sprintf(rc_string, "session.screen%d.toolbar.autoHide", screen_number);
- config.setValue(rc_string, screen->getToolbar()->doAutoHide() ?
- "True" : "False");
-
- sprintf(rc_string, "session.screen%d.toolbar.hide", screen_number);
- config.setValue(rc_string, screen->doToolbarHide() ?
- "True" : "False");
-
-
- switch (screen->getToolbarPlacement()) {
- case Toolbar::TopLeft: placement = "TopLeft"; break;
- case Toolbar::BottomLeft: placement = "BottomLeft"; break;
- case Toolbar::TopCenter: placement = "TopCenter"; break;
- case Toolbar::TopRight: placement = "TopRight"; break;
- case Toolbar::BottomRight: placement = "BottomRight"; break;
- default:
- case Toolbar::BottomCenter: placement = "BottomCenter"; break;
- }
-
- sprintf(rc_string, "session.screen%d.toolbar.placement", screen_number);
- config.setValue(rc_string, placement);
-
#ifdef HAVE_STRFTIME
sprintf(rc_string, "session.screen%d.strftimeFormat", screen_number);
config.setValue(rc_string, screen->getStrftimeFormat());
sprintf(rc_string, "session.screen%d.edgeSnapThreshold", screen_number);
config.setValue(rc_string, screen->getEdgeSnapThreshold());
- sprintf(rc_string, "session.screen%d.toolbar.widthPercent", screen_number);
- config.setValue(rc_string, screen->getToolbarWidthPercent());
-
// write out the user's workspace names
int i, len = 0;
for (i = 0; i < screen->getWorkspaceCount(); i++)
else
screen->saveWorkspaces(1);
- sprintf(name_lookup, "session.screen%d.toolbar.widthPercent",
- screen_number);
- sprintf(class_lookup, "Session.Screen%d.Toolbar.WidthPercent",
- screen_number);
- if (config.getValue(name_lookup, class_lookup, l) && (l > 0 && l <= 100))
- screen->saveToolbarWidthPercent(l);
- else
- screen->saveToolbarWidthPercent(66);
-
- sprintf(name_lookup, "session.screen%d.toolbar.placement", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Toolbar.Placement", screen_number);
- if (config.getValue(name_lookup, class_lookup, s)) {
- if (0 == strncasecmp(s.c_str(), "TopLeft", s.length()))
- screen->saveToolbarPlacement(Toolbar::TopLeft);
- else if (0 == strncasecmp(s.c_str(), "BottomLeft", s.length()))
- screen->saveToolbarPlacement(Toolbar::BottomLeft);
- else if (0 == strncasecmp(s.c_str(), "TopCenter", s.length()))
- screen->saveToolbarPlacement(Toolbar::TopCenter);
- else if (0 == strncasecmp(s.c_str(), "TopRight", s.length()))
- screen->saveToolbarPlacement(Toolbar::TopRight);
- else if ( 0 == strncasecmp(s.c_str(), "BottomRight", s.length()))
- screen->saveToolbarPlacement(Toolbar::BottomRight);
- else
- screen->saveToolbarPlacement(Toolbar::BottomCenter);
- } else
- screen->saveToolbarPlacement(Toolbar::BottomCenter);
-
screen->removeWorkspaceNames();
sprintf(name_lookup, "session.screen%d.workspaceNames", screen_number);
sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number);
}
}
- sprintf(name_lookup, "session.screen%d.toolbar.onTop", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Toolbar.OnTop", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveToolbarOnTop((Bool)b);
- else
- screen->saveToolbarOnTop(False);
-
- sprintf(name_lookup, "session.screen%d.toolbar.hide", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Toolbar.Hide", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveToolbarHide((Bool)b);
- else
- screen->saveToolbarHide(False);
-
- sprintf(name_lookup, "session.screen%d.toolbar.autoHide", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Toolbar.autoHide", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveToolbarAutoHide((Bool)b);
- else
- screen->saveToolbarAutoHide(False);
-
sprintf(name_lookup, "session.screen%d.focusModel", screen_number);
sprintf(class_lookup, "Session.Screen%d.FocusModel", screen_number);
if (config.getValue(name_lookup, class_lookup, s)) {