00001
00002
00003
00004
00005
00008
00009 #define _OBJECT_H_
00012 #include <windows.h>
00013 #include "node.h"
00014 #include "rectangle.h"
00015 #include "bitmap.h"
00018
00019
00020
00023
00024
00025
00026 enum
00027 {
00028 mouseNORMAL=0,
00029 mouseLDOWN,
00030 mouseLUP,
00031 mouseLDBLCLK,
00032 mouseMDOWN,
00033 mouseMUP,
00034 mouseMDBLCLK,
00035 mouseRDOWN,
00036 mouseRUP,
00037 mouseRDBLCLK,
00038 mouseLOSTCAPTURE,
00039 mouseWHEEL,
00040 mouseSTAY,
00041 mouseENTER,
00042 mouseLEAVE
00043 };
00044
00045
00046
00047 #define mouseCTRL (1<<31)
00048 #define mouseSHIFT (1<<30)
00049 #define mouseALT (1<<29)
00050 #define mouseL (1<<28)
00051 #define mouseM (1<<27)
00052 #define mouseR (1<<26)
00053 #define mousePULSE (1<<01) // alib internal message
00054 #define mouseCAPTURE (1<<00) // alib internal message
00055
00056
00057
00058 enum
00059 {
00060 keyboardNORMAL=0,
00061 keyboardDOWN,
00062 keyboardUP,
00063 keyboardCHAR,
00064 keyboardGETFOCUS,
00065 keyboardLOSTFOCUS
00066 };
00067
00068
00069
00070 #define keyboardCTRL (1<<31)
00071 #define keyboardSHIFT (1<<30)
00072 #define keyboardALT (1<<29)
00073
00074 #define keyboardLCTRL (1<<28)
00075 #define keyboardLSHIFT (1<<27)
00076 #define keyboardLALT (1<<26)
00077 #define keyboardRCTRL (1<<25)
00078 #define keyboardRSHIFT (1<<24)
00079 #define keyboardRALT (1<<23)
00080
00081
00082
00083 #define keyboardCURSORLEFT (1<<19)
00084 #define keyboardCURSORRIGHT (1<<18)
00085 #define keyboardHOME (1<<17)
00086 #define keyboardEND (1<<16)
00087 #define keyboardINSERT (1<<15)
00088 #define keyboardDELETE (1<<14)
00089 #define keyboardCLEAR (1<<13)
00090 #define keyboardBACKSPACE (1<<12)
00091 #define keyboardENTER (1<<11)
00092 #define keyboardCURSORUP (1<<10)
00093 #define keyboardCURSORDOWN (1<<9)
00094 #define keyboardPAGEUP (1<<8)
00095 #define keyboardPAGEDOWN (1<<7)
00096 #define keyboardTAB (1<<6)
00097 #define keyboardESCAPE (1<<5)
00098
00099
00100
00101 enum
00102 {
00103 zorderFRONT=0,
00104 zorderBACK,
00105 zorderTOP
00106 };
00107
00110
00111 class Aobject : public Anode
00112 {
00113 public:
00114
00115 enum
00116 {
00117 stateVISIBLE = Anode::stateLAST,
00118 stateFOCUS = stateVISIBLE<<1,
00119 stateNOCONTEXT = stateFOCUS<<1,
00120 stateSIZEABLE = stateNOCONTEXT<<1,
00121 stateLAST = stateSIZEABLE<<1
00122 };
00123
00124 ADLL static ACI CI;
00125 virtual ACI *getCI () { return &CI; }
00126
00127 Arectangle pos;
00128
00129 ADLL Aobject (char *name, class Aobject *father, int x, int y, int w, int h);
00130 ADLL virtual ~Aobject ();
00131
00132
00133
00134 ADLL void destroy ();
00135
00136 ADLL virtual bool show (bool visible);
00137 ADLL virtual bool zorder (int action);
00138
00139 ADLL virtual bool move (int x, int y);
00140 virtual bool size (int w, int h) { pos.w=w; pos.h=h; return TRUE; }
00141 ADLL virtual bool mouseCapture (bool b, Aobject *o=NULL);
00142 ADLL virtual void mousePosition (int *x, int *y);
00143 ADLL virtual bool focus (Aobject *o=NULL);
00144 ADLL virtual bool timer (int time=0);
00145 virtual bool setTooltips (char *s) { if(tooltips) free(tooltips); return (tooltips=strdup(s))?TRUE:FALSE; }
00146
00147 ADLL class Awindow * getWindow ();
00148 ADLL bool getPosition (Aobject *o, int *x, int *y);
00149 ADLL class Aobject * getObject (int x, int y);
00150
00151 ADLL int getKeyboardState ();
00152
00153
00154
00155 ADLL virtual void update (Abitmap *b);
00156 virtual void paint (Abitmap *b) { }
00157 ADLL virtual void repaint (Arectangle r, bool now=FALSE);
00158 ADLL virtual void repaint (bool now=FALSE);
00159
00160 virtual bool mouse (int x, int y, int state, int event) { return FALSE; }
00161 virtual bool keyboard (int event, int ascii, int scan, int state) { return FALSE; }
00162
00163 virtual void pulse () { }
00164
00165
00166 class Aitem *context;
00167
00168
00169
00170 virtual bool NCkeyboard (int event, int ascii, int scan, int state) { if(keyboard(event, ascii, scan, state)) return true; if(father) return ((Aobject *)father)->NCkeyboard(event, ascii, scan, state); return false; }
00171 ADLL virtual bool NCmouse (int x, int y, int state, int event);
00172 bool NCzorder (Anode *o, int action);
00173
00174 char *tooltips;
00175 };
00176
00179
00180
00181
00183
00186 #endif //_OBJECT_H_