1
0

framewnd.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //NONPORTABLE
  2. #ifndef _FRAMEWND_H
  3. #define _FRAMEWND_H
  4. #include <bfc/common.h>
  5. #include <api/wnd/wndclass/labelwnd.h>
  6. #include <tataki/bitmap/autobitmap.h>
  7. #define MAXCHILD 2 // this had better never not be 2
  8. typedef enum {
  9. DIVIDER_HORIZONTAL, DIVIDER_VERTICAL, DIVIDER_UNDEFINED = -1
  10. } FrameWndDividerType;
  11. enum { SDP_FROMLEFT, SDP_FROMRIGHT };
  12. #define SDP_FROMTOP SDP_FROMLEFT
  13. #define SDP_FROMBOTTOM SDP_FROMRIGHT
  14. typedef enum {
  15. FRAMEWND_SQUISH,
  16. FRAMEWND_COVER
  17. } FrameWndSlideMode;
  18. #define SIZERWIDTH 8
  19. // this window holds other basewnd derived classes
  20. #define FRAMEWND_PARENT LabelWnd
  21. class FrameWnd : public FRAMEWND_PARENT {
  22. public:
  23. FrameWnd();
  24. virtual ~FrameWnd();
  25. virtual int onInit();
  26. virtual int getCursorType(int x, int y);
  27. virtual int onPaint(Canvas *canvas);
  28. virtual int onResize();
  29. virtual int onLeftButtonDown(int x, int y);
  30. virtual int onMouseMove(int x, int y); // only called when mouse captured
  31. virtual int onLeftButtonUp(int x, int y);
  32. virtual int childNotify(ifc_window *which, int msg, intptr_t param1, intptr_t param2);
  33. // virtual int forceFocus();
  34. // unique to this class
  35. int setChildren(BaseWnd *child1, BaseWnd *child2=NULL);
  36. int setChildrenRootWnd(ifc_window *child1, ifc_window *child2=NULL);
  37. ifc_window *enumChild(int which);
  38. // horizontal or vertical?
  39. void setDividerType(FrameWndDividerType type);
  40. FrameWndDividerType getDividerType();
  41. // where is the divider?
  42. int setDividerPos(int from, int pos);
  43. // this version doesn't check the cfg file for last position
  44. int setDividerPosNoCfg(int from, int pos);
  45. void getDividerPos(int *from, int *pos);
  46. int setResizeable(int is);
  47. void setMinWidth(int min);
  48. void setMaxWidth(int max);
  49. void setSnap(int snap);
  50. virtual int onGetFocus();
  51. virtual int onDeferredCallback(intptr_t p1, intptr_t p2);
  52. // cover or squish
  53. void setSlideMode(FrameWndSlideMode mode);
  54. FrameWndSlideMode getSlideMode();
  55. virtual void onResizeChildren(RECT leftr, RECT rightr);
  56. // drag and drops are forwarded into windowshaded windows
  57. virtual int dragEnter(ifc_window *sourceWnd);
  58. virtual int dragOver(int x, int y, ifc_window *sourceWnd);
  59. virtual int dragLeave(ifc_window *sourceWnd);
  60. virtual int dragDrop(ifc_window *sourceWnd, int x, int y);
  61. protected:
  62. int convertPropToPix(int prop);
  63. int ConvertPixToProp();
  64. void windowshade(int which, int shaded);
  65. ifc_window *getWindowShadedChild();
  66. void Set_v_bitmap(const wchar_t *new_v_bitmap);
  67. void Set_v_grabber(const wchar_t *new_v_grabber);
  68. private:
  69. int _setChildren(ifc_window *child1, ifc_window *child2, BaseWnd *child1b, BaseWnd *child2b);
  70. int nchild;
  71. BaseWnd *children[MAXCHILD];
  72. ifc_window *rwchildren[MAXCHILD];
  73. int hidey[MAXCHILD];
  74. int windowshaded[MAXCHILD];
  75. FrameWndDividerType vert;
  76. int resizeable;
  77. FrameWndSlideMode slidemode;
  78. int divideside;
  79. int pullbarpos; // 0..65536
  80. int prevpullbarpos;
  81. int minwidth, maxwidth;
  82. int maxpixels;
  83. boolean noMaxRestriction;
  84. int minpixels;
  85. int snapoffsetx, snapoffsety;
  86. int SNAP;
  87. RECT sizerRect;
  88. AutoSkinBitmap h_bitmap, v_bitmap, h_grabber, v_grabber, ws_bitmap;
  89. int resizing;
  90. };
  91. #define PULLBAR_FULL 65536L
  92. #define PULLBAR_HALF (PULLBAR_FULL/2)
  93. #define PULLBAR_QUARTER (PULLBAR_FULL/4)
  94. #define PULLBAR_THREEQUARTER (PULLBAR_FULL-PULLBAR_QUARTER)
  95. #define PULLBAR_EIGHTH (PULLBAR_FULL/8)
  96. #endif