X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FToolbar.h;h=bf67b506d209f73731f14594d23a158379935977;hb=66e3f4d0600eeb8c642dc2f3b3320a3e9af075e3;hp=17c4698440fa53aeffb9157777d6c9aee23045fe;hpb=dfc5f034581f5a26cba5c4811500438f89f0634a;p=chaz%2Fopenbox diff --git a/src/Toolbar.h b/src/Toolbar.h index 17c46984..bf67b506 100644 --- a/src/Toolbar.h +++ b/src/Toolbar.h @@ -27,6 +27,8 @@ #include "Basemenu.h" #include "Timer.h" +#include "Resource.h" +#include "Screen.h" // forward declaration class Toolbar; @@ -35,16 +37,16 @@ class Toolbarmenu : public Basemenu { private: class Placementmenu : public Basemenu { private: - Toolbarmenu *toolbarmenu; + Toolbarmenu &toolbarmenu; protected: virtual void itemSelected(int, int); public: - Placementmenu(Toolbarmenu *); + Placementmenu(Toolbarmenu &); }; - Toolbar *toolbar; + Toolbar &toolbar; Placementmenu *placementmenu; friend class Placementmenu; @@ -53,21 +55,23 @@ private: protected: virtual void itemSelected(int, int); - virtual void internal_hide(void); + virtual void internal_hide(); + virtual void setValues(); public: - Toolbarmenu(Toolbar *); - ~Toolbarmenu(void); + Toolbarmenu(Toolbar &); + ~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; + bool m_ontop, m_editing, m_hidden, m_autohide; + int m_width_percent, m_placement; Display *display; struct frame { @@ -84,13 +88,13 @@ private: class HideHandler : public TimeoutHandler { public: Toolbar *toolbar; - - virtual void timeout(void); + virtual void timeout(); } hide_handler; - Openbox *openbox; + Openbox &openbox; + Resource &config; BImageControl *image_ctrl; - BScreen *screen; + BScreen &screen; BTimer *clock_timer, *hide_timer; Toolbarmenu *toolbarmenu; @@ -103,27 +107,20 @@ private: public: - Toolbar(BScreen *); - virtual ~Toolbar(void); - - inline Toolbarmenu *getMenu(void) { return toolbarmenu; } - - 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; } + Toolbar(BScreen &, Resource &); + virtual ~Toolbar(); - inline const Window &getWindowID(void) const { return frame.window; } + inline Toolbarmenu *getMenu() { return toolbarmenu; } - 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 - { return ((do_auto_hide) ? frame.bevel_w : frame.height); } - inline const int &getX(void) const - { return ((hidden) ? frame.x_hidden : frame.x); } - inline const int &getY(void) const - { return ((hidden) ? frame.y_hidden : frame.y); } + inline const Window &getWindowID() const { return frame.window; } + inline unsigned int getWidth() const { return frame.width; } + inline unsigned int getHeight() const { return frame.height; } + unsigned int getExposedHeight() const; + + int getX() const; + int getY() const; + void buttonPressEvent(XButtonEvent *); void buttonReleaseEvent(XButtonEvent *); void enterNotifyEvent(XCrossingEvent *); @@ -137,17 +134,35 @@ public: 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 edit(); + void reconfigure(); + void load(); + void save(); + 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 }; };