00001
00002 #ifndef __OS_CLASS_H
00003 #define __OS_CLASS_H
00004
00005 #include "GRect.h"
00006
00007 class GView;
00008 class GRect;
00009 class GMessage
00010 {
00011 int Msg, Arg1, Arg2;
00012
00013 public:
00014 GMessage(int M = 0, int A = 0, int B = 0)
00015 {
00016 Msg = M;
00017 Arg1 = A;
00018 Arg2 = B;
00019 }
00020
00021 int &m() { return Msg; }
00022 int &a() { return Arg1; }
00023 int &b() { return Arg2; }
00024 };
00025
00026 #define MsgCode(Msg) (Msg ? ((GMessage*)Msg)->m() : 0)
00027 #define MsgA(Msg) (Msg ? ((GMessage*)Msg)->a() : 0)
00028 #define MsgB(Msg) (Msg ? ((GMessage*)Msg)->b() : 0)
00029
00030 extern GMessage CreateMsg(int m, int a, int b);
00031
00032 class OsAppArguments
00033 {
00034 public:
00035 int Args;
00036 char **Arg;
00037 };
00038
00039 class OsApplication
00040 {
00041 public:
00042 OsApplication(int args, char **arg);
00043
00044 void Run();
00045 };
00046
00047 class OsPoint
00048 {
00049 public:
00050 int x, y;
00051
00052 OsPoint(int X = 0, int Y = 0)
00053 {
00054 x = X;
00055 y = Y;
00056 }
00057 };
00058
00059 class YObject
00060 {
00061 public:
00062 virtual ~YObject() {}
00063 };
00064
00065 class YView : public YObject
00066 {
00067 class YViewPrivate *d;
00068
00069 protected:
00070 void SetHandle(class Y::Widget *p);
00071
00072 public:
00073 YView(GView *v, bool p = true);
00074 ~YView();
00075
00076 GView *_GetWndPtr();
00077 void _SetWndPtr(GView *v);
00078 void _SetDeleteMe();
00079
00080 Y::Widget *handle();
00081 YView *parentWidget();
00082 virtual bool reparent(void *p, OsPoint &p, bool vis);
00083 bool isTabStop();
00084 void isTabStop(bool i);
00085 virtual GRect &geometry();
00086 virtual void setGeometry(int x, int y, int w, int h);
00087 void repaint();
00088 void repaint(int x, int y, int w, int h);
00089 void update();
00090 void update(int x, int y, int w, int h);
00091 void setText(char *s);
00092 bool isEnabled();
00093 void setEnabled(bool b);
00094 virtual void show();
00095 virtual void hide();
00096 void setFocus();
00097 void clearFocus();
00098 bool hasFocus();
00099 void grabMouse();
00100 void ungrabMouse();
00101 OsPoint &mapToGlobal(OsPoint &p);
00102 OsPoint &mapFromGlobal(OsPoint &p);
00103 int wantKeys();
00104 void wantKeys(int w);
00105 };
00106
00107 typedef YView *OsView;
00108
00109 class YWindow : public YView, public SigC::Object
00110 {
00111 class YWindowPrivate *d;
00112
00113 void OnDraw();
00114 void OnRequestExit();
00115
00116 public:
00117 YWindow(GWindow *t);
00118 ~YWindow();
00119
00120 bool reparent(void *p, OsPoint &p, bool vis);
00121 GRect &geometry();
00122 void setGeometry(int x, int y, int w, int h);
00123 void show();
00124 void hide();
00125 };
00126
00127 typedef YWindow *OsWindow;
00128
00129 class YPainter : public YObject
00130 {
00131 public:
00132 void SetClient(GRect *r);
00133 };
00134
00135 typedef YPainter *OsPainter;
00136
00137 class YFont : public YObject
00138 {
00139 public:
00140 int GetAscent();
00141 };
00142 typedef YFont *OsFont;
00143
00144 typedef void *OsBitmap;
00145 typedef void *OsSubMenu;
00146 typedef void *OsMenuItem;
00147 typedef pthread_t OsThread;
00148 typedef YView DefaultOsView;
00149 typedef int OsProcess;
00150
00151 extern bool _GetKdeFont(char *FontType, char *Font, int FontBufSize, int &PointSize);
00152
00153 #endif