gtkmenu.inc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. // included by gtk2.pas
  2. {$IFDEF read_forward_definitions}
  3. PGtkMenu = ^TGtkMenu;
  4. {$ENDIF read_forward_definitions}
  5. //------------------------------------------------------------------------------
  6. {$IFDEF read_interface_types}
  7. TGtkMenuPositionFunc = procedure (menu:PGtkMenu; x:Pgint; y:Pgint; push_in:Pgboolean; user_data:gpointer); cdecl;
  8. TGtkMenuDetachFunc = procedure (attach_widget:PGtkWidget; menu:PGtkMenu); cdecl;
  9. { Do _not_ touch these widgets directly. We hide the reference
  10. count from the toplevel to the menu, so it must be restored
  11. before operating on these widgets
  12. }
  13. { When a submenu of this menu is popped up, motion in this
  14. region is ignored
  15. }
  16. { The tearoff is active when it is torn off and the not-torn-off
  17. menu is not popped up.
  18. }
  19. TGtkMenu = record
  20. menu_shell : TGtkMenuShell;
  21. parent_menu_item : PGtkWidget;
  22. old_active_menu_item : PGtkWidget;
  23. accel_group : PGtkAccelGroup;
  24. accel_path : Pgchar;
  25. position_func : TGtkMenuPositionFunc;
  26. position_func_data : gpointer;
  27. toggle_size : guint;
  28. toplevel : PGtkWidget;
  29. tearoff_window : PGtkWidget;
  30. tearoff_hbox : PGtkWidget;
  31. tearoff_scrollbar : PGtkWidget;
  32. tearoff_adjustment : PGtkAdjustment;
  33. view_window : PGdkWindow;
  34. bin_window : PGdkWindow;
  35. scroll_offset : gint;
  36. saved_scroll_offset : gint;
  37. scroll_step : gint;
  38. timeout_id : guint;
  39. navigation_region : PGdkRegion;
  40. navigation_timeout : guint;
  41. flag0 : word;
  42. end;
  43. { Padding for future expansion }
  44. PGtkMenuClass = ^TGtkMenuClass;
  45. TGtkMenuClass = record
  46. parent_class : TGtkMenuShellClass;
  47. _gtk_reserved1 : procedure ; cdecl;
  48. _gtk_reserved2 : procedure ; cdecl;
  49. _gtk_reserved3 : procedure ; cdecl;
  50. _gtk_reserved4 : procedure ; cdecl;
  51. end;
  52. {$ENDIF read_interface_types}
  53. //------------------------------------------------------------------------------
  54. {$IFDEF read_interface_rest}
  55. const
  56. bm_TGtkMenu_needs_destruction_ref_count = $1;
  57. bp_TGtkMenu_needs_destruction_ref_count = 0;
  58. bm_TGtkMenu_torn_off = $2;
  59. bp_TGtkMenu_torn_off = 1;
  60. bm_TGtkMenu_tearoff_active = $4;
  61. bp_TGtkMenu_tearoff_active = 2;
  62. bm_TGtkMenu_scroll_fast = $8;
  63. bp_TGtkMenu_scroll_fast = 3;
  64. bm_TGtkMenu_upper_arrow_visible = $10;
  65. bp_TGtkMenu_upper_arrow_visible = 4;
  66. bm_TGtkMenu_lower_arrow_visible = $20;
  67. bp_TGtkMenu_lower_arrow_visible = 5;
  68. bm_TGtkMenu_upper_arrow_prelight = $40;
  69. bp_TGtkMenu_upper_arrow_prelight = 6;
  70. bm_TGtkMenu_lower_arrow_prelight = $80;
  71. bp_TGtkMenu_lower_arrow_prelight = 7;
  72. function GTK_TYPE_MENU : GType;
  73. function GTK_MENU(obj: pointer) : PGtkMenu;
  74. function GTK_MENU_CLASS(klass: pointer) : PGtkMenuClass;
  75. function GTK_IS_MENU(obj: pointer) : boolean;
  76. function GTK_IS_MENU_CLASS(klass: pointer) : boolean;
  77. function GTK_MENU_GET_CLASS(obj: pointer) : PGtkMenuClass;
  78. function needs_destruction_ref_count(var a : TGtkMenu) : guint;
  79. procedure set_needs_destruction_ref_count(var a : TGtkMenu; __needs_destruction_ref_count : guint);
  80. function torn_off(var a : TGtkMenu) : guint; overload;
  81. procedure set_torn_off(var a : TGtkMenu; __torn_off : guint); overload;
  82. function tearoff_active(var a : TGtkMenu) : guint;
  83. procedure set_tearoff_active(var a : TGtkMenu; __tearoff_active : guint);
  84. function scroll_fast(var a : TGtkMenu) : guint;
  85. procedure set_scroll_fast(var a : TGtkMenu; __scroll_fast : guint);
  86. function upper_arrow_visible(var a : TGtkMenu) : guint;
  87. procedure set_upper_arrow_visible(var a : TGtkMenu; __upper_arrow_visible : guint);
  88. function lower_arrow_visible(var a : TGtkMenu) : guint;
  89. procedure set_lower_arrow_visible(var a : TGtkMenu; __lower_arrow_visible : guint);
  90. function upper_arrow_prelight(var a : TGtkMenu) : guint;
  91. procedure set_upper_arrow_prelight(var a : TGtkMenu; __upper_arrow_prelight : guint);
  92. function lower_arrow_prelight(var a : TGtkMenu) : guint;
  93. procedure set_lower_arrow_prelight(var a : TGtkMenu; __lower_arrow_prelight : guint);
  94. function gtk_menu_get_type:TGtkType; cdecl; external gtklib;
  95. function gtk_menu_new:PGtkWidget; cdecl; external gtklib;
  96. { Display the menu onscreen }
  97. procedure gtk_menu_popup(menu:PGtkMenu; parent_menu_shell:PGtkWidget; parent_menu_item:PGtkWidget; func:TGtkMenuPositionFunc; data:gpointer;
  98. button:guint; activate_time:guint32); cdecl; external gtklib;
  99. { Position the menu according to its position function. Called
  100. from gtkmenuitem.c when a menu-item changes its allocation
  101. }
  102. procedure gtk_menu_reposition(menu:PGtkMenu); cdecl; external gtklib;
  103. procedure gtk_menu_popdown(menu:PGtkMenu); cdecl; external gtklib;
  104. { Keep track of the last menu item selected. (For the purposes
  105. of the option menu
  106. }
  107. function gtk_menu_get_active(menu:PGtkMenu):PGtkWidget; cdecl; external gtklib;
  108. procedure gtk_menu_set_active(menu:PGtkMenu; index:guint); cdecl; external gtklib;
  109. { set/get the accelerator group that holds global accelerators (should
  110. be added to the corresponding toplevel with gtk_window_add_accel_group().
  111. }
  112. procedure gtk_menu_set_accel_group(menu:PGtkMenu; accel_group:PGtkAccelGroup); cdecl; external gtklib;
  113. function gtk_menu_get_accel_group(menu:PGtkMenu):PGtkAccelGroup; cdecl; external gtklib;
  114. procedure gtk_menu_set_accel_path(menu:PGtkMenu; accel_path:Pgchar); cdecl; external gtklib;
  115. { A reference count is kept for a widget when it is attached to
  116. a particular widget. This is typically a menu item; it may also
  117. be a widget with a popup menu - for instance, the Notebook widget.
  118. }
  119. procedure gtk_menu_attach_to_widget(menu:PGtkMenu; attach_widget:PGtkWidget; detacher:TGtkMenuDetachFunc); cdecl; external gtklib;
  120. procedure gtk_menu_detach(menu:PGtkMenu); cdecl; external gtklib;
  121. { This should be dumped in favor of data set when the menu is popped
  122. up - that is currently in the ItemFactory code, but should be
  123. in the Menu code.
  124. }
  125. function gtk_menu_get_attach_widget(menu:PGtkMenu):PGtkWidget; cdecl; external gtklib;
  126. procedure gtk_menu_set_tearoff_state(menu:PGtkMenu; torn_off:gboolean); cdecl; external gtklib;
  127. function gtk_menu_get_tearoff_state(menu:PGtkMenu):gboolean; cdecl; external gtklib;
  128. { This sets the window manager title for the window that
  129. appears when a menu is torn off
  130. }
  131. procedure gtk_menu_set_title(menu:PGtkMenu; title:Pgchar); cdecl; external gtklib;
  132. function gtk_menu_get_title(menu:PGtkMenu):Pgchar; cdecl; external gtklib;
  133. procedure gtk_menu_reorder_child(menu:PGtkMenu; child:PGtkWidget; position:gint); cdecl; external gtklib;
  134. procedure gtk_menu_set_screen(menu:PGtkMenu; screen:PGdkScreen); cdecl; external gtklib;
  135. {$ifndef GTK_DISABLE_DEPRECATED}
  136. procedure gtk_menu_append(menu,child : PGtkWidget);
  137. procedure gtk_menu_prepend(menu,child : PGtkWidget);
  138. procedure gtk_menu_insert(menu,child: PGtkWidget; pos : gint);
  139. {$endif}
  140. { GTK_DISABLE_DEPRECATED }
  141. {$ENDIF read_interface_rest}
  142. //------------------------------------------------------------------------------
  143. {$IFDEF read_implementation}
  144. function GTK_TYPE_MENU : GType;
  145. begin
  146. GTK_TYPE_MENU:=gtk_menu_get_type;
  147. end;
  148. function GTK_MENU(obj: pointer) : PGtkMenu;
  149. begin
  150. GTK_MENU:=PGtkMenu(GTK_CHECK_CAST(obj,GTK_TYPE_MENU));
  151. end;
  152. function GTK_MENU_CLASS(klass: pointer) : PGtkMenuClass;
  153. begin
  154. GTK_MENU_CLASS:=PGtkMenuClass(GTK_CHECK_CLASS_CAST(klass,GTK_TYPE_MENU));
  155. end;
  156. function GTK_IS_MENU(obj: pointer) : boolean;
  157. begin
  158. GTK_IS_MENU:=GTK_CHECK_TYPE(obj,GTK_TYPE_MENU);
  159. end;
  160. function GTK_IS_MENU_CLASS(klass: pointer) : boolean;
  161. begin
  162. GTK_IS_MENU_CLASS:=GTK_CHECK_CLASS_TYPE(klass,GTK_TYPE_MENU);
  163. end;
  164. function GTK_MENU_GET_CLASS(obj: pointer) : PGtkMenuClass;
  165. begin
  166. GTK_MENU_GET_CLASS:=PGtkMenuClass(GTK_CHECK_GET_CLASS(obj,GTK_TYPE_MENU));
  167. end;
  168. function needs_destruction_ref_count(var a : TGtkMenu) : guint;
  169. begin
  170. needs_destruction_ref_count:=(a.flag0 and bm_TGtkMenu_needs_destruction_ref_count) shr bp_TGtkMenu_needs_destruction_ref_count;
  171. end;
  172. procedure set_needs_destruction_ref_count(var a : TGtkMenu; __needs_destruction_ref_count : guint);
  173. begin
  174. a.flag0:=a.flag0 or ((__needs_destruction_ref_count shl bp_TGtkMenu_needs_destruction_ref_count) and bm_TGtkMenu_needs_destruction_ref_count);
  175. end;
  176. function torn_off(var a : TGtkMenu) : guint;
  177. begin
  178. torn_off:=(a.flag0 and bm_TGtkMenu_torn_off) shr bp_TGtkMenu_torn_off;
  179. end;
  180. procedure set_torn_off(var a : TGtkMenu; __torn_off : guint);
  181. begin
  182. a.flag0:=a.flag0 or ((__torn_off shl bp_TGtkMenu_torn_off) and bm_TGtkMenu_torn_off);
  183. end;
  184. function tearoff_active(var a : TGtkMenu) : guint;
  185. begin
  186. tearoff_active:=(a.flag0 and bm_TGtkMenu_tearoff_active) shr bp_TGtkMenu_tearoff_active;
  187. end;
  188. procedure set_tearoff_active(var a : TGtkMenu; __tearoff_active : guint);
  189. begin
  190. a.flag0:=a.flag0 or ((__tearoff_active shl bp_TGtkMenu_tearoff_active) and bm_TGtkMenu_tearoff_active);
  191. end;
  192. function scroll_fast(var a : TGtkMenu) : guint;
  193. begin
  194. scroll_fast:=(a.flag0 and bm_TGtkMenu_scroll_fast) shr bp_TGtkMenu_scroll_fast;
  195. end;
  196. procedure set_scroll_fast(var a : TGtkMenu; __scroll_fast : guint);
  197. begin
  198. a.flag0:=a.flag0 or ((__scroll_fast shl bp_TGtkMenu_scroll_fast) and bm_TGtkMenu_scroll_fast);
  199. end;
  200. function upper_arrow_visible(var a : TGtkMenu) : guint;
  201. begin
  202. upper_arrow_visible:=(a.flag0 and bm_TGtkMenu_upper_arrow_visible) shr bp_TGtkMenu_upper_arrow_visible;
  203. end;
  204. procedure set_upper_arrow_visible(var a : TGtkMenu; __upper_arrow_visible : guint);
  205. begin
  206. a.flag0:=a.flag0 or ((__upper_arrow_visible shl bp_TGtkMenu_upper_arrow_visible) and bm_TGtkMenu_upper_arrow_visible);
  207. end;
  208. function lower_arrow_visible(var a : TGtkMenu) : guint;
  209. begin
  210. lower_arrow_visible:=(a.flag0 and bm_TGtkMenu_lower_arrow_visible) shr bp_TGtkMenu_lower_arrow_visible;
  211. end;
  212. procedure set_lower_arrow_visible(var a : TGtkMenu; __lower_arrow_visible : guint);
  213. begin
  214. a.flag0:=a.flag0 or ((__lower_arrow_visible shl bp_TGtkMenu_lower_arrow_visible) and bm_TGtkMenu_lower_arrow_visible);
  215. end;
  216. function upper_arrow_prelight(var a : TGtkMenu) : guint;
  217. begin
  218. upper_arrow_prelight:=(a.flag0 and bm_TGtkMenu_upper_arrow_prelight) shr bp_TGtkMenu_upper_arrow_prelight;
  219. end;
  220. procedure set_upper_arrow_prelight(var a : TGtkMenu; __upper_arrow_prelight : guint);
  221. begin
  222. a.flag0:=a.flag0 or ((__upper_arrow_prelight shl bp_TGtkMenu_upper_arrow_prelight) and bm_TGtkMenu_upper_arrow_prelight);
  223. end;
  224. function lower_arrow_prelight(var a : TGtkMenu) : guint;
  225. begin
  226. lower_arrow_prelight:=(a.flag0 and bm_TGtkMenu_lower_arrow_prelight) shr bp_TGtkMenu_lower_arrow_prelight;
  227. end;
  228. procedure set_lower_arrow_prelight(var a : TGtkMenu; __lower_arrow_prelight : guint);
  229. begin
  230. a.flag0:=a.flag0 or ((__lower_arrow_prelight shl bp_TGtkMenu_lower_arrow_prelight) and bm_TGtkMenu_lower_arrow_prelight);
  231. end;
  232. procedure gtk_menu_append(menu,child : PGtkWidget);
  233. begin
  234. gtk_menu_shell_append(PGtkMenuShell(menu),child);
  235. end;
  236. procedure gtk_menu_prepend(menu,child : PGtkWidget);
  237. begin
  238. gtk_menu_shell_prepend(PGtkMenuShell(menu),child);
  239. end;
  240. procedure gtk_menu_insert(menu,child: PGtkWidget; pos : gint);
  241. begin
  242. gtk_menu_shell_insert(PGtkMenuShell(menu),child,pos);
  243. end;
  244. {$ENDIF read_implementation}
  245. // included by gtk2.pas