GuiP.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. #ifndef _GuiP_h_
  2. #define _GuiP_h_
  3. /* GuiP.h
  4. *
  5. * Copyright (C) 1993-2013,2015-2017 Paul Boersma
  6. *
  7. * This code is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * This code is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #include "Gui.h"
  21. void _GuiObject_position (GuiObject me, int left, int right, int top, int bottom, GuiForm parent);
  22. void * _GuiObject_getUserData (GuiObject me);
  23. void _GuiObject_setUserData (GuiObject me, void *userData);
  24. class GuiControlBlockValueChangedCallbacks {
  25. private:
  26. GuiControl d_control;
  27. public:
  28. GuiControlBlockValueChangedCallbacks (GuiControl control) : d_control (control) {
  29. d_control -> d_blockValueChangedCallbacks = true;
  30. }
  31. ~GuiControlBlockValueChangedCallbacks () {
  32. d_control -> d_blockValueChangedCallbacks = false;
  33. }
  34. };
  35. #if gtk
  36. void GuiGtk_initialize ();
  37. #elif motif
  38. #include <windows.h>
  39. #include <commctrl.h>
  40. #define MEMBER(widget,klas) ((widget -> widgetClass & xm##klas##WidgetClass) != 0)
  41. #define MEMBER2(widget,klas1,klas2) ((widget -> widgetClass & (xm##klas1##WidgetClass | xm##klas2##WidgetClass)) != 0)
  42. #define MEMBER3(widget,klas1,klas2,klas3) ((widget -> widgetClass & (xm##klas1##WidgetClass | xm##klas2##WidgetClass | xm##klas3##WidgetClass)) != 0)
  43. #define MEMBER4(widget,klas1,klas2,klas3,klas4) ((widget -> widgetClass & (xm##klas1##WidgetClass | xm##klas2##WidgetClass | xm##klas3##WidgetClass | xm##klas4##WidgetClass)) != 0)
  44. #define MEMBER5(widget,klas1,klas2,klas3,klas4,klas5) ((widget -> widgetClass & (xm##klas1##WidgetClass | xm##klas2##WidgetClass | xm##klas3##WidgetClass | xm##klas4##WidgetClass | xm##klas5##WidgetClass)) != 0)
  45. #define MAXNUM_CALLBACKS 3 /* E.g., maximum number of activate callbacks for a PushButton. */
  46. typedef struct {
  47. struct { XtCallbackProc proc; XtPointer closure; } pairs [MAXNUM_CALLBACKS];
  48. } XtCallbackList;
  49. class structGuiObject {
  50. public:
  51. integer magicNumber;
  52. uinteger widgetClass;
  53. GuiObject parent, previousSibling, nextSibling, firstChild;
  54. autostring32 name;
  55. bool inMenu, nativized, managed, insensitive;
  56. GuiObject textFocus; /* For shells. */
  57. GuiObject shell; /* My shell ancestor. */
  58. /* Native. */
  59. HWND window;
  60. union {
  61. /* XtShell: */
  62. struct { GuiObject menuBar; int uniqueItemID, duringMoveWindow; } shell;
  63. /* XmPushButton (if in menu), XmToggleButton (if in menu), XmCascadeButton (if in menu): */
  64. struct { HMENU handle; ULONG_PTR id; } entry;
  65. /* XmMenuBar, XmPulldownMenu: */
  66. struct { HMENU handle; ULONG_PTR id; } menu;
  67. } nat;
  68. /* Motif */
  69. union {
  70. struct { GuiObject horizontalBar, verticalBar, clipWindow, workWindow; } scrolledWindow;
  71. struct { XtCallbackList moveCallbacks; } drawingArea;
  72. struct { bool active, isDialog, canFullScreen;
  73. uinteger lowAccelerators [8]; XtCallbackProc goAwayCallback; XtPointer goAwayClosure; } shell;
  74. struct { unsigned char acceleratorChar; int acceleratorModifiers; } pushButton;
  75. struct { int inBar; } cascadeButton;
  76. struct { unsigned char acceleratorChar; int acceleratorModifiers; XtCallbackList valueChangedCallbacks; } toggleButton;
  77. struct { XtCallbackList valueChangedCallbacks, dragCallbacks; } scrollBar;
  78. } motiff;
  79. /* Resources. */
  80. int x, y, width, height;
  81. bool isRadioButton; /* For radio buttons and check buttons. */
  82. int radioBehavior, rowColumnType; /* For row-columns. */
  83. int orientation; /* For row-columns and scroll bars. */
  84. GuiObject defaultButton, cancelButton; /* For forms and shells. */
  85. int dialogStyle; /* For forms and shells. */
  86. GuiObject messageText; /* For message boxes. */
  87. bool autoUnmanage; /* For bulletin boards. */
  88. GuiObject subMenuId, popUpButton; /* For cascade buttons and their menus. */
  89. integer increment, pageIncrement, sliderSize; /* For scroll bars. */
  90. integer minimum, maximum, value; /* For scales and scroll bars. */
  91. XtCallbackProc activateCallback, destroyCallback;
  92. XtPointer activateClosure, destroyClosure;
  93. int leftAttachment, rightAttachment, topAttachment, bottomAttachment;
  94. int leftOffset, rightOffset, topOffset, bottomOffset;
  95. int leftPosition, rightPosition, topPosition, bottomPosition;
  96. int deleteResponse; /* For shells. */
  97. void *userData;
  98. };
  99. extern struct Gui {
  100. GuiObject textFocus;
  101. bool duringUpdate;
  102. HINSTANCE instance; // first argument of WinMain
  103. int commandShow; // another argument of WinMain
  104. } theGui;
  105. void _Gui_callCallbacks (GuiObject w, XtCallbackList *callbacks, XtPointer call);
  106. char32 * _GuiWin_getDrawingAreaClassName (void);
  107. GuiObject _Gui_initializeWidget (int widgetClass, GuiObject parent, conststring32 name);
  108. void _Gui_invalidateWidget (GuiObject me);
  109. void _Gui_validateWidget (GuiObject me);
  110. void _Gui_manageScrolledWindow (GuiObject me);
  111. void _GuiNativeControl_check (GuiObject me, Boolean value);
  112. void _GuiNativeControl_destroy (GuiObject me);
  113. void _GuiNativeControl_setTitle (GuiObject me);
  114. void _GuiNativeControl_show (GuiObject me);
  115. void _GuiNativeControl_hide (GuiObject me);
  116. void _GuiNativeControl_setSensitive (GuiObject me);
  117. char32 * _GuiWin_expandAmpersands (conststring32 title);
  118. /********** GuiButton.cpp **********/
  119. void _GuiWinButton_destroy (GuiObject widget);
  120. void _GuiWinButton_handleClick (GuiObject widget);
  121. bool _GuiWinButton_tryToHandleShortcutKey (GuiObject widget);
  122. /********** GuiCheckButton.cpp **********/
  123. void _GuiWinCheckButton_destroy (GuiObject widget);
  124. void _GuiWinCheckButton_handleClick (GuiObject widget);
  125. /********** GuiDrawingArea.cpp **********/
  126. void _GuiWinDrawingArea_destroy (GuiObject widget);
  127. void _GuiWinDrawingArea_update (GuiObject widget);
  128. void _GuiWinDrawingArea_handleClick (GuiObject widget, int x, int y);
  129. void _GuiWinDrawingArea_handleKey (GuiObject widget, TCHAR kar);
  130. void _GuiWinDrawingArea_shellResize (GuiObject widget);
  131. /********** GuiLabel.cpp **********/
  132. void _GuiWinLabel_destroy (GuiObject widget);
  133. /********** GuiList.cpp **********/
  134. void _GuiWinList_destroy (GuiObject widget);
  135. void _GuiWinList_map (GuiObject widget);
  136. void _GuiWinList_destroy (GuiObject widget);
  137. void _GuiWinList_handleClick (GuiObject widget);
  138. /********** GuiRadioButton.cpp **********/
  139. void _GuiWinRadioButton_destroy (GuiObject widget);
  140. void _GuiWinRadioButton_handleClick (GuiObject widget);
  141. /********** GuiScale.cpp **********/
  142. void _GuiWinScale_destroy (GuiObject widget);
  143. /********** GuiScrollBar.cpp **********/
  144. void _GuiWinScrollBar_destroy (GuiObject widget);
  145. /********** GuiScrolledWindow.cpp **********/
  146. void _GuiWinScrolledWindow_destroy (GuiObject widget);
  147. /********** GuiText.cpp **********/
  148. void _GuiWinText_destroy (GuiObject widget);
  149. void _GuiWinText_map (GuiObject widget);
  150. void _GuiText_handleFocusReception (GuiObject widget);
  151. void _GuiText_handleFocusLoss (GuiObject widget);
  152. void _GuiText_setTheTextFocus (GuiObject widget);
  153. void _GuiText_handleValueChanged (GuiObject widget);
  154. void _GuiText_unmanage (GuiObject widget);
  155. void _GuiText_init ();
  156. void _GuiText_exit ();
  157. #endif
  158. /* End of file GuiP.h */
  159. #endif