From 56a41b23f9b5ecdef5e9536c2e6eeed0db32e623 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sun, 4 Aug 2002 15:55:13 +0000 Subject: doxygen comments --- src/Basemenu.hh | 115 ++++++++++++++++++++++------------- src/FbAtoms.hh | 99 +++++++++++++++--------------- src/Font.hh | 41 ++++++++++--- src/IconBar.hh | 21 ++++--- src/Image.hh | 43 ++++++++----- src/Keys.hh | 34 ++++++++--- src/Resource.hh | 33 ++++++---- src/Screen.hh | 148 ++++++++++++++++++++++----------------------- src/Slit.hh | 90 ++++++++++++++++------------ src/Theme.hh | 9 +-- src/Timer.hh | 72 +++++++++++++--------- src/Toolbar.hh | 180 +++++++++++++++++++++++++++++++------------------------ src/Window.hh | 54 +++++++++++------ src/Workspace.hh | 48 ++++++++++----- src/fluxbox.hh | 64 ++++++++++---------- 15 files changed, 628 insertions(+), 423 deletions(-) diff --git a/src/Basemenu.hh b/src/Basemenu.hh index 4e48f4c..29bb3ac 100644 --- a/src/Basemenu.hh +++ b/src/Basemenu.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Basemenu.hh,v 1.15 2002/08/02 12:52:44 fluxgen Exp $ +// $Id: Basemenu.hh,v 1.16 2002/08/04 15:55:13 fluxgen Exp $ #ifndef BASEMENU_HH #define BASEMENU_HH @@ -36,17 +36,26 @@ class BasemenuItem; class Fluxbox; class BImageControl; class BScreen; - +/** + Base class for menus +*/ class Basemenu { public: enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM }; enum { RIGHT = 1, LEFT }; + + /** + Bullet type + */ enum { EMPTY = 0, SQUARE, TRIANGLE, DIAMOND }; explicit Basemenu(BScreen *screen); virtual ~Basemenu(); - //manipulators + /** + @name manipulators + */ + //@{ int insert(const char *label, int function= 0, const char *exec = 0, int pos = -1); int insert(const char *label, Basemenu *submenu, int pos= -1); int remove(unsigned int item); @@ -54,14 +63,22 @@ public: inline void setAlignment(Alignment a) { m_alignment = a; } inline void setTorn() { torn = true; } inline void removeParent() { if (internal_menu) m_parent = 0; } - void buttonPressEvent(XButtonEvent *); - void buttonReleaseEvent(XButtonEvent *); - void motionNotifyEvent(XMotionEvent *); - void enterNotifyEvent(XCrossingEvent *); - void leaveNotifyEvent(XCrossingEvent *); - void exposeEvent(XExposeEvent *); + /** + @name event handlers + */ + //@{ + void buttonPressEvent(XButtonEvent *bp); + void buttonReleaseEvent(XButtonEvent *br); + void motionNotifyEvent(XMotionEvent *mn); + void enterNotifyEvent(XCrossingEvent *en); + void leaveNotifyEvent(XCrossingEvent *ce); + void exposeEvent(XExposeEvent *ee); + //@} + void reconfigure(); + /// set label string void setLabel(const char *labelstr); + /// move menu to x,y void move(int x, int y); void update(); void setItemSelected(unsigned int index, bool val); @@ -69,10 +86,14 @@ public: virtual void drawSubmenu(unsigned int index); virtual void show(); virtual void hide(); + /*@}*/ - //accessors - inline bool isTorn() const { return torn; } - inline bool isVisible() const { return visible; } + /** + @name accessors + */ + //@{ + inline bool isTorn() const { return torn; } + inline bool isVisible() const { return visible; } inline BScreen *screen() const { return m_screen; } inline Window windowID() const { return menu.window; } inline const std::string &label() const { return menu.label; } @@ -86,10 +107,28 @@ public: bool hasSubmenu(unsigned int index) const; bool isItemSelected(unsigned int index) const; bool isItemEnabled(unsigned int index) const; + //@} + +protected: + + inline BasemenuItem *find(unsigned int index) const { return menuitems[index]; } + inline void setTitleVisibility(bool b) { title_vis = b; } + inline void setMovable(bool b) { movable = b; } + inline void setHideTree(bool h) { hide_tree = h; } + inline void setMinimumSublevels(int m) { menu.minsub = m; } + + virtual void itemSelected(int button, unsigned int index) = 0; + virtual void drawItem(unsigned int index, bool highlight= false, bool clear= false, + int x= -1, int y= -1, unsigned int width= 0, unsigned int height= 0); + virtual void redrawTitle(); + virtual void internal_hide(); + inline Basemenu *parent() { return m_parent; } + inline const Basemenu *GetParent() const { return m_parent; } private: + typedef std::vector Menuitems; - Fluxbox *m_fluxbox; + Fluxbox *m_fluxbox; //< fluxbox object, obsolete BScreen *m_screen; Display *m_display; Basemenu *m_parent; @@ -113,23 +152,11 @@ private: bevel_h; } menu; - -protected: - inline BasemenuItem *find(unsigned int index) const { return menuitems[index]; } - inline void setTitleVisibility(bool b) { title_vis = b; } - inline void setMovable(bool b) { movable = b; } - inline void setHideTree(bool h) { hide_tree = h; } - inline void setMinimumSublevels(int m) { menu.minsub = m; } - - virtual void itemSelected(int button, unsigned int index) = 0; - virtual void drawItem(unsigned int index, bool highlight= false, bool clear= false, - int x= -1, int y= -1, unsigned int width= 0, unsigned int height= 0); - virtual void redrawTitle(); - virtual void internal_hide(); - inline Basemenu *GetParent() { return m_parent; } - inline const Basemenu *GetParent() const { return m_parent; } }; +/** + A menu item +*/ class BasemenuItem { public: BasemenuItem( @@ -153,19 +180,25 @@ public: , m_selected(false) { } - inline const std::string &exec() const { return m_exec; } - inline const std::string &label() const { return m_label; } - inline int function() const { return m_function; } - inline Basemenu *submenu() const { return m_submenu; } - - inline bool isEnabled() const { return m_enabled; } - inline void setEnabled(bool enabled) { m_enabled = enabled; } - inline bool isSelected() const { return m_selected; } - inline void setSelected(bool selected) { m_selected = selected; } - + void setSelected(bool selected) { m_selected = selected; } + void setEnabled(bool enabled) { m_enabled = enabled; } + Basemenu *submenu() { return m_submenu; } + /** + @name accessors + */ + //@{ + const std::string &exec() const { return m_exec; } + const std::string &label() const { return m_label; } + int function() const { return m_function; } + const Basemenu *submenu() const { return m_submenu; } + bool isEnabled() const { return m_enabled; } + bool isSelected() const { return m_selected; } + //@} + private: - std::string m_label, m_exec; - Basemenu *m_submenu; + std::string m_label; ///< label of this item + std::string m_exec; ///< command string to execute + Basemenu *m_submenu; ///< a submenu, 0 if we don't have one int m_function; bool m_enabled, m_selected; @@ -173,4 +206,4 @@ private: }; -#endif // _BASEMENU_HH_ +#endif // BASEMENU_HH diff --git a/src/FbAtoms.hh b/src/FbAtoms.hh index cebb040..8fa6676 100644 --- a/src/FbAtoms.hh +++ b/src/FbAtoms.hh @@ -19,12 +19,15 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbAtoms.hh,v 1.3 2002/05/07 15:07:02 fluxgen Exp $ +// $Id: FbAtoms.hh,v 1.4 2002/08/04 15:55:13 fluxgen Exp $ #ifndef FBATOMS_HH #define FBATOMS_HH #include #include +/** + atom handler, should probably be a singleton +*/ class FbAtoms { public: @@ -43,80 +46,80 @@ public: inline const Atom &getGnomeLayerAtom() const { return gnome_wm_win_layer; } #endif //GNOME - inline const Atom &getWMChangeStateAtom(void) const { return xa_wm_change_state; } - inline const Atom &getWMStateAtom(void) const { return xa_wm_state; } - inline const Atom &getWMDeleteAtom(void) const { return xa_wm_delete_window; } - inline const Atom &getWMProtocolsAtom(void) const { return xa_wm_protocols; } - inline const Atom &getWMTakeFocusAtom(void) const { return xa_wm_take_focus; } - inline const Atom &getWMColormapAtom(void) const { return xa_wm_colormap_windows; } - inline const Atom &getMotifWMHintsAtom(void) const { return motif_wm_hints; } + inline const Atom &getWMChangeStateAtom() const { return xa_wm_change_state; } + inline const Atom &getWMStateAtom() const { return xa_wm_state; } + inline const Atom &getWMDeleteAtom() const { return xa_wm_delete_window; } + inline const Atom &getWMProtocolsAtom() const { return xa_wm_protocols; } + inline const Atom &getWMTakeFocusAtom() const { return xa_wm_take_focus; } + inline const Atom &getWMColormapAtom() const { return xa_wm_colormap_windows; } + inline const Atom &getMotifWMHintsAtom() const { return motif_wm_hints; } // this atom is for normal app->WM hints about decorations, stacking, // starting workspace etc... - inline const Atom &getFluxboxHintsAtom(void) const { return blackbox_hints;} + inline const Atom &getFluxboxHintsAtom() const { return blackbox_hints;} // these atoms are for normal app->WM interaction beyond the scope of the // ICCCM... - inline const Atom &getFluxboxAttributesAtom(void) const { return blackbox_attributes; } - inline const Atom &getFluxboxChangeAttributesAtom(void) const { return blackbox_change_attributes; } + inline const Atom &getFluxboxAttributesAtom() const { return blackbox_attributes; } + inline const Atom &getFluxboxChangeAttributesAtom() const { return blackbox_change_attributes; } // these atoms are for window->WM interaction, with more control and // information on window "structure"... common examples are // notifying apps when windows are raised/lowered... when the user changes // workspaces... i.e. "pager talk" - inline const Atom &getFluxboxStructureMessagesAtom(void) const{ return blackbox_structure_messages; } + inline const Atom &getFluxboxStructureMessagesAtom() const{ return blackbox_structure_messages; } // *Notify* portions of the NETStructureMessages protocol - inline const Atom &getFluxboxNotifyStartupAtom(void) const { return blackbox_notify_startup; } - inline const Atom &getFluxboxNotifyWindowAddAtom(void) const { return blackbox_notify_window_add; } - inline const Atom &getFluxboxNotifyWindowDelAtom(void) const { return blackbox_notify_window_del; } - inline const Atom &getFluxboxNotifyWindowFocusAtom(void) const { return blackbox_notify_window_focus; } - inline const Atom &getFluxboxNotifyCurrentWorkspaceAtom(void) const { return blackbox_notify_current_workspace; } - inline const Atom &getFluxboxNotifyWorkspaceCountAtom(void) const { return blackbox_notify_workspace_count; } - inline const Atom &getFluxboxNotifyWindowRaiseAtom(void) const { return blackbox_notify_window_raise; } - inline const Atom &getFluxboxNotifyWindowLowerAtom(void) const { return blackbox_notify_window_lower; } + inline const Atom &getFluxboxNotifyStartupAtom() const { return blackbox_notify_startup; } + inline const Atom &getFluxboxNotifyWindowAddAtom() const { return blackbox_notify_window_add; } + inline const Atom &getFluxboxNotifyWindowDelAtom() const { return blackbox_notify_window_del; } + inline const Atom &getFluxboxNotifyWindowFocusAtom() const { return blackbox_notify_window_focus; } + inline const Atom &getFluxboxNotifyCurrentWorkspaceAtom() const { return blackbox_notify_current_workspace; } + inline const Atom &getFluxboxNotifyWorkspaceCountAtom() const { return blackbox_notify_workspace_count; } + inline const Atom &getFluxboxNotifyWindowRaiseAtom() const { return blackbox_notify_window_raise; } + inline const Atom &getFluxboxNotifyWindowLowerAtom() const { return blackbox_notify_window_lower; } // atoms to change that request changes to the desktop environment during // runtime... these messages can be sent by any client... as the sending // client window id is not included in the ClientMessage event... - inline const Atom &getFluxboxChangeWorkspaceAtom(void) const { return blackbox_change_workspace; } - inline const Atom &getFluxboxChangeWindowFocusAtom(void) const { return blackbox_change_window_focus; } - inline const Atom &getFluxboxCycleWindowFocusAtom(void) const { return blackbox_cycle_window_focus; } + inline const Atom &getFluxboxChangeWorkspaceAtom() const { return blackbox_change_workspace; } + inline const Atom &getFluxboxChangeWindowFocusAtom() const { return blackbox_change_window_focus; } + inline const Atom &getFluxboxCycleWindowFocusAtom() const { return blackbox_cycle_window_focus; } #ifdef NEWWMSPEC // root window properties - inline const Atom &getNETSupportedAtom(void) const { return net_supported; } - inline const Atom &getNETClientListAtom(void) const { return net_client_list; } - inline const Atom &getNETClientListStackingAtom(void) const { return net_client_list_stacking; } - inline const Atom &getNETNumberOfDesktopsAtom(void) const { return net_number_of_desktops; } - inline const Atom &getNETDesktopGeometryAtom(void) const { return net_desktop_geometry; } - inline const Atom &getNETDesktopViewportAtom(void) const { return net_desktop_viewport; } - inline const Atom &getNETCurrentDesktopAtom(void) const { return net_current_desktop; } - inline const Atom &getNETDesktopNamesAtom(void) const { return net_desktop_names; } - inline const Atom &getNETActiveWindowAtom(void) const { return net_active_window; } - inline const Atom &getNETWorkareaAtom(void) const { return net_workarea; } - inline const Atom &getNETSupportingWMCheckAtom(void) const { return net_supporting_wm_check; } - inline const Atom &getNETVirtualRootsAtom(void) const { return net_virtual_roots; } + inline const Atom &getNETSupportedAtom() const { return net_supported; } + inline const Atom &getNETClientListAtom() const { return net_client_list; } + inline const Atom &getNETClientListStackingAtom() const { return net_client_list_stacking; } + inline const Atom &getNETNumberOfDesktopsAtom() const { return net_number_of_desktops; } + inline const Atom &getNETDesktopGeometryAtom() const { return net_desktop_geometry; } + inline const Atom &getNETDesktopViewportAtom() const { return net_desktop_viewport; } + inline const Atom &getNETCurrentDesktopAtom() const { return net_current_desktop; } + inline const Atom &getNETDesktopNamesAtom() const { return net_desktop_names; } + inline const Atom &getNETActiveWindowAtom() const { return net_active_window; } + inline const Atom &getNETWorkareaAtom() const { return net_workarea; } + inline const Atom &getNETSupportingWMCheckAtom() const { return net_supporting_wm_check; } + inline const Atom &getNETVirtualRootsAtom() const { return net_virtual_roots; } // root window messages - inline const Atom &getNETCloseWindowAtom(void) const { return net_close_window; } - inline const Atom &getNETWMMoveResizeAtom(void) const { return net_wm_moveresize; } + inline const Atom &getNETCloseWindowAtom() const { return net_close_window; } + inline const Atom &getNETWMMoveResizeAtom() const { return net_wm_moveresize; } // application window properties - inline const Atom &getNETPropertiesAtom(void) const { return net_properties; } - inline const Atom &getNETWMNameAtom(void) const { return net_wm_name; } - inline const Atom &getNETWMDesktopAtom(void) const { return net_wm_desktop; } - inline const Atom &getNETWMWindowTypeAtom(void) const { return net_wm_window_type; } - inline const Atom &getNETWMStateAtom(void) const { return net_wm_state; } - inline const Atom &getNETWMStrutAtom(void) const { return net_wm_strut; } - inline const Atom &getNETWMIconGeometryAtom(void) const { return net_wm_icon_geometry; } - inline const Atom &getNETWMIconAtom(void) const { return net_wm_icon; } - inline const Atom &getNETWMPidAtom(void) const { return net_wm_pid; } - inline const Atom &getNETWMHandledIconsAtom(void) const { return net_wm_handled_icons; } + inline const Atom &getNETPropertiesAtom() const { return net_properties; } + inline const Atom &getNETWMNameAtom() const { return net_wm_name; } + inline const Atom &getNETWMDesktopAtom() const { return net_wm_desktop; } + inline const Atom &getNETWMWindowTypeAtom() const { return net_wm_window_type; } + inline const Atom &getNETWMStateAtom() const { return net_wm_state; } + inline const Atom &getNETWMStrutAtom() const { return net_wm_strut; } + inline const Atom &getNETWMIconGeometryAtom() const { return net_wm_icon_geometry; } + inline const Atom &getNETWMIconAtom() const { return net_wm_icon; } + inline const Atom &getNETWMPidAtom() const { return net_wm_pid; } + inline const Atom &getNETWMHandledIconsAtom() const { return net_wm_handled_icons; } // application protocols - inline const Atom &getNETWMPingAtom(void) const { return net_wm_ping; } + inline const Atom &getNETWMPingAtom() const { return net_wm_ping; } #endif // NEWWMSPEC diff --git a/src/Font.hh b/src/Font.hh index 6c1d95e..66cd6cf 100644 --- a/src/Font.hh +++ b/src/Font.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Font.hh,v 1.3 2002/05/15 09:36:57 fluxgen Exp $ +//$Id: Font.hh,v 1.4 2002/08/04 15:55:13 fluxgen Exp $ #ifndef FBTK_FONT_HH #define FBTK_FONT_HH @@ -30,23 +30,46 @@ namespace FbTk { +/** + Handles loading of font. +*/ class Font { public: Font(Display *display, const char *name=0); virtual ~Font(); - //manipulators + /** + Load a font + @return true on success, else false and it'll fall back on the last + loaded font + */ bool load(const char *name); + /** + Loads a font from database + @return true on success, else false and it'll fall back on the last + loaded font + @see load(const char *name) + */ bool loadFromDatabase(XrmDatabase &database, const char *rname, const char *rclass); - //accessors + /// @return true if a font is loaded, else false inline bool isLoaded() const { return m_loaded; } - inline const XFontStruct *getFontStruct() const { return m_font.fontstruct; } - inline const XFontSet &getFontSet() const { return m_font.set; } - inline const XFontSetExtents *getFontSetExtents() const { return m_font.set_extents; } + /// @return XFontStruct of font, note: can be 0 + inline const XFontStruct *fontStruct() const { return m_font.fontstruct; } + /// @return XFontSet of font, note: check isLoaded + inline const XFontSet &fontSet() const { return m_font.set; } + /// @return XFontSetExtents of font, note: can be 0 + inline const XFontSetExtents *fontSetExtents() const { return m_font.set_extents; } + /// @return true if multibyte is enabled, else false static inline bool multibyte() { return m_multibyte; } - unsigned int getTextWidth(const char *text, unsigned int size) const; - unsigned int getHeight() const; - Display *getDisplay() const { return m_display; } + /** + @param text text to check size + @param size length of text in bytes + @return size of text in pixels + */ + unsigned int textWidth(const char *text, unsigned int size) const; + unsigned int height() const; + /// @return display connection + Display *display() const { return m_display; } private: void freeFont(); static XFontSet createFontSet(Display *display, const char *fontname); diff --git a/src/IconBar.hh b/src/IconBar.hh index d0202a3..428fbf0 100644 --- a/src/IconBar.hh +++ b/src/IconBar.hh @@ -19,29 +19,36 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconBar.hh,v 1.6 2002/02/17 18:57:47 fluxgen Exp $ +// $Id: IconBar.hh,v 1.7 2002/08/04 15:55:13 fluxgen Exp $ #ifndef ICONBAR_HH #define ICONBAR_HH -#include #include "Window.hh" #include +/** + Icon object in IconBar +*/ class IconBarObj { public: IconBarObj(FluxboxWindow *fluxboxwin, Window iconwin); ~IconBarObj(); - inline Window getIconWin(void) { return m_iconwin; } - inline FluxboxWindow *getFluxboxWin(void) { return m_fluxboxwin; } - unsigned int getWidth(void); + Window getIconWin() const { return m_iconwin; } + FluxboxWindow *getFluxboxWin() { return m_fluxboxwin; } + const FluxboxWindow *getFluxboxWin() const { return m_fluxboxwin; } + unsigned int width() const; + private: FluxboxWindow *m_fluxboxwin; Window m_iconwin; }; +/** + Icon container +*/ class IconBar { public: @@ -64,7 +71,7 @@ private: void loadTheme(unsigned int width, unsigned int height); void decorate(Window win); // IconBarObj *findIcon(FluxboxWindow *fluxboxwin); - void repositionIcons(void); + void repositionIcons(); Window createIconWindow(FluxboxWindow *fluxboxwin, Window parent); BScreen *m_screen; Display *m_display; @@ -74,4 +81,4 @@ private: unsigned long m_focus_pixel; }; -#endif // _ICONBAR_HH_ +#endif // ICONBAR_HH diff --git a/src/Image.hh b/src/Image.hh index c43e50b..7ae8b36 100644 --- a/src/Image.hh +++ b/src/Image.hh @@ -22,24 +22,25 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Image.hh,v 1.10 2002/07/23 17:11:59 fluxgen Exp $ +// $Id: Image.hh,v 1.11 2002/08/04 15:55:13 fluxgen Exp $ #ifndef IMAGE_HH #define IMAGE_HH -#include -#include - #include "Timer.hh" #include "BaseDisplay.hh" - #include "Color.hh" #include "Texture.hh" +#include +#include #include class BImageControl; +/** + Renders to pixmap +*/ class BImage { public: BImage(BImageControl *ic, unsigned int, unsigned int); @@ -62,7 +63,10 @@ protected: @returns allocated and rendered XImage, user is responsible to deallocate */ XImage *renderXImage(); - + /** + @name render functions + */ + //@{ void invert(); void bevel1(); void bevel2(); @@ -74,6 +78,7 @@ protected: void vgradient(); void cdgradient(); void pcgradient(); + //@} private: BImageControl *control; @@ -91,7 +96,9 @@ private: unsigned int width, height, *xtable, *ytable; }; - +/** + Holds screen info and color tables +*/ class BImageControl : public TimeoutHandler { public: BImageControl(BaseDisplay *disp, ScreenInfo *screen, bool = False, int = 4, @@ -102,13 +109,14 @@ public: inline bool doDither() { return dither; } inline const Colormap &colormap() const { return m_colormap; } - inline ScreenInfo *getScreenInfo() { return screeninfo; } - + inline const ScreenInfo *getScreenInfo() const { return screeninfo; } inline Window drawable() const { return window; } - + + /// @return visual of screen inline Visual *visual() { return screeninfo->getVisual(); } - + /// @return Bits per pixel of screen inline int bitsPerPixel() const { return bits_per_pixel; } + /// @return depth of screen inline int depth() const { return screen_depth; } inline int colorsPerChannel() const { return colors_per_channel; } @@ -116,7 +124,13 @@ public: unsigned long color(const char *, unsigned char *, unsigned char *, unsigned char *); unsigned long getSqrt(unsigned int val); - + /** + Render to pixmap + @param width width of pixmap + @param height height of pixmap + @param src_texture texture type to render + @return pixmap of the rendered image, on failure None + */ Pixmap renderImage(unsigned int width, unsigned int height, const FbTk::Texture *src_texture); @@ -153,7 +167,8 @@ private: Colormap m_colormap; Window window; - XColor *colors; // color table + XColor *colors; ///< color table + int colors_per_channel, ncolors, screen_number, screen_depth, bits_per_pixel, red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits; @@ -179,5 +194,5 @@ private: }; -#endif // __Image_hh +#endif // IMAGE_HH diff --git a/src/Keys.hh b/src/Keys.hh index 843f3a9..3351668 100644 --- a/src/Keys.hh +++ b/src/Keys.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Keys.hh,v 1.14 2002/07/27 18:03:39 fluxgen Exp $ +// $Id: Keys.hh,v 1.15 2002/08/04 15:55:13 fluxgen Exp $ #ifndef KEYS_HH #define KEYS_HH @@ -31,7 +31,9 @@ class Keys { public: - + /** + Key actions + */ enum KeyAction{ ICONIFY=0, RAISE, LOWER, @@ -59,7 +61,11 @@ public: ROOTMENU, // pop up rootmenu LASTKEYGRAB //mark end of keygrabbs }; - + /** + Constructor + @param display display connection + @param filename file to load, default none + */ Keys(Display *display, const char *filename=0); /// destructor ~Keys(); @@ -97,8 +103,21 @@ private: void deleteTree(); void ungrabKeys(); void bindKey(unsigned int key, unsigned int mod); + /** + @param modstr modifier string (i.e Mod4, Mod5) + @return modifier number that match modstr + */ unsigned int getModifier(const char *modstr); + /** + @param keystr a key string (i.e F1, Enter) + @return key number that match keystr + */ unsigned int getKey(const char *keystr); + /** + grab a key + @param key the key + @param mod the modifier + */ void grabKey(unsigned int key, unsigned int mod); std::string filename; @@ -139,6 +158,7 @@ private: @return true on success, else false */ bool mergeTree(t_key *newtree, t_key *basetree=0); + #ifdef DEBUG /// debug function void showTree(); @@ -154,10 +174,10 @@ private: static t_actionstr m_actionlist[]; std::vector m_keylist; - t_key *m_abortkey; //abortkey for keygrabbing chain - std::string m_execcmdstring; //copy of the execcommandstring - int m_param; // copy of the param argument - Display *m_display; + t_key *m_abortkey; ///< abortkey for keygrabbing chain + std::string m_execcmdstring; ///< copy of the execcommandstring + int m_param; ///< copy of the param argument + Display *m_display; ///< display connection }; #endif // _KEYS_HH_ diff --git a/src/Resource.hh b/src/Resource.hh index 8055701..0e4e939 100644 --- a/src/Resource.hh +++ b/src/Resource.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Resource.hh,v 1.6 2002/07/20 09:51:03 fluxgen Exp $ +// $Id: Resource.hh,v 1.7 2002/08/04 15:55:13 fluxgen Exp $ #ifndef RESOURCE_HH #define RESOURCE_HH @@ -27,7 +27,9 @@ #include "NotCopyable.hh" #include #include - +/** + Base class for resources +*/ class Resource_base:private NotCopyable { public: @@ -47,17 +49,18 @@ public: protected: Resource_base(const std::string &name, const std::string &altname): m_name(name), m_altname(altname) - { - - } + { } private: - std::string m_name; // name of this resource - std::string m_altname; // alternative name + std::string m_name; ///< name of this resource + std::string m_altname; ///< alternative name }; class ResourceManager; +/** + Real resource class +*/ template class Resource:public Resource_base { @@ -79,10 +82,10 @@ public: inline Resource& operator = (const T& newvalue) { m_value = newvalue; return *this;} std::string getString(); - inline T& operator*(void) { return m_value; } - inline const T& operator*(void) const { return m_value; } - inline T *operator->(void) { return &m_value; } - inline const T *operator->(void) const { return &m_value; } + inline T& operator*() { return m_value; } + inline const T& operator*() const { return m_value; } + inline T *operator->() { return &m_value; } + inline const T *operator->() const { return &m_value; } private: T m_value, m_defaultval; ResourceManager &m_rm; @@ -103,11 +106,17 @@ public: save all resouces registered to this class */ virtual bool save(const char *filename, const char *mergefilename=0); + /** + add resource to list + */ template void addResource(Resource &r) { m_resourcelist.push_back(&r); m_resourcelist.unique(); } + /** + Remove a specific resource + */ template void removeResource(Resource &r) { m_resourcelist.remove(&r); @@ -115,9 +124,9 @@ public: protected: static inline void ensureXrmIsInitialize(); private: + static bool m_init; ResourceList m_resourcelist; - }; #endif //_RESOURCE_HH_ diff --git a/src/Screen.hh b/src/Screen.hh index 1f4cf89..051a002 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.hh,v 1.40 2002/08/02 12:52:44 fluxgen Exp $ +// $Id: Screen.hh,v 1.41 2002/08/04 15:55:13 fluxgen Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -70,82 +70,82 @@ public: int scrn); ~BScreen(); - inline bool isToolbarOnTop(void) const { return *resource.toolbar_on_top; } - inline bool doToolbarAutoHide(void) const { return *resource.toolbar_auto_hide; } - inline bool isSloppyFocus(void) const { return resource.sloppy_focus; } - inline bool isSemiSloppyFocus(void) const { return resource.semi_sloppy_focus; } - inline bool isRootColormapInstalled(void) const { return root_colormap_installed; } - inline bool isScreenManaged(void) const { return managed; } - inline bool isTabRotateVertical(void) const { return *resource.tab_rotate_vertical; } - inline bool isSloppyWindowGrouping(void) const { return *resource.sloppy_window_grouping; } - inline bool isWorkspaceWarping(void) const { return *resource.workspace_warping; } - inline bool isDesktopWheeling(void) const { return *resource.desktop_wheeling; } - inline bool doAutoRaise(void) const { return resource.auto_raise; } - inline bool doImageDither(void) const { return *resource.image_dither; } - inline bool doMaxOverSlit(void) const { return *resource.max_over_slit; } - inline bool doOpaqueMove(void) const { return *resource.opaque_move; } - inline bool doFullMax(void) const { return *resource.full_max; } - inline bool doFocusNew(void) const { return *resource.focus_new; } - inline bool doFocusLast(void) const { return *resource.focus_last; } - inline bool doShowWindowPos(void) const { return *resource.show_window_pos; } + inline bool isToolbarOnTop() const { return *resource.toolbar_on_top; } + inline bool doToolbarAutoHide() const { return *resource.toolbar_auto_hide; } + inline bool isSloppyFocus() const { return resource.sloppy_focus; } + inline bool isSemiSloppyFocus() const { return resource.semi_sloppy_focus; } + inline bool isRootColormapInstalled() const { return root_colormap_installed; } + inline bool isScreenManaged() const { return managed; } + inline bool isTabRotateVertical() const { return *resource.tab_rotate_vertical; } + inline bool isSloppyWindowGrouping() const { return *resource.sloppy_window_grouping; } + inline bool isWorkspaceWarping() const { return *resource.workspace_warping; } + inline bool isDesktopWheeling() const { return *resource.desktop_wheeling; } + inline bool doAutoRaise() const { return resource.auto_raise; } + inline bool doImageDither() const { return *resource.image_dither; } + inline bool doMaxOverSlit() const { return *resource.max_over_slit; } + inline bool doOpaqueMove() const { return *resource.opaque_move; } + inline bool doFullMax() const { return *resource.full_max; } + inline bool doFocusNew() const { return *resource.focus_new; } + inline bool doFocusLast() const { return *resource.focus_last; } + inline bool doShowWindowPos() const { return *resource.show_window_pos; } inline GC getOpGC() const { return theme->getOpGC(); } - inline const FbTk::Color *getBorderColor(void) const { return &theme->getBorderColor(); } - inline BImageControl *getImageControl(void) { return image_control; } - inline Rootmenu *getRootmenu(void) { return rootmenu; } + inline const FbTk::Color *getBorderColor() const { return &theme->getBorderColor(); } + inline BImageControl *getImageControl() { return image_control; } + inline Rootmenu *getRootmenu() { return rootmenu; } inline const std::string &getRootCommand(void ) const { return *resource.rootcommand; } #ifdef SLIT - inline bool isSlitOnTop(void) const { return resource.slit_on_top; } - inline bool doSlitAutoHide(void) const { return resource.slit_auto_hide; } - inline Slit *getSlit(void) { return slit; } - inline int getSlitPlacement(void) const { return resource.slit_placement; } - inline int getSlitDirection(void) const { return resource.slit_direction; } + inline bool isSlitOnTop() const { return resource.slit_on_top; } + inline bool doSlitAutoHide() const { return resource.slit_auto_hide; } + inline Slit *getSlit() { return slit; } + inline int getSlitPlacement() const { return resource.slit_placement; } + inline int getSlitDirection() const { return resource.slit_direction; } inline void saveSlitPlacement(int p) { resource.slit_placement = p; } inline void saveSlitDirection(int d) { resource.slit_direction = d; } inline void saveSlitOnTop(bool t) { resource.slit_on_top = t; } inline void saveSlitAutoHide(bool t) { resource.slit_auto_hide = t; } #ifdef XINERAMA - inline unsigned int getSlitOnHead(void) const { return resource.slit_on_head; } + inline unsigned int getSlitOnHead() const { return resource.slit_on_head; } inline void saveSlitOnHead(unsigned int h) { resource.slit_on_head = h; } #endif // XINERAMA #endif // SLIT - inline Toolbar *getToolbar(void) { return toolbar; } + inline Toolbar *getToolbar() { return toolbar; } inline Workspace *getWorkspace(unsigned int w) { return ( w < workspacesList.size() ? workspacesList[w] : 0); } - 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 unsigned int getHandleWidth(void) const { return theme->getHandleWidth(); } - inline unsigned int getBevelWidth(void) const { return theme->getBevelWidth(); } - inline unsigned int getFrameWidth(void) const { return theme->getFrameWidth(); } - inline unsigned int getBorderWidth(void) const { return theme->getBorderWidth(); } - inline unsigned int getBorderWidth2x(void) const { return theme->getBorderWidth()*2; } + inline unsigned int getHandleWidth() const { return theme->getHandleWidth(); } + inline unsigned int getBevelWidth() const { return theme->getBevelWidth(); } + inline unsigned int getFrameWidth() const { return theme->getFrameWidth(); } + inline unsigned int getBorderWidth() const { return theme->getBorderWidth(); } + inline unsigned int getBorderWidth2x() const { return theme->getBorderWidth()*2; } inline unsigned int getCurrentWorkspaceID() const { return current_workspace->workspaceID(); } typedef std::vector Icons; - inline unsigned int getCount(void) const { return workspacesList.size(); } - inline unsigned int getIconCount(void) const { return iconList.size(); } - inline const Icons &getIconList(void) const { return iconList; } - inline Icons &getIconList(void) { return iconList; } + inline unsigned int getCount() const { return workspacesList.size(); } + inline unsigned int getIconCount() const { return iconList.size(); } + inline const Icons &getIconList() const { return iconList; } + inline Icons &getIconList() { return iconList; } - inline int getNumberOfWorkspaces(void) const { return *resource.workspaces; } - inline Toolbar::Placement getToolbarPlacement(void) const { return *resource.toolbar_placement; } + inline int getNumberOfWorkspaces() const { return *resource.workspaces; } + inline Toolbar::Placement getToolbarPlacement() const { return *resource.toolbar_placement; } #ifdef XINERAMA - inline int getToolbarOnHead(void) { return *resource.toolbar_on_head; } + inline int getToolbarOnHead() { return *resource.toolbar_on_head; } #endif // XINERAMA - inline int getToolbarWidthPercent(void) const { return *resource.toolbar_width_percent; } - inline int getPlacementPolicy(void) const { return resource.placement_policy; } - inline int getEdgeSnapThreshold(void) const { return *resource.edge_snap_threshold; } - inline int getRowPlacementDirection(void) const { return resource.row_direction; } - inline int getColPlacementDirection(void) const { return resource.col_direction; } - inline unsigned int getTabWidth(void) const { return *resource.tab_width; } - inline unsigned int getTabHeight(void) const { return *resource.tab_height; } - inline Tab::Placement getTabPlacement(void) const { return *resource.tab_placement; } - inline Tab::Alignment getTabAlignment(void) const { return *resource.tab_alignment; } + inline int getToolbarWidthPercent() const { return *resource.toolbar_width_percent; } + inline int getPlacementPolicy() const { return resource.placement_policy; } + inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; } + inline int getRowPlacementDirection() const { return resource.row_direction; } + inline int getColPlacementDirection() const { return resource.col_direction; } + inline unsigned int getTabWidth() const { return *resource.tab_width; } + inline unsigned int getTabHeight() const { return *resource.tab_height; } + inline Tab::Placement getTabPlacement() const { return *resource.tab_placement; } + inline Tab::Alignment getTabAlignment() const { return *resource.tab_alignment; } inline void setRootColormapInstalled(Bool r) { root_colormap_installed = r; } inline void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; } @@ -179,37 +179,37 @@ public: inline void saveSloppyWindowGrouping(bool s) { resource.sloppy_window_grouping = s; } inline void saveWorkspaceWarping(bool s) { resource.workspace_warping = s; } inline void saveDesktopWheeling(bool s) { resource.desktop_wheeling = s; } - inline void iconUpdate(void) { iconmenu->update(); } - inline Iconmenu *getIconmenu(void) { return iconmenu; } + inline void iconUpdate() { iconmenu->update(); } + inline Iconmenu *getIconmenu() { return iconmenu; } inline void setAutoGroupWindow(Window w = 0) { auto_group_window = w; } #ifdef HAVE_STRFTIME - inline const char *getStrftimeFormat(void) { return resource.strftime_format.c_str(); } + inline const char *getStrftimeFormat() { return resource.strftime_format.c_str(); } void saveStrftimeFormat(const char *format); #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 Theme::WindowStyle *getWindowStyle(void) { return &theme->getWindowStyle(); } - inline Theme::MenuStyle *getMenuStyle(void) { return &theme->getMenuStyle(); } - inline Theme::ToolbarStyle *getToolbarStyle(void) { return &theme->getToolbarStyle(); } + inline Theme::WindowStyle *getWindowStyle() { return &theme->getWindowStyle(); } + inline Theme::MenuStyle *getMenuStyle() { return &theme->getMenuStyle(); } + inline Theme::ToolbarStyle *getToolbarStyle() { return &theme->getToolbarStyle(); } const Theme *getTheme() const { return theme; } FluxboxWindow *getIcon(unsigned int index); - int addWorkspace(void); - int removeLastWorkspace(void); + int addWorkspace(); + int removeLastWorkspace(); //scroll workspaces void nextWorkspace(const int delta); void prevWorkspace(const int delta); void rightWorkspace(const int delta); void leftWorkspace(const int delta); - void removeWorkspaceNames(void); - void updateWorkspaceNamesAtom(void); + void removeWorkspaceNames(); + void updateWorkspaceNamesAtom(); void addWorkspaceName(const char *name); void addNetizen(Netizen *net); @@ -223,19 +223,19 @@ public: void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky); void prevFocus(int = 0); void nextFocus(int = 0); - void raiseFocus(void); - void reconfigure(void); - void rereadMenu(void); - void shutdown(void); + void raiseFocus(); + void reconfigure(); + void rereadMenu(); + void shutdown(); void showPosition(int, int); void showGeometry(unsigned int, unsigned int); - void hideGeometry(void); + void hideGeometry(); - FluxboxWindow* useAutoGroupWindow(void); + FluxboxWindow* useAutoGroupWindow(); - void updateNetizenCurrentWorkspace(void); - void updateNetizenWorkspaceCount(void); - void updateNetizenWindowFocus(void); + void updateNetizenCurrentWorkspace(); + void updateNetizenWorkspaceCount(); + void updateNetizenWindowFocus(); void updateNetizenWindowAdd(Window, unsigned long); void updateNetizenWindowDel(Window); void updateNetizenConfigNotify(XEvent *); @@ -356,7 +356,7 @@ protected: XFontSet createFontSet(char *); void readDatabaseFont(char *, char *, XFontStruct **); - void initMenu(void); + void initMenu(); }; diff --git a/src/Slit.hh b/src/Slit.hh index 61a7d33..b5135d8 100644 --- a/src/Slit.hh +++ b/src/Slit.hh @@ -40,15 +40,15 @@ class Slitmenu; class Slitmenu : public Basemenu { public: explicit Slitmenu(Slit &theslist); - virtual ~Slitmenu(void); + virtual ~Slitmenu(); - inline Basemenu *getDirectionmenu(void) { return directionmenu; } - inline Basemenu *getPlacementmenu(void) { return placementmenu; } + inline Basemenu *getDirectionmenu() { return directionmenu; } + inline Basemenu *getPlacementmenu() { return placementmenu; } #ifdef XINERAMA - inline Basemenu *getHeadmenu(void) { return headmenu; } + inline Basemenu *getHeadmenu() { return headmenu; } #endif // XINERAMA - void reconfigure(void); + void reconfigure(); private: class Directionmenu : public Basemenu { @@ -103,52 +103,63 @@ private: protected: virtual void itemSelected(int button, unsigned int index); - virtual void internal_hide(void); + virtual void internal_hide(); }; class Slit : public TimeoutHandler { public: - explicit Slit(BScreen *); + explicit Slit(BScreen *screen); virtual ~Slit(); - inline bool isOnTop(void) const { return on_top; } - inline bool isHidden(void) const { return hidden; } - inline bool doAutoHide(void) const { return do_auto_hide; } + inline bool isOnTop() const { return on_top; } + inline bool isHidden() const { return hidden; } + inline bool doAutoHide() const { return do_auto_hide; } - Slitmenu &getMenu() { return slitmenu; } + Slitmenu &menu() { return slitmenu; } inline const Window &getWindowID() const { return frame.window; } - inline int getX() const { return ((hidden) ? frame.x_hidden : frame.x); } - inline int getY() const { return ((hidden) ? frame.y_hidden : frame.y); } - - inline unsigned int getWidth(void) const { return frame.width; } - inline unsigned int getHeight(void) const { return frame.height; } - - void addClient(Window); - void removeClient(Window, bool = true); - void reconfigure(void); - void reposition(void); - void shutdown(void); - void saveClientList(void); - - void buttonPressEvent(XButtonEvent *); - void enterNotifyEvent(XCrossingEvent *); - void leaveNotifyEvent(XCrossingEvent *); - void configureRequestEvent(XConfigureRequestEvent *); - - virtual void timeout(void); + inline int x() const { return ((hidden) ? frame.x_hidden : frame.x); } + inline int y() const { return ((hidden) ? frame.y_hidden : frame.y); } + + inline unsigned int width() const { return frame.width; } + inline unsigned int height() const { return frame.height; } + + void addClient(Window clientwin); + void removeClient(Window clientwin, bool = true); + void reconfigure(); + void reposition(); + void shutdown(); + void saveClientList(); + + /** + @name eventhandlers + */ + //@{ + void buttonPressEvent(XButtonEvent *bp); + void enterNotifyEvent(XCrossingEvent *en); + void leaveNotifyEvent(XCrossingEvent *ln); + void configureRequestEvent(XConfigureRequestEvent *cr); + //@} + + virtual void timeout(); + /** + Client alignment + */ enum { VERTICAL = 1, HORIZONTAL }; + /** + Screen placement + */ enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT }; private: class SlitClient { public: - SlitClient(BScreen *, Window); // For adding an actual window - SlitClient(const char *); // For adding a placeholder + SlitClient(BScreen *screen, Window client_window); // For adding an actual window + SlitClient(const char *name); // For adding a placeholder // Now we pre-initialize a list of slit clients with names for // comparison with incoming client windows. This allows the slit @@ -163,16 +174,17 @@ private: int x, y; unsigned int width, height; - void initialize(BScreen * = NULL, Window = None); + void initialize(BScreen *screen = 0, Window client_window= None); }; - void removeClient(SlitClient *, bool, bool); - void loadClientList(void); + void removeClient(SlitClient *client, bool remap, bool destroy); + void loadClientList(); - Bool on_top, hidden, do_auto_hide; - Display *display; + bool on_top, hidden, do_auto_hide; + + Display *display; ///< display connection - Fluxbox *fluxbox; + Fluxbox *fluxbox; ///< obsolete BScreen *screen; BTimer timer; @@ -199,4 +211,4 @@ private: }; -#endif // __Slit_hh +#endif // SLIT_HH diff --git a/src/Theme.hh b/src/Theme.hh index 97fe9cd..bf3ccd4 100644 --- a/src/Theme.hh +++ b/src/Theme.hh @@ -20,8 +20,6 @@ // DEALINGS IN THE SOFTWARE. // // A lot of the base code is taken from Screen.hh in Blackbox 0.61.1 -// and Brad Hughes (bhuges@tcac.net) should get alot of credit for it -// And for license-hunters here's the license and copyright for Screen.cc // Screen.cc - Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) // // Permission is hereby granted, free of charge, to any person obtaining a @@ -42,7 +40,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Theme.hh,v 1.12 2002/07/23 18:38:31 fluxgen Exp $ +// $Id: Theme.hh,v 1.13 2002/08/04 15:55:13 fluxgen Exp $ #ifndef THEME_HH #define THEME_HH @@ -55,7 +53,10 @@ #include #include - +/** + Main theme class, holds themes for + Window, toolbar, slit, menu and the rootCommand, for a specific screen. +*/ class Theme { public: diff --git a/src/Timer.hh b/src/Timer.hh index 9b48754..2c7f2c8 100644 --- a/src/Timer.hh +++ b/src/Timer.hh @@ -29,61 +29,77 @@ #include "../config.h" #endif //HAVE_CONFIG_H -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else // !TIME_WITH_SYS_TIME -# ifdef HAVE_SYS_TIME_H +#ifdef TIME_WITH_SYS_TIME #include -# else // !HAVE_SYS_TIME_H -# include -# endif // HAVE_SYS_TIME_H +#include +#else //!TIME_WITH_SYS_TIME +#ifdef HAVE_SYS_TIME_H +#include +#else // !HAVE_SYS_TIME_H +#include +#endif // HAVE_SYS_TIME_H #endif // TIME_WITH_SYS_TIME #include +/** + Inherit this to have a timed object, that calls + timeout function when the time is out +*/ class TimeoutHandler { public: - virtual void timeout(void) = 0; + /// called when the time is out + virtual void timeout() = 0; }; - +/** + Handles TimeoutHandles +*/ class BTimer { public: - explicit BTimer(TimeoutHandler *); - virtual ~BTimer(void); + explicit BTimer(TimeoutHandler *handler); + virtual ~BTimer(); - inline int isTiming(void) const { return m_timing; } - inline int doOnce(void) const { return m_once; } + inline int isTiming() const { return m_timing; } + inline int doOnce() const { return m_once; } - inline const timeval &getTimeout(void) const { return m_timeout; } - inline const timeval &getStartTime(void) const { return m_start; } + inline const timeval &getTimeout() const { return m_timeout; } + inline const timeval &getStartTime() const { return m_start; } inline void fireOnce(bool once) { m_once = once; } + /// set timeout + void setTimeout(long val); + /// set timeout + void setTimeout(timeval val); + /// start timing + void start(); + /// stop timing + void stop(); + /// update all timers + static void updateTimers(int file_descriptor); - void setTimeout(long); - void setTimeout(timeval); - void start(void); - void stop(void); - static void updateTimers(int fd); protected: - void fireTimeout(void); + /// force a timeout + void fireTimeout(); private: + /// add a timer to the static list static void addTimer(BTimer *timer); + /// remove a timer from the static list static void removeTimer(BTimer *timer); typedef std::list TimerList; - static TimerList m_timerlist; + static TimerList m_timerlist; ///< list of all timers - TimeoutHandler *m_handler; + TimeoutHandler *m_handler; ///< handler - bool m_timing, m_once; + bool m_timing; ///< clock running? + bool m_once; ///< do timeout only once? - timeval m_start, m_timeout; + timeval m_start; ///< start time + timeval m_timeout; ///< time length }; - -#endif // _TIMER_HH_ +#endif // TIMER_HH diff --git a/src/Toolbar.hh b/src/Toolbar.hh index 1f3ba8f..7cc08b1 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh @@ -22,20 +22,39 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.hh,v 1.10 2002/04/03 12:08:54 fluxgen Exp $ +// $Id: Toolbar.hh,v 1.11 2002/08/04 15:55:13 fluxgen Exp $ #ifndef TOOLBAR_HH #define TOOLBAR_HH -#include #include "Basemenu.hh" #include "Timer.hh" #include "IconBar.hh" -// forward declaration + class Toolbar; -class Toolbarmenu : public Basemenu { +/** + Menu for toolbar. + @see Toolbar +*/ +class Toolbarmenu:public Basemenu { +public: + explicit Toolbarmenu(Toolbar *tb); + ~Toolbarmenu(); + #ifdef XINERAMA + inline Basemenu *getHeadmenu() { return headmenu; } + #endif // XINERAMA + + inline Basemenu *getPlacementmenu() { return placementmenu; } + inline const Basemenu *getPlacementmenu() const { return placementmenu; } + + void reconfigure(); + +protected: + virtual void itemSelected(int button, unsigned int index); + virtual void internal_hide(); + private: class Placementmenu : public Basemenu { private: @@ -71,28 +90,88 @@ private: friend class Placementmenu; friend class Toolbar; +}; -protected: - virtual void itemSelected(int button, unsigned int index); - virtual void internal_hide(void); - +/** + the toolbar. +*/ +class Toolbar : public TimeoutHandler { public: - Toolbarmenu(Toolbar *); - ~Toolbarmenu(void); - #ifdef XINERAMA - inline Basemenu *getHeadmenu(void) { return headmenu; } - #endif // XINERAMA + /** + Toolbar placement on the screen + */ + enum Placement{ TOPLEFT = 1, BOTTOMLEFT, TOPCENTER, + BOTTOMCENTER, TOPRIGHT, BOTTOMRIGHT }; - inline Basemenu *getPlacementmenu(void) { return placementmenu; } + explicit Toolbar(BScreen *screen); + virtual ~Toolbar(); - void reconfigure(void); -}; + /// add icon to iconbar + void addIcon(FluxboxWindow *w); + /// remove icon from iconbar + void delIcon(FluxboxWindow *w); + + inline Toolbarmenu *getMenu() { return toolbarmenu; } + inline const Toolbarmenu *getMenu() const { return toolbarmenu; } + + //inline Window getWindowLabel(void) { return frame.window_label; } + + /// are we in workspacename editing? + inline bool isEditing() const { return editing; } + /// always on top? + inline bool isOnTop() const { return on_top; } + /// are we hidden? + inline bool isHidden() const { return hidden; } + /// do we auto hide the toolbar? + inline bool doAutoHide() const { return do_auto_hide; } + /** + @return X window of the toolbar + */ + inline Window getWindowID() const { return frame.window; } + + inline unsigned int getWidth() const { return frame.width; } + inline unsigned int getHeight() const { return frame.height; } + inline unsigned int getExposedHeight() const { return ((do_auto_hide) ? frame.bevel_w : frame.height); } + inline int getX() const { return ((hidden) ? frame.x_hidden : frame.x); } + inline int getY() const { return ((hidden) ? frame.y_hidden : frame.y); } + inline IconBar *getIconBar() { return iconbar; } + /** + @name eventhandlers + */ + //@{ + void buttonPressEvent(XButtonEvent *be); + void buttonReleaseEvent(XButtonEvent *be); + void enterNotifyEvent(XCrossingEvent *ce); + void leaveNotifyEvent(XCrossingEvent *ce); + void exposeEvent(XExposeEvent *ee); + void keyPressEvent(XKeyEvent *ke); + //@} + + void redrawWindowLabel(bool redraw= false); + void redrawWorkspaceLabel(bool redraw= false); + void redrawPrevWorkspaceButton(bool pressed = false, bool redraw = false); + void redrawNextWorkspaceButton(bool pressed = false, bool redraw = false); + void redrawPrevWindowButton(bool pressed = false, bool redraw = false); + void redrawNextWindowButton(bool pressed = false, bool redraw = false); + /// enter edit mode on workspace label + void edit(); + void reconfigure(); + +#ifdef HAVE_STRFTIME + void checkClock(bool redraw = false); +#else // HAVE_STRFTIME + void checkClock(bool redraw = false, bool date = false); +#endif // HAVE_STRFTIME + virtual void timeout(); -class Toolbar : public TimeoutHandler { + private: - Bool on_top, editing, hidden, do_auto_hide; - Display *display; + bool on_top; ///< always on top + bool editing; ///< edit workspace label mode + bool hidden; ///< hidden state + bool do_auto_hide; ///< do we auto hide + Display *display; ///< display connection struct frame { unsigned long button_pixel, pbutton_pixel; @@ -112,14 +191,14 @@ private: virtual void timeout(void); } hide_handler; - Fluxbox *fluxbox; - BScreen *screen; + Fluxbox *fluxbox; ///< obsolete + BScreen *screen; ///< screen on wich this toolbar exist BImageControl *image_ctrl; BTimer clock_timer, *hide_timer; Toolbarmenu *toolbarmenu; - class IconBar *iconbar; + IconBar *iconbar; - std::string new_workspace_name; + std::string new_workspace_name; ///< temp variable in edit mode friend class HideHandler; friend class Toolbarmenu; @@ -127,60 +206,7 @@ private: #ifdef XINERAMA friend class Toolbarmenu::Headmenu; #endif // XINERAMA - - -public: - Toolbar(BScreen *); - virtual ~Toolbar(void); - void addIcon(FluxboxWindow *w); - void delIcon(FluxboxWindow *w); - - inline Toolbarmenu *getMenu(void) { return toolbarmenu; } - //inline Window getWindowLabel(void) { return frame.window_label; } - 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 const Window &getWindowID(void) 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 - { 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 IconBar *getIconBar(void) { return iconbar; } - - void buttonPressEvent(XButtonEvent *); - void buttonReleaseEvent(XButtonEvent *); - void enterNotifyEvent(XCrossingEvent *); - void leaveNotifyEvent(XCrossingEvent *); - void exposeEvent(XExposeEvent *); - void keyPressEvent(XKeyEvent *); - - void redrawWindowLabel(Bool = False); - void redrawWorkspaceLabel(Bool = False); - void redrawPrevWorkspaceButton(Bool = False, Bool = False); - void redrawNextWorkspaceButton(Bool = False, Bool = False); - void redrawPrevWindowButton(Bool = False, Bool = False); - void redrawNextWindowButton(Bool = False, Bool = False); - void edit(void); - void reconfigure(void); - -#ifdef HAVE_STRFTIME - void checkClock(Bool = False); -#else // HAVE_STRFTIME - void checkClock(Bool = False, Bool = False); -#endif // HAVE_STRFTIME - - virtual void timeout(void); - - enum Placement{ TOPLEFT = 1, BOTTOMLEFT, TOPCENTER, - BOTTOMCENTER, TOPRIGHT, BOTTOMRIGHT }; }; -#endif // __Toolbar_hh +#endif // TOOLBAR_HH diff --git a/src/Window.hh b/src/Window.hh index 4396737..5536254 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.24 2002/07/10 14:46:42 fluxgen Exp $ +// $Id: Window.hh,v 1.25 2002/08/04 15:55:13 fluxgen Exp $ #ifndef WINDOW_HH #define WINDOW_HH @@ -45,10 +45,16 @@ class Tab; +/** + Creates the window frame and handles any window event for it + TODO: this is to huge! +*/ class FluxboxWindow : public TimeoutHandler { public: + /// obsolete enum Error{NOERROR=0, XGETWINDOWATTRIB, CANTFINDSCREEN}; - #ifdef GNOME + +#ifdef GNOME enum GnomeLayer { WIN_LAYER_DESKTOP = 0, WIN_LAYER_BELOW = 2, @@ -79,7 +85,7 @@ public: WIN_HINTS_GROUP_TRANSIENT = (1<<3), // Reserved - definition is unclear WIN_HINTS_FOCUS_ON_CLICK = (1<<4) // app only accepts focus if clicked }; - #endif +#endif // GNOME enum WinLayer { LAYER_BOTTOM = 0x01, @@ -116,9 +122,12 @@ public: MwmDecorMaximize = (1l << 6) }; - explicit FluxboxWindow(Window, BScreen *scr = 0); + explicit FluxboxWindow(Window win, BScreen *scr = 0); virtual ~FluxboxWindow(); - + /** + @name accessors + */ + //@{ inline bool isTransient() const { return ((transient) ? true : false); } inline bool hasTransient() const { return ((client.transient) ? true : false); } inline bool isManaged() const { return managed; } @@ -136,11 +145,15 @@ public: inline bool hasTab() const { return (tab!=0 ? true : false); } inline bool isMoving() const { return moving; } inline bool isResizing() const { return resizing; } - inline BScreen *getScreen() const { return screen; } - inline Tab *getTab() const { return tab; } - inline FluxboxWindow *getTransient() const { return client.transient; } - inline FluxboxWindow *getTransientFor() const { return client.transient_for; } - + inline const BScreen *getScreen() const { return screen; } + inline BScreen *getScreen() { return screen; } + inline const Tab *getTab() const { return tab; } + inline Tab *getTab() { return tab; } + inline const FluxboxWindow *getTransient() const { return client.transient; } + inline FluxboxWindow *getTransient() { return client.transient; } + inline const FluxboxWindow *getTransientFor() const { return client.transient_for; } + inline FluxboxWindow *getTransientFor() { return client.transient_for; } + inline const Window &getFrameWindow() const { return frame.window; } inline const Window &getClientWindow() const { return client.window; } @@ -160,6 +173,8 @@ public: inline unsigned int getClientHeight() const { return client.height; } inline unsigned int getClientWidth() const { return client.width; } inline unsigned int getTitleHeight() const { return frame.title_h; } + bool isLowerTab() const; + //@} inline void setWindowNumber(int n) { window_number = n; } @@ -184,7 +199,7 @@ public: void setWorkspace(int n); void changeBlackboxHints(BaseDisplay::BlackboxHints *bh); void restoreAttributes(); - bool isLowerTab() const; + void buttonPressEvent(XButtonEvent *be); void buttonReleaseEvent(XButtonEvent *be); @@ -202,9 +217,9 @@ public: static void showError(FluxboxWindow::Error error); - #ifdef SHAPE +#ifdef SHAPE void shapeEvent(XShapeEvent *); - #endif // SHAPE +#endif // SHAPE virtual void timeout(); @@ -215,10 +230,11 @@ public: unsigned long functions; // Motif wm functions unsigned long decorations; // Motif wm decorations } MwmHints; - #ifdef GNOME + +#ifdef GNOME void setGnomeState(int state); inline int getGnomeHints() const { return gnome_hints; } - #endif //GNOME +#endif //GNOME private: @@ -326,7 +342,7 @@ private: void destroyHandle(); void checkTransient(); - #ifdef GNOME +#ifdef GNOME void updateGnomeAtoms() const; void updateGnomeStateAtom() const; @@ -345,15 +361,15 @@ private: void loadGnomeLayerAtom(); int gnome_hints; - #endif //GNOME +#endif //GNOME - #ifdef NEWWMSPEC +#ifdef NEWWMSPEC void updateNETWMAtoms(); void handleNETWMProperyNotify(Atom atom); int getNETWMWindowState(); - #endif //NEWWMSPEC +#endif //NEWWMSPEC Window findTitleButton(int type); private: diff --git a/src/Workspace.hh b/src/Workspace.hh index 379c30b..dc640ac 100644 --- a/src/Workspace.hh +++ b/src/Workspace.hh @@ -36,34 +36,54 @@ class BScreen; - +/** + Handles a single workspace +*/ class Workspace:private NotCopyable { public: typedef std::vector Windows; - Workspace(BScreen *screen, unsigned int workspaceid= 0); + Workspace(BScreen *screen, unsigned int workspaceid = 0); ~Workspace(); + inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; } + /** + Set workspace name + */ void setName(const char *name); void showAll(); void hideAll(); void removeAll(); - void raiseWindow(FluxboxWindow *); - void lowerWindow(FluxboxWindow *); + void raiseWindow(FluxboxWindow *win); + void lowerWindow(FluxboxWindow *win); void reconfigure(); void update(); void setCurrent(); void shutdown(); - int addWindow(FluxboxWindow *window, bool place = false); - int removeWindow(FluxboxWindow *); + int addWindow(FluxboxWindow *win, bool place = false); + int removeWindow(FluxboxWindow *win); + BScreen *getScreen() { return screen; } + FluxboxWindow *getLastFocusedWindow() { return lastfocus; } - inline BScreen *getScreen() const { return screen; } - inline FluxboxWindow *getLastFocusedWindow(void) const { return lastfocus; } - inline Clientmenu *menu() { return &m_clientmenu; } + const BScreen *getScreen() const { return screen; } + const FluxboxWindow *getLastFocusedWindow() const { return lastfocus; } + Clientmenu *menu() { return &m_clientmenu; } + /** + @return client menu + */ inline const Clientmenu *menu() const { return &m_clientmenu; } + /** + @return name of this workspace + */ inline const std::string &name() const { return m_name; } + /** + @return the number of this workspace, note: obsolete, should be in BScreen + */ inline unsigned int workspaceID() const { return m_id; } - + /** + @param id the window id number + @return window that match the id, else 0 + */ FluxboxWindow *getWindow(unsigned int id); const FluxboxWindow *getWindow(unsigned int id) const; inline const Windows &getWindowList() const { return windowList; } @@ -72,7 +92,7 @@ public: int getCount() const; protected: - void placeWindow(FluxboxWindow *); + void placeWindow(FluxboxWindow *win); private: BScreen *screen; @@ -85,11 +105,11 @@ private: WindowStack stackingList; Windows windowList; - std::string m_name; - unsigned int m_id; + std::string m_name; ///< name of this workspace + unsigned int m_id; ///< id, obsolete, this should be in BScreen int cascade_x, cascade_y; }; -#endif // _WORKSPACE_HH_ +#endif // WORKSPACE_HH diff --git a/src/fluxbox.hh b/src/fluxbox.hh index b83347e..0a2f7c9 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.hh,v 1.21 2002/07/19 21:26:11 fluxgen Exp $ +// $Id: fluxbox.hh,v 1.22 2002/08/04 15:55:13 fluxgen Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH @@ -62,6 +62,10 @@ #include #include +/** + main class for the window manager. + singleton type +*/ class Fluxbox : public BaseDisplay, public TimeoutHandler { public: @@ -72,12 +76,12 @@ public: inline bool useIconBar() { return *m_rc_iconbar; } inline void saveTabs(bool value) { *m_rc_tabs = value; } inline void saveIconBar(bool value) { m_rc_iconbar = value; } -#ifdef HAVE_GETPID - inline const Atom &getFluxboxPidAtom(void) const { return fluxbox_pid; } +#ifdef HAVE_GETPID + inline const Atom &getFluxboxPidAtom() const { return fluxbox_pid; } #ifdef KDE //For KDE dock applets - inline const Atom &getKWM1DockwindowAtom(void) const { return kwm1_dockwindow; } //KDE v1.x - inline const Atom &getKWM2DockwindowAtom(void) const { return kwm2_dockwindow; } //KDE v2.x + inline const Atom &getKWM1DockwindowAtom() const { return kwm1_dockwindow; } //KDE v1.x + inline const Atom &getKWM2DockwindowAtom() const { return kwm2_dockwindow; } //KDE v2.x #endif #endif // HAVE_GETPID @@ -85,39 +89,39 @@ public: FluxboxWindow *searchGroup(Window, FluxboxWindow *); FluxboxWindow *searchWindow(Window); - inline FluxboxWindow *getFocusedWindow(void) { return focused_window; } + inline FluxboxWindow *getFocusedWindow() { return focused_window; } - BScreen *searchScreen(Window); + BScreen *searchScreen(Window w); - inline const Time &getDoubleClickInterval(void) const - { return resource.double_click_interval; } - inline const Time &getLastTime(void) const { return last_time; } + inline const Time &getDoubleClickInterval() const { return resource.double_click_interval; } + inline const Time &getLastTime() const { return last_time; } - Toolbar *searchToolbar(Window); + Toolbar *searchToolbar(Window w); Tab *searchTab(Window); + /// obsolete enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENU, EMPTY}; inline const std::vector& getTitlebarRight() { return *m_rc_titlebar_right; } inline const std::vector& getTitlebarLeft() { return *m_rc_titlebar_left; } - inline const char *getStyleFilename(void) const { return m_rc_stylefile->c_str(); } + inline const char *getStyleFilename() const { return m_rc_stylefile->c_str(); } - inline const char *getMenuFilename(void) const { return m_rc_menufile->c_str(); } - inline const std::string &getSlitlistFilename(void) const { return *m_rc_slitlistfile; } - inline int colorsPerChannel(void) const { return *m_rc_colors_per_channel; } + inline const char *getMenuFilename() const { return m_rc_menufile->c_str(); } + inline const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; } + inline int colorsPerChannel() const { return *m_rc_colors_per_channel; } - inline const timeval &getAutoRaiseDelay(void) const { return resource.auto_raise_delay; } + inline const timeval &getAutoRaiseDelay() const { return resource.auto_raise_delay; } - inline unsigned int getCacheLife(void) const { return *m_rc_cache_life * 60000; } - inline unsigned int getCacheMax(void) const { return *m_rc_cache_max; } + inline unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; } + inline unsigned int getCacheMax() const { return *m_rc_cache_max; } inline void maskWindowEvents(Window w, FluxboxWindow *bw) { masked = w; masked_window = bw; } inline void setNoFocus(Bool f) { no_focus = f; } void setFocusedWindow(FluxboxWindow *w); - void shutdown(void); + void shutdown(); void load_rc(BScreen *); void loadRootCommand(BScreen *); void loadTitlebar(); @@ -130,21 +134,21 @@ public: void saveToolbarSearch(Window, Toolbar *); void saveTabSearch(Window, Tab *); void saveGroupSearch(Window, FluxboxWindow *); - void save_rc(void); + void save_rc(); void removeMenuSearch(Window); void removeWindowSearch(Window); void removeToolbarSearch(Window); void removeTabSearch(Window); void removeGroupSearch(Window); void restart(const char * = 0); - void reconfigure(void); - void reconfigureTabs(void); - void rereadMenu(void); - void checkMenu(void); + void reconfigure(); + void reconfigureTabs(); + void rereadMenu(); + void checkMenu(); virtual Bool handleSignal(int); - virtual void timeout(void); + virtual void timeout(); #ifdef SLIT Slit *searchSlit(Window); @@ -238,18 +242,18 @@ protected: Fluxbox(int, char **, char * = 0, char * = 0); char *getRcFilename(); void getDefaultDataFilename(char *, std::string &); - void load_rc(void); + void load_rc(); - void reload_rc(void); - void real_rereadMenu(void); - void real_reconfigure(void); + void reload_rc(); + void real_rereadMenu(); + void real_reconfigure(); virtual void process_event(XEvent *); //only main should be able to creat new blackbox object //TODO this must be removed! friend int main(int,char **); static Fluxbox *singleton; //singleton object ( can only be destroyed by main ) - virtual ~Fluxbox(void); + virtual ~Fluxbox(); }; -- cgit v0.11.2