00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _uevent_hpp_
00026 #define _uevent_hpp_
00027
00028 #include <ubit/udefs.hpp>
00029
00032 typedef union _XEvent* UX_Event;
00033
00034
00035
00038 struct URegion {
00039 u_pos x, y;
00040 u_dim width, height;
00041
00042 URegion() {};
00043 URegion(const URegion& r) {*this = r;}
00044 URegion(u_pos rx, u_pos ry, u_dim rwidth, u_dim rheight) {
00045 x = rx; y = ry; width = rwidth; height = rheight;
00046 }
00047
00048 void set(const URegion& r) {*this = r;}
00049 void set(u_pos rx, u_pos ry, u_dim rwidth, u_dim rheight) {
00050 x = rx; y = ry; width = rwidth; height = rheight;
00051 }
00052
00053
00054
00055
00056
00057
00058
00059 bool setInter(const URegion &clip2);
00060 bool setInter(const URegion *clip2);
00061 bool setInter(u_pos x, u_pos y, u_dim w, u_dim h);
00062
00063
00064 void setClosure(const URegion &clip2);
00065 void setClosure(const URegion *clip2);
00066 void setClosure(u_pos x, u_pos y, u_dim w, u_dim h);
00067 };
00068
00069
00070
00073 struct USourceProps {
00074 unsigned char enabled;
00076
00077 unsigned char inMenu;
00079
00080 unsigned char autoCloseMenu;
00082
00083 unsigned char redrawStatus;
00084 URegion redrawClip;
00086
00087 class UView* opaqueView;
00089
00090 class UView* layoutView;
00092
00093 class UView* incrustView;
00094
00095 const UCursor* cursor;
00097
00098 class UGroup *browsingGroup, *parentBrowsingGroup;
00099 class UContext *parentContext;
00100
00101 USourceProps(UView* hardwin_view) {reset(hardwin_view);}
00102
00103 void reset(UView* hardwin_view);
00104 void set(UView* view, UGroup*, const UContext& curp);
00105 };
00106
00107
00108
00109
00112 class UEvent {
00113 public:
00115 enum ID {
00116 rawEvent = 0,
00117 mpress = 1<<0,
00118 mrelease = 1<<1,
00119 mmove = 1<<2,
00120 mdrag = 1<<3,
00121 kpress = 1<<4,
00122 krelease = 1<<5,
00123 enter = 1<<6,
00124 leave = 1<<7,
00125 change = 1<<8,
00126 select = 1<<9,
00127 unselect = 1<<10,
00128 action = 1<<11,
00129 add = 1<<15,
00130 remove = 1<<16,
00131 close = 1<<17,
00132 destruct = 1<<18,
00133 viewPaint = 1<<20,
00134 viewResize = 1<<21,
00135 viewMove = 1<<22,
00136 search = 1<<23,
00137
00138
00139 umessage = 1<<26,
00140 notifyEvent = 1<<27
00141 };
00142
00143 static const u_id MButton1, MButton2, MButton3, MButton4, MButton5;
00148 static const u_id MShift, MLock, MControl, MOption;
00153 static const u_id UbitEventFlow;
00159
00160
00161
00162 int getID() const {return id;}
00164
00165 const class UCond* getCond() const {return cond;}
00172 UView* getView() const {return sourceView;}
00177 UGroup* getSource() const;
00178 UBox* getBoxSource() const;
00184 UGroup* getTarget() const;
00185 UBox* getBoxTarget() const;
00186 UBrick* getBrickTarget() const;
00192 class UAppli* getAppli() const;
00194
00195 class UDisp* getDisp() const;
00196 int getDispID() const;
00200 class UFlow* getFlow() const {return eflow;}
00201 int getFlowID() const;
00206 u_time getTime() const;
00208
00209
00210
00211
00212 u_pos getX() const;
00213 u_pos getY() const;
00218 u_pos getXscreen() const;
00219 u_pos getYscreen() const;
00221
00222 u_pos getXwin() const {return xmouse;}
00223 u_pos getYwin() const {return ymouse;}
00228 int getClickCount() const;
00230
00231 u_id getButtons() const;
00246
00247
00248
00249 u_id getMods() const;
00255
00256
00257
00258
00259
00260
00261 int getKeyChar() const;
00263
00264 void setKeyChar(int);
00266
00267 u_id getKeySym() const;
00272
00273
00274
00275 UProp* getChangedProp() const;
00276 UElem* getChangedElem() const;
00277 UStr* getChangedStr() const;
00279
00280
00281
00282
00283 bool getMessage(UStr&) const;
00285
00286
00287
00288
00289 class UElem* getElem();
00291
00292 class UStr* getStr();
00298 class UElem* getElem(class UElemProps&);
00299 class UStr* getStr(class UElemProps&);
00310 class UElem* searchElem(class UElemProps&, const UElem* searched_elem,
00311 int strpos1 = -1, int strpos2 = -1);
00321
00322
00323
00324 void goThrough(UBox*);
00326
00327 void setMouse(u_pos x, u_pos y);
00329
00330 void addFlagdef(const class UFlagdef*);
00332
00333 const class UFlagdef* getFlagdef(const class UFlag&) const;
00334 const class UPropdef* getPropdef(const class UFlag&) const;
00335
00336 const class UFlagdef** getFlagdefs() const {return flagdefs;}
00337 u_count getFlagdefCount() const {return flagdefCount;}
00338
00339
00340
00341
00342 class UWin* getHardWin() const;
00343 class UView* getHardWinView() const;
00345
00346 class USourceProps& getSourceProps() {return sp;}
00348
00349 UX_Event getXEvent() const {return xev;}
00351
00352 UEvent(int event_id, class UFlow*, class UView* hardwin_view, UX_Event);
00354
00355 ~UEvent();
00356
00357 #ifndef NO_DOC
00358 USourceProps sp;
00359 private:
00360 friend class UFlow;
00361 friend class UCtrl;
00362 friend class UView;
00363
00364 class UGroup* source;
00365 class UView* sourceView;
00366 class UView* hardWinView;
00367 class UBrick* aux;
00368 class UFlow* eflow;
00369 const class UCond* cond;
00370 const class UFlagdef** flagdefs;
00371 unsigned short flagdefCount;
00372 unsigned char preChildEventNotify, postChildEventNotify, resendEvent;
00373 int id;
00374 int detail;
00375 u_time time;
00376 u_pos xmouse, ymouse;
00377 u_pos xdrag_ref, ydrag_ref;
00378 UX_Event xev;
00379
00380 public:
00381 void setID(int);
00382 void setSource(UView*);
00383 void setSource(UGroup*);
00384 void setAux(UBrick*);
00385 void setCond(const UCond*);
00386 void setTime(u_time t) {time = t;}
00387 void setPostChildEventNotify(bool s) {postChildEventNotify = bool(s);}
00388 bool isPostChildEventNotify() {return bool(postChildEventNotify);}
00389
00390 UView* locateSource(UView* searched_view);
00391 UView* locateSource(u_pos x_in_hardwin, u_pos y_in_hardwin);
00393
00394 void actualize(int event_id, u_pos x_in_hardwin, u_pos y_in_hardwin, UX_Event ev)
00395 {id = event_id; xev = ev; xmouse = x_in_hardwin; ymouse = y_in_hardwin;}
00397
00398 void copy(const UEvent&);
00400 #endif
00401 };
00402
00403
00404
00405
00409 class UElemProps {
00410 public:
00411 class UElem* elem;
00412 class ULink* elemLink;
00416 URegion region;
00422 bool exactMatch;
00426 int strpos, strpos2;
00428
00429 class UWinContext* winContext;
00430 class UContext* elemContext;
00434 public:
00435 UElemProps();
00436 ~UElemProps();
00437
00438 u_pos getX(class UEvent*);
00439 u_pos getY(class UEvent*);
00443 u_dim getWidth();
00444 u_dim getHeight();
00446
00447
00448
00449
00450 #ifndef NO_DOC
00451 friend class UEvent;
00452 friend class UView;
00453
00454 void set(UContext&, UElem*, class ULink*, const URegion&,
00455 int _strpos, bool exact_match);
00456 void merge(UContext&, UElem*, class ULink*, const URegion&,
00457 bool exact_match);
00458 #endif
00459 };
00460
00461
00462 #endif
00463
00464
00465