1 #ifndef WMTITLE_H 2 #define WMTITLE_H 3 4 class YFrameButton; 5 class YFrameWindow; 6 7 class YFrameTitleBar: public YWindow { 8 public: 9 YFrameTitleBar(YWindow *parent, YFrameWindow *frame); 10 virtual ~YFrameTitleBar(); 11 12 void activate(); 13 void deactivate(); 14 void renderShape(Graphics& g); 15 16 virtual void paint(Graphics &g, const YRect &r); 17 virtual void handleButton(const XButtonEvent &button); 18 virtual void handleClick(const XButtonEvent &up, int count); 19 virtual bool handleBeginDrag(const XButtonEvent &down, const XMotionEvent &motion); 20 virtual void handleVisibility(const XVisibilityEvent &visibility); handleExpose(XExposeEvent const & expose)21 virtual void handleExpose(XExposeEvent const& expose) {} 22 virtual void configure(const YRect2& r); 23 virtual void repaint(); 24 getFrame()25 YFrameWindow* getFrame() const { return fFrame; }; menuButton()26 YFrameButton* menuButton() const { return fButtons[6]; } rollupButton()27 YFrameButton* rollupButton() const { return fButtons[5]; } maximizeButton()28 YFrameButton* maximizeButton() const { return fButtons[4]; } 29 30 void layoutButtons(); 31 void relayout(); 32 void refresh(); 33 34 static YColor background(bool active); 35 static bool isRight(const YFrameButton* b); 36 static bool isRight(char c); 37 static bool supported(char c); 38 39 enum { 40 Depth = 'd', 41 Hide = 'h', 42 Mini = 'i', 43 Maxi = 'm', 44 Roll = 'r', 45 Menu = 's', 46 Close = 'x', 47 }; 48 49 private: 50 static void initTitleColorsFonts(); 51 decors()52 unsigned decors() const { return getFrame()->frameDecors(); } focused()53 bool focused() const { return getFrame()->focused(); } 54 55 YFrameButton* getButton(char c); 56 57 YFrameWindow *fFrame; 58 bool wasCanRaise; 59 bool fVisible; 60 61 enum { Count = 8, }; 62 YFrameButton* fButtons[Count]; 63 static bool swapTitleButtons; 64 }; 65 66 #endif 67 68 // vim: set sw=4 ts=4 et: 69