1 #ifndef WIDGET_H
2 #define WIDGET_H
3 
4 #include "focus.h"
5 
6 class AGUIX;
7 
8 class Widget : public Focus
9 {
10   friend class AWindow;
11 public:
12   Widget( AGUIX *aguix );
13   virtual ~Widget();
14   Widget( const Widget &other );
15   Widget &operator=( const Widget &other );
16 
17   virtual int create();
18   virtual void destroy();
19   bool isCreated() const;
20 
21   virtual void redraw() = 0;
22   virtual bool handleMessage( XEvent *,Message *msg ) = 0;
23   virtual int handleMessageLock( XEvent *E, Message *msg );
24   virtual int getWidth() const;
25   virtual int getHeight() const;
26   virtual int getX() const;
27   virtual int getY() const;
28   virtual void move( int nx, int ny ) = 0;
29   virtual void resize( int nw, int nh ) = 0;
30   virtual bool contains( Widget *elem ) const;
31   virtual Window getWindow() const = 0;
32   virtual bool isParent( Window ) const = 0;
33   virtual bool isVisible() const = 0;
34 
35   bool getAllowTimerEventBreak() const;
36   void setAllowTimerEventBreak( bool nv );
37   long getNrOfLastEventBreak() const;
38   void setNrOfLastEventBreak( long t );
39 protected:
40   virtual void doCreateStuff();
41   virtual void doDestroyStuff();
42   virtual int setParent( class AWindow *parent );
43   void setIsTopLevelWidget( bool nv );
44 
45   class AWindow *_parent;
46   bool _created;
47   AGUIX *_aguix;
48   int _x, _y, _w, _h;
49   bool _is_top_level_widget;
50 private:
51   bool m_allow_timerevent_break;
52   long m_nr_of_last_event_break;
53 };
54 
55 #endif
56