summaryrefslogtreecommitdiff
path: root/include/widgets.h
diff options
context:
space:
mode:
authorpixel <pixel>2004-07-16 15:04:52 +0000
committerpixel <pixel>2004-07-16 15:04:52 +0000
commit14271a8d758c086e0762e7ad0d649dabc8848191 (patch)
tree03f3d6a9ae107127563911f1dd337c5fba88dc4c /include/widgets.h
parent2d7027363cc50c6532711a2b976c65a3cae0ec4a (diff)
Structuring mogltk into PSX-Bundle, and commiting latest changes
Diffstat (limited to 'include/widgets.h')
-rw-r--r--include/widgets.h44
1 files changed, 40 insertions, 4 deletions
diff --git a/include/widgets.h b/include/widgets.h
index 88ba2d9..2eec009 100644
--- a/include/widgets.h
+++ b/include/widgets.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: widgets.h,v 1.4 2004-07-15 14:21:30 pixel Exp $ */
+/* $Id: widgets.h,v 1.5 2004-07-16 15:04:52 pixel Exp $ */
#ifndef __WIDGETS_H__
#define __WIDGETS_H__
@@ -28,6 +28,7 @@
namespace mogltk {
enum event_t {
+ E_TIMER,
E_MOUSE_START_DRAG,
E_MOUSE_DRAG,
E_MOUSE_DRAG_OVER,
@@ -68,6 +69,8 @@ namespace mogltk {
virtual void SetVisible(bool);
bool GetEnabled();
virtual void SetEnabled(bool);
+ void MoveOnTop();
+ static void check_timed_events();
protected:
widget(widget * father, int x, int y, int sx, int sy, int type, String name, shape *);
virtual void draw();
@@ -79,10 +82,12 @@ namespace mogltk {
void remove_out_move();
void add_out_click();
void remove_out_click();
+ void set_timed_event(Uint32);
+ void set_absolute_timed_event(Uint32);
String caption;
private:
int x, y, sx, sy, ax, ay, ax2, ay2;
- widget * father, * next, * prev, * child, * root;
+ widget * father, * next, * prev, * child, * last, * root;
static widget * focused;
int type;
String name;
@@ -90,6 +95,13 @@ namespace mogltk {
widget * exclusive;
bool visible;
bool enabled;
+ class timed_event {
+ public:
+ timed_event(widget * _w, Uint32 _t) : w(_w), t(_t) { }
+ widget * w;
+ Uint32 t;
+ };
+ static std::vector<timed_event> timed_events;
void computeabs();
void idraw();
@@ -176,6 +188,7 @@ namespace mogltk {
virtual void resize(int w, int h);
virtual void SetVisible(bool);
virtual void SetEnabled(int i, bool);
+ void StickyDisplay();
protected:
virtual void draw();
virtual bool process_event(int x, int y, event_t event);
@@ -205,7 +218,7 @@ namespace mogltk {
int selected;
ContextMenu * subselected;
private:
- bool in_click;
+ bool in_click, sticky;
bool iin_click();
};
@@ -213,11 +226,34 @@ namespace mogltk {
class Menu : public widget {
public:
Menu(shape *, widget * father);
- virtual void resize_notify();
+ void addnode(const String &, action *);
+ void addsub(const String &, ContextMenu * sub);
+ ContextMenu * createsub(const String &);
+ virtual void SetEnabled(int i, bool);
protected:
+ virtual void resize_notify();
virtual void draw();
virtual bool process_event(int, int, event_t);
+ class node : public Base {
+ public:
+ node(const String & caption, ContextMenu * sub, action * a, int x);
+ String GetCaption();
+ ContextMenu * GetSub();
+ action * GetAction();
+ int GetX();
+ bool GetEnabled();
+ void SetEnabled(bool);
+ private:
+ String caption;
+ ContextMenu * sub;
+ action * a;
+ int x;
+ bool enabled;
+ };
private:
+ std::vector<node> nodes;
+ int cur_x;
+ int selected;
};
};
};