PageRenderTime 67ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gtk/library/gtk_main.e

http://github.com/tybor/Liberty
Specman e | 1262 lines | 412 code | 114 blank | 736 comment | 3 complexity | 0fd995ce5b8357ce74e183d89cddb4c2 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1, GPL-2.0
  1. indexing
  2. description: "Main loop and Events - Library initialization, main event loop, and events"
  3. copyright: "[
  4. Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. date: "$Date:$"
  19. revision "$REvision:$"
  20. class GTK_MAIN
  21. inherit
  22. ANY redefine default_create end
  23. WRAPPER_HANDLER redefine default_create end
  24. insert
  25. SHARED_CREATION_DICTIONARY redefine default_create end
  26. GDK
  27. PANGO
  28. ARGUMENTS redefine default_create end
  29. GTK_MAIN_EXTERNALS redefine default_create end
  30. POINTER_HANDLING redefine default_create end
  31. creation default_create
  32. feature -- Creation
  33. default_create is
  34. do
  35. create error.empty
  36. initialize
  37. store_creation_agents
  38. end
  39. feature -- Creation agents
  40. -- Creation agents are functions that given a pointer returns an
  41. -- Eiffel wrapper of a precise kind. They are usually stored into
  42. store_creation_agents is
  43. local old_count: INTEGER
  44. do
  45. debug
  46. std_error.put_string(once "Putting wrapper-creation-agents into creation_agents dictionary%N")
  47. old_count := creation_agents.count
  48. end
  49. creation_agents.put (agent create_gtk_about_dialog, "GtkAboutDialog")
  50. --creation_agents.put (agent create_gtk_accel_group, "GtkAccelGroup")
  51. creation_agents.put (agent create_gtk_accel_label, "GtkAccelLabel")
  52. -- creation_agents.put (agent create_gtk_accel_map, "GtkAccelMap")
  53. -- creation_agents.put (agent create_gtk_accessible, "GtkAccessible")
  54. creation_agents.put (agent create_gtk_action, "GtkAction")
  55. creation_agents.put (agent create_gtk_action_group, "GtkActionGroup")
  56. creation_agents.put (agent create_gtk_alignment, "GtkAlignment")
  57. creation_agents.put (agent create_gtk_arrow, "GtkArrow")
  58. -- creation_agents.put (agent create_gtk_aspect_frame, "GtkAspectFrame")
  59. -- creation_agents.put (agent create_gtk_assistant, "GtkAssistant")
  60. creation_agents.put (agent create_gtk_button, "GtkButton")
  61. creation_agents.put (agent create_gtk_calendar, "GtkCalendar")
  62. creation_agents.put (agent create_gtk_cell_renderer_accel, "GtkCellRendererAccel")
  63. creation_agents.put (agent create_gtk_cell_renderer_combo, "GtkCellRendererCombo")
  64. creation_agents.put (agent create_gtk_cell_renderer_pixbuf, "GtkCellRendererPixbuf")
  65. creation_agents.put (agent create_gtk_cell_renderer_progress, "GtkCellRendererProgress")
  66. creation_agents.put (agent create_gtk_cell_renderer_spin, "GtkCellRendererSpin")
  67. creation_agents.put (agent create_gtk_cell_renderer_text, "GtkCellRendererText")
  68. creation_agents.put (agent create_gtk_cell_renderer_toggle, "GtkCellRendererToggle")
  69. creation_agents.put (agent create_gtk_cell_view, "GtkCellView")
  70. creation_agents.put (agent create_gtk_check_button, "GtkCheckButton")
  71. creation_agents.put (agent create_gtk_check_menu_item, "GtkCheckMenuItem")
  72. creation_agents.put (agent create_gtk_clipboard, "GtkClipboard")
  73. creation_agents.put (agent create_gtk_color_button, "GtkColorButton")
  74. creation_agents.put (agent create_gtk_color_selection, "GtkColorSelection")
  75. creation_agents.put (agent create_gtk_color_selection_dialog, "GtkColorSelectionDialog")
  76. -- GtkCombo is deprecated
  77. creation_agents.put (agent create_gtk_combo_box, "GtkComboBox")
  78. creation_agents.put (agent create_gtk_combo_box_entry, "GtkComboBoxEntry")
  79. -- creation_agents.put (agent create_gtk_Curve, "GtkCurve")
  80. creation_agents.put (agent create_gtk_dialog, "GtkDialog")
  81. creation_agents.put (agent create_gtk_drawing_area, "GtkDrawingArea")
  82. creation_agents.put (agent create_gtk_entry, "GtkEntry")
  83. creation_agents.put (agent create_gtk_entry_completion, "GtkEntryCompletion")
  84. creation_agents.put (agent create_gtk_event_box, "GtkEventBox")
  85. creation_agents.put (agent create_gtk_expander, "GtkExpander")
  86. creation_agents.put (agent create_gtk_file_chooser_button, "GtkFileChooserButton")
  87. creation_agents.put (agent create_gtk_file_chooser_dialog, "GtkFileChooserDialog")
  88. creation_agents.put (agent create_gtk_file_chooser_widget, "GtkFileChooserWidget")
  89. creation_agents.put (agent create_gtk_file_filter, "GtkFileFilter")
  90. -- GtkFileSelection is deprecated
  91. -- creation_agents.put (agent create_gtk_Fixed, "GtkFixed")
  92. creation_agents.put (agent create_gtk_font_button, "GtkFontButton")
  93. creation_agents.put (agent create_gtk_font_selection, "GtkFontSelection")
  94. creation_agents.put (agent create_gtk_font_selection_dialog, "GtkFontSelectionDialog")
  95. creation_agents.put (agent create_gtk_frame, "GtkFrame")
  96. --creation_agents.put (agent create_gtk_GammaCurve, "GtkGammaCurve")
  97. creation_agents.put (agent create_gtk_hbox, "GtkHBox")
  98. creation_agents.put (agent create_gtk_hbutton_box, "GtkHButtonBox")
  99. creation_agents.put (agent create_gtk_hpaned, "GtkHPaned")
  100. --creation_agents.put (agent create_gtk_hruler, "GtkHRuler")
  101. creation_agents.put (agent create_gtk_hscale, "GtkHScale")
  102. creation_agents.put (agent create_gtk_hscrollbar, "GtkHScrollbar")
  103. creation_agents.put (agent create_gtk_hseparator, "GtkHSeparator")
  104. --creation_agents.put (agent create_gtk_handle_box, "GtkHandleBox")
  105. --creation_agents.put (agent create_gtkIM_Context, "GtkIMContext")
  106. --creation_agents.put (agent create_gtkIM_ContextSimple, "GtkIMContextSimple")
  107. --creation_agents.put (agent create_gtkIM_Multicontext, "GtkIMMulticontext")
  108. -- creation_agents.put (agent create_gtk_iconf_actory, "GtkIconFactory")
  109. creation_agents.put (agent create_gtk_icon_theme, "GtkIconTheme")
  110. creation_agents.put (agent create_gtk_icon_view, "GtkIconView")
  111. creation_agents.put (agent create_gtk_image, "GtkImage")
  112. creation_agents.put (agent create_gtk_image_menu_item, "GtkImageMenuItem")
  113. -- creation_agents.put (agent create_gtk_Invisible, "GtkInvisible")
  114. creation_agents.put (agent create_gtk_label, "GtkLabel")
  115. creation_agents.put (agent create_gtk_layout, "GtkLayout")
  116. creation_agents.put (agent create_gtk_link_button, "GtkLinkButton")
  117. creation_agents.put (agent create_gtk_list_store, "GtkListStore")
  118. creation_agents.put (agent create_gtk_menu, "GtkMenu")
  119. creation_agents.put (agent create_gtk_menu_bar, "GtkMenuBar")
  120. creation_agents.put (agent create_gtk_menu_item, "GtkMenuItem")
  121. creation_agents.put (agent create_gtk_menu_tool_button, "GtkMenuToolButton")
  122. creation_agents.put (agent create_gtk_message_dialog, "GtkMessageDialog")
  123. creation_agents.put (agent create_gtk_notebook, "GtkNotebook")
  124. creation_agents.put (agent create_gtk_page_setup, "GtkPageSetup")
  125. -- creation_agents.put (agent create_gtk_PageSetupUnixDialog, "GtkPageSetupUnixDialog")
  126. -- creation_agents.put (agent create_gtk_plug, "GtkPlug")
  127. -- creation_agents.put (agent create_gtk_preview, "GtkPreview")
  128. -- creation_agents.put (agent create_gtk_PrintBackend, "GtkPrintBackend")
  129. creation_agents.put (agent create_gtk_print_context, "GtkPrintContext")
  130. creation_agents.put (agent create_gtk_print_job, "GtkPrintJob")
  131. creation_agents.put (agent create_gtk_print_operation, "GtkPrintOperation")
  132. creation_agents.put (agent create_gtk_print_settings, "GtkPrintSettings")
  133. -- creation_agents.put (agent create_gtk_PrintUnixDialog, "GtkPrintUnixDialog")
  134. creation_agents.put (agent create_gtk_printer, "GtkPrinter")
  135. creation_agents.put (agent create_gtk_progress_bar, "GtkProgressBar")
  136. creation_agents.put (agent create_gtk_radio_action, "GtkRadioAction")
  137. creation_agents.put (agent create_gtk_radio_button, "GtkRadioButton")
  138. creation_agents.put (agent create_gtk_radio_menu_item, "GtkRadioMenuItem")
  139. creation_agents.put (agent create_gtk_radio_tool_button, "GtkRadioToolButton")
  140. --creation_agents.put (agent create_gtk_RcStyle, "GtkRcStyle")
  141. --creation_agents.put (agent create_gtk_RecentChooserDialog, "GtkRecentChooserDialog")
  142. --creation_agents.put (agent create_gtk_RecentChooserMenu, "GtkRecentChooserMenu")
  143. --creation_agents.put (agent create_gtk_RecentChooserWidget, "GtkRecentChooserWidget")
  144. --creation_agents.put (agent create_gtk_RecentFilter, "GtkRecentFilter")
  145. --creation_agents.put (agent create_gtk_RecentManager, "GtkRecentManager")
  146. creation_agents.put (agent create_gtk_scrolled_window, "GtkScrolledWindow")
  147. creation_agents.put (agent create_gtk_separator_menu_item, "GtkSeparatorMenuItem")
  148. creation_agents.put (agent create_gtk_separator_tool_item, "GtkSeparatorToolItem")
  149. -- creation_agents.put (agent create_gtk_settings, "GtkSettings")
  150. -- creation_agents.put (agent create_gtk_size_group, "GtkSizeGroup")
  151. -- creation_agents.put (agent create_gtk_socket, "GtkSocket")
  152. creation_agents.put (agent create_gtk_spin_button, "GtkSpinButton")
  153. creation_agents.put (agent create_gtk_status_icon, "GtkStatusIcon")
  154. creation_agents.put (agent create_gtk_status_bar, "GtkStatusbar")
  155. creation_agents.put (agent create_gtk_style, "GtkStyle")
  156. creation_agents.put (agent create_gtk_table, "GtkTable")
  157. creation_agents.put (agent create_gtk_tearoff_menu_item, "GtkTearoffMenuItem")
  158. -- GtkText is deprecated
  159. creation_agents.put (agent create_gtk_text_buffer, "GtkTextBuffer")
  160. creation_agents.put (agent create_gtk_text_child_anchor, "GtkTextChildAnchor")
  161. creation_agents.put (agent create_gtk_text_mark, "GtkTextMark")
  162. creation_agents.put (agent create_gtk_text_tag, "GtkTextTag")
  163. creation_agents.put (agent create_gtk_text_tag_table, "GtkTextTagTable")
  164. creation_agents.put (agent create_gtk_text_view, "GtkTextView")
  165. -- GtkTipsQuery is deprecated
  166. creation_agents.put (agent create_gtk_toggle_action, "GtkToggleAction")
  167. creation_agents.put (agent create_gtk_toggle_button, "GtkToggleButton")
  168. creation_agents.put (agent create_gtk_toggle_tool_button, "GtkToggleToolButton")
  169. creation_agents.put (agent create_gtk_tool_button, "GtkToolButton")
  170. creation_agents.put (agent create_gtk_tool_item, "GtkToolItem")
  171. creation_agents.put (agent create_gtk_toolbar, "GtkToolbar")
  172. creation_agents.put (agent create_gtk_tooltips, "GtkTooltips")
  173. -- GtkTree and GtkTreeItem are deprecated.
  174. creation_agents.put (agent create_gtk_tree_model_filter, "GtkTreeModelFilter")
  175. creation_agents.put (agent create_gtk_tree_model_sort, "GtkTreeModelSort")
  176. creation_agents.put (agent create_gtk_tree_selection, "GtkTreeSelection")
  177. creation_agents.put (agent create_gtk_tree_store, "GtkTreeStore")
  178. creation_agents.put (agent create_gtk_tree_view, "GtkTreeView")
  179. creation_agents.put (agent create_gtk_tree_view_column, "GtkTreeViewColumn")
  180. -- creation_agents.put (agent create_gtkUI_Manager, "GtkUIManager")
  181. creation_agents.put (agent create_gtk_vbox, "GtkVBox")
  182. creation_agents.put (agent create_gtk_vbutton_box, "GtkVButtonBox")
  183. creation_agents.put (agent create_gtk_vpaned, "GtkVPaned")
  184. -- creation_agents.put (agent create_gtk_vruler, "GtkVRuler")
  185. creation_agents.put (agent create_gtk_vscale, "GtkVScale")
  186. creation_agents.put (agent create_gtk_vscrollbar, "GtkVScrollbar")
  187. creation_agents.put (agent create_gtk_vseparator, "GtkVSeparator")
  188. -- creation_agents.put (agent create_gtk_Viewport, "GtkViewport")
  189. creation_agents.put (agent create_gtk_window, "GtkWindow")
  190. creation_agents.put (agent create_gtk_window_group, "GtkWindowGroup")
  191. -- Store creation agents of preconditions
  192. store_gdk_creation_agents
  193. store_pango_creation_agents
  194. debug
  195. std_error.put_line
  196. ((creation_agents.count-old_count).out+" function agents put into creation_agents dictionary.")
  197. end
  198. end
  199. create_gtk_about_dialog (p: POINTER): GTK_ABOUT_DIALOG is do create Result.from_external_pointer(p) end
  200. -- create_gtk_accel_group (p: POINTER): GTK_ACCEL_GROUP is do create Result.from_external_pointer(p) end
  201. create_gtk_accel_label (p: POINTER): GTK_ACCEL_LABEL is do create Result.from_external_pointer(p) end
  202. -- create_gtk_accel_map (p: POINTER): Gtk_AccelMap is do create Result.from_external_pointer(p) end
  203. -- create_gtk_accessible (p: POINTER): GTK_ACCESSIBLE is do create Result.from_external_pointer(p) end
  204. create_gtk_action (p: POINTER): GTK_ACTION is do create Result.from_external_pointer(p) end
  205. create_gtk_action_group (p: POINTER): GTK_ACTION_GROUP is do create Result.from_external_pointer(p) end
  206. create_gtk_adjustment (p: POINTER): GTK_ADJUSTMENT is do create Result.from_external_pointer(p) end
  207. create_gtk_alignment (p: POINTER): GTK_ALIGNMENT is do create Result.from_external_pointer(p) end
  208. create_gtk_arrow (p: POINTER): GTK_ARROW is do create Result.from_external_pointer(p) end
  209. create_gtk_aspect_frame (p: POINTER): GTK_ASPECT_FRAME is do create Result.from_external_pointer(p) end
  210. create_gtk_assistant (p: POINTER): GTK_ASSISTANT is do create Result.from_external_pointer(p) end
  211. create_gtk_button (p: POINTER): GTK_BUTTON is do create Result.from_external_pointer(p) end
  212. create_gtk_calendar (p: POINTER): GTK_CALENDAR is do create Result.from_external_pointer(p) end
  213. create_gtk_cell_renderer_accel (p: POINTER): GTK_CELL_RENDERER_ACCEL is do create Result.from_external_pointer(p) end
  214. create_gtk_cell_renderer_combo (p: POINTER): GTK_CELL_RENDERER_COMBO is do create Result.from_external_pointer(p) end
  215. create_gtk_cell_renderer_pixbuf (p: POINTER): GTK_CELL_RENDERER_PIXBUF is do create Result.from_external_pointer(p) end
  216. create_gtk_cell_renderer_progress (p: POINTER): GTK_CELL_RENDERER_PROGRESS is do create Result.from_external_pointer(p) end
  217. create_gtk_cell_renderer_spin (p: POINTER): GTK_CELL_RENDERER_SPIN is do create Result.from_external_pointer(p) end
  218. create_gtk_cell_renderer_text (p: POINTER): GTK_CELL_RENDERER_TEXT is do create Result.from_external_pointer(p) end
  219. create_gtk_cell_renderer_toggle (p: POINTER): GTK_CELL_RENDERER_TOGGLE is do create Result.from_external_pointer(p) end
  220. create_gtk_cell_view (p: POINTER): GTK_CELL_VIEW is do create Result.from_external_pointer(p) end
  221. create_gtk_check_button (p: POINTER): GTK_CHECK_BUTTON is do create Result.from_external_pointer(p) end
  222. create_gtk_check_menu_item (p: POINTER): GTK_CHECK_MENU_ITEM is do create Result.from_external_pointer(p) end
  223. create_gtk_clipboard (p: POINTER): GTK_CLIPBOARD is do create Result.from_external_pointer(p) end
  224. create_gtk_color_button (p: POINTER): GTK_COLOR_BUTTON is do create Result.from_external_pointer(p) end
  225. create_gtk_color_selection (p: POINTER): GTK_COLOR_SELECTION is do create Result.from_external_pointer(p) end
  226. create_gtk_color_selection_dialog (p: POINTER): GTK_COLOR_SELECTION_DIALOG is do create Result.from_external_pointer(p) end
  227. create_gtk_combo_box (p: POINTER): GTK_COMBO_BOX is do create Result.from_external_pointer(p) end
  228. create_gtk_combo_box_entry (p: POINTER): GTK_COMBO_BOX_ENTRY is do create Result.from_external_pointer(p) end
  229. -- create_gtk_Curve (p: POINTER): Gtk_Curve is do create Result.from_external_pointer(p) end
  230. create_gtk_dialog (p: POINTER): GTK_DIALOG is do create Result.from_external_pointer(p) end
  231. create_gtk_drawing_area (p: POINTER): GTK_DRAWING_AREA is do create Result.from_external_pointer(p) end
  232. create_gtk_entry (p: POINTER): GTK_ENTRY is do create Result.from_external_pointer(p) end
  233. create_gtk_entry_completion (p: POINTER): GTK_ENTRY_COMPLETION is do create Result.from_external_pointer(p) end
  234. create_gtk_event_box (p: POINTER): GTK_EVENT_BOX is do create Result.from_external_pointer(p) end
  235. create_gtk_expander (p: POINTER): GTK_EXPANDER is do create Result.from_external_pointer(p) end
  236. create_gtk_file_chooser_button (p: POINTER): GTK_FILE_CHOOSER_BUTTON is do create Result.from_external_pointer(p) end
  237. create_gtk_file_chooser_dialog (p: POINTER): GTK_FILE_CHOOSER_DIALOG is do create Result.from_external_pointer(p) end
  238. create_gtk_file_chooser_widget (p: POINTER): GTK_FILE_CHOOSER_WIDGET is do create Result.from_external_pointer(p) end
  239. create_gtk_file_filter (p: POINTER): GTK_FILE_FILTER is do create Result.from_external_pointer(p) end
  240. -- create_gtk_Fixed (p: POINTER): Gtk_Fixed is do create Result.from_external_pointer(p) end
  241. create_gtk_font_button (p: POINTER): GTK_FONT_BUTTON is do create Result.from_external_pointer(p) end
  242. create_gtk_font_selection (p: POINTER): GTK_FONT_SELECTION is do create Result.from_external_pointer(p) end
  243. create_gtk_font_selection_dialog (p: POINTER): GTK_FONT_SELECTION_DIALOG is do create Result.from_external_pointer(p) end
  244. create_gtk_frame (p: POINTER): GTK_FRAME is do create Result.from_external_pointer(p) end
  245. --create_gtk_GammaCurve (p: POINTER): Gtk_GammaCurve is do create Result.from_external_pointer(p) end
  246. create_gtk_hbox (p: POINTER): GTK_HBOX is do create Result.from_external_pointer(p) end
  247. create_gtk_hbutton_box (p: POINTER): GTK_HBUTTON_BOX is do create Result.from_external_pointer(p) end
  248. create_gtk_hpaned (p: POINTER): GTK_HPANED is do create Result.from_external_pointer(p) end
  249. --create_gtk_hruler (p: POINTER): GTK_HRULER is do create Result.from_external_pointer(p) end
  250. create_gtk_hscale (p: POINTER): GTK_HSCALE is do create Result.from_external_pointer(p) end
  251. create_gtk_hscrollbar (p: POINTER): GTK_HSCROLLBAR is do create Result.from_external_pointer(p) end
  252. create_gtk_hseparator (p: POINTER): GTK_HSEPARATOR is do create Result.from_external_pointer(p) end
  253. --create_gtk_handle_box (p: POINTER): GTK_HANDLE_BOX is do create Result.from_external_pointer(p) end
  254. --create_gtkIM_Context (p: POINTER): GtkIM_Context is do create Result.from_external_pointer(p) end
  255. --create_gtkIM_ContextSimple (p: POINTER): GtkIM_ContextSimple is do create Result.from_external_pointer(p) end
  256. --create_gtkIM_Multicontext (p: POINTER): GtkIM_Multicontext is do create Result.from_external_pointer(p) end
  257. --create_gtk_IconFactory (p: POINTER): Gtk_IconFactory is do create Result.from_external_pointer(p) end
  258. create_gtk_icon_theme (p: POINTER): GTK_ICON_THEME is do create Result.from_external_pointer(p) end
  259. create_gtk_icon_view (p: POINTER): GTK_ICON_VIEW is do create Result.from_external_pointer(p) end
  260. create_gtk_image (p: POINTER): GTK_IMAGE is do create Result.from_external_pointer(p) end
  261. create_gtk_image_menu_item (p: POINTER): GTK_IMAGE_MENU_ITEM is do create Result.from_external_pointer(p) end
  262. -- create_gtk_Invisible (p: POINTER): Gtk_Invisible is do create Result.from_external_pointer(p) end
  263. create_gtk_label (p: POINTER): GTK_LABEL is do create Result.from_external_pointer(p) end
  264. create_gtk_layout (p: POINTER): GTK_LAYOUT is do create Result.from_external_pointer(p) end
  265. create_gtk_link_button (p: POINTER): GTK_LINK_BUTTON is do create Result.from_external_pointer(p) end
  266. create_gtk_list_store (p: POINTER): GTK_LIST_STORE is do create Result.from_external_pointer(p) end
  267. create_gtk_menu (p: POINTER): GTK_MENU is do create Result.from_external_pointer(p) end
  268. create_gtk_menu_bar (p: POINTER): GTK_MENU_BAR is do create Result.from_external_pointer(p) end
  269. create_gtk_menu_item (p: POINTER): GTK_MENU_ITEM is do create Result.from_external_pointer(p) end
  270. create_gtk_menu_tool_button (p: POINTER): GTK_MENU_TOOL_BUTTON is do create Result.from_external_pointer(p) end
  271. create_gtk_message_dialog (p: POINTER): GTK_MESSAGE_DIALOG is do create Result.from_external_pointer(p) end
  272. create_gtk_notebook (p: POINTER): GTK_NOTEBOOK is do create Result.from_external_pointer(p) end
  273. create_gtk_page_setup (p: POINTER): GTK_PAGE_SETUP is do create Result.from_external_pointer(p) end
  274. -- create_gtk_PageSetupUnixDialog (p: POINTER): Gtk_PageSetupUnixDialog is do create Result.from_external_pointer(p) end
  275. -- create_gtk_Plug (p: POINTER): Gtk_Plug is do create Result.from_external_pointer(p) end
  276. -- create_gtk_preview (p: POINTER): GTK_PREVIEW is do create Result.from_external_pointer(p) end
  277. -- create_gtk_print_backend (p: POINTER): GTK_PRINT_BACKEND is do create Result.from_external_pointer(p) end
  278. create_gtk_print_context (p: POINTER): GTK_PRINT_CONTEXT is do create Result.from_external_pointer(p) end
  279. create_gtk_print_job (p: POINTER): GTK_PRINT_JOB is do create Result.from_external_pointer(p) end
  280. create_gtk_print_operation (p: POINTER): GTK_PRINT_OPERATION is do create Result.from_external_pointer(p) end
  281. create_gtk_print_settings (p: POINTER): GTK_PRINT_SETTINGS is do create Result.from_external_pointer(p) end
  282. --create_gtk_PrintUnixDialog (p: POINTER): Gtk_PrintUnixDialog is do create Result.from_external_pointer(p) end
  283. create_gtk_printer (p: POINTER): GTK_PRINTER is do create Result.from_external_pointer(p) end
  284. create_gtk_progress_bar (p: POINTER): GTK_PROGRESS_BAR is do create Result.from_external_pointer(p) end
  285. create_gtk_radio_action (p: POINTER): GTK_RADIO_ACTION is do create Result.from_external_pointer(p) end
  286. create_gtk_radio_button (p: POINTER): GTK_RADIO_BUTTON is do create Result.from_external_pointer(p) end
  287. create_gtk_radio_menu_item (p: POINTER): GTK_RADIO_MENU_ITEM is
  288. do
  289. debug std_error.put_line(once "Don't ask me why, but SmartEiffel thinks that GTK_RADIO_MENU_ITEM is deferred.") end
  290. create Result.from_external_pointer(p)
  291. end
  292. create_gtk_radio_tool_button (p: POINTER): GTK_RADIO_TOOL_BUTTON is do create Result.from_external_pointer(p) end
  293. -- create_gtk_RcStyle (p: POINTER): Gtk_RcStyle is do create Result.from_external_pointer(p) end
  294. -- create_gtk_RecentChooserDialog (p: POINTER): Gtk_RecentChooserDialog is do create Result.from_external_pointer(p) end
  295. -- create_gtk_RecentChooserMenu (p: POINTER): Gtk_RecentChooserMenu is do create Result.from_external_pointer(p) end
  296. -- create_gtk_RecentChooserWidget (p: POINTER): Gtk_RecentChooserWidget is do create Result.from_external_pointer(p) end
  297. -- create_gtk_RecentFilter (p: POINTER): Gtk_RecentFilter is do create Result.from_external_pointer(p) end
  298. -- create_gtk_RecentManager (p: POINTER): Gtk_RecentManager is do create Result.from_external_pointer(p) end
  299. create_gtk_scrolled_window (p: POINTER): GTK_SCROLLED_WINDOW is do create Result.from_external_pointer(p) end
  300. create_gtk_separator_menu_item (p: POINTER): GTK_SEPARATOR_MENU_ITEM is do create Result.from_external_pointer(p) end
  301. create_gtk_separator_tool_item (p: POINTER): GTK_SEPARATOR_TOOL_ITEM is do create Result.from_external_pointer(p) end
  302. -- create_gtk_settings (p: POINTER): GTK_SETTINGS is do create Result.from_external_pointer(p) end
  303. -- create_gtk_size_group (p: POINTER): GTK_SIZE_GROUP is do create Result.from_external_pointer(p) end
  304. -- create_gtk_socket (p: POINTER): GTK_SOCKET is do create Result.from_external_pointer(p) end
  305. create_gtk_spin_button (p: POINTER): GTK_SPIN_BUTTON is do create Result.from_external_pointer(p) end
  306. create_gtk_status_icon (p: POINTER): GTK_STATUS_ICON is do create Result.from_external_pointer(p) end
  307. create_gtk_status_bar (p: POINTER): GTK_STATUS_BAR is do create Result.from_external_pointer(p) end
  308. create_gtk_style (p: POINTER): GTK_STYLE is do create Result.from_external_pointer(p) end
  309. create_gtk_table (p: POINTER): GTK_TABLE is do create Result.from_external_pointer(p) end
  310. create_gtk_tearoff_menu_item (p: POINTER): GTK_TEAROFF_MENU_ITEM is do create Result.from_external_pointer(p) end
  311. create_gtk_text_buffer (p: POINTER): GTK_TEXT_BUFFER is do create Result.from_external_pointer(p) end
  312. create_gtk_text_child_anchor (p: POINTER): GTK_TEXT_CHILD_ANCHOR is do create Result.from_external_pointer(p) end
  313. create_gtk_text_mark (p: POINTER): GTK_TEXT_MARK is do create Result.from_external_pointer(p) end
  314. create_gtk_text_tag (p: POINTER): GTK_TEXT_TAG is do create Result.from_external_pointer(p) end
  315. create_gtk_text_tag_table (p: POINTER): GTK_TEXT_TAG_TABLE is do create Result.from_external_pointer(p) end
  316. create_gtk_text_view (p: POINTER): GTK_TEXT_VIEW is do create Result.from_external_pointer(p) end
  317. create_gtk_toggle_action (p: POINTER): GTK_TOGGLE_ACTION is do create Result.from_external_pointer(p) end
  318. create_gtk_toggle_button (p: POINTER): GTK_TOGGLE_BUTTON is do create Result.from_external_pointer(p) end
  319. create_gtk_toggle_tool_button (p: POINTER): GTK_TOGGLE_TOOL_BUTTON is do create Result.from_external_pointer(p) end
  320. create_gtk_tool_button (p: POINTER): GTK_TOOL_BUTTON is do create Result.from_external_pointer(p) end
  321. create_gtk_tool_item (p: POINTER): GTK_TOOL_ITEM is do create Result.from_external_pointer(p) end
  322. create_gtk_toolbar (p: POINTER): GTK_TOOLBAR is do create Result.from_external_pointer(p) end
  323. create_gtk_tooltips (p: POINTER): GTK_TOOLTIPS is do create Result.from_external_pointer(p) end
  324. create_gtk_tree_model_filter (p: POINTER): GTK_TREE_MODEL_FILTER is do create Result.from_external_pointer(p) end
  325. create_gtk_tree_model_sort (p: POINTER): GTK_TREE_MODEL_SORT is do create Result.from_external_pointer(p) end
  326. create_gtk_tree_selection (p: POINTER): GTK_TREE_SELECTION is do create Result.from_external_pointer(p) end
  327. create_gtk_tree_store (p: POINTER): GTK_TREE_STORE is do create Result.from_external_pointer(p) end
  328. create_gtk_tree_view (p: POINTER): GTK_TREE_VIEW is do create Result.from_external_pointer(p) end
  329. create_gtk_tree_view_column (p: POINTER): GTK_TREE_VIEW_COLUMN is do create Result.from_external_pointer(p) end
  330. -- create_gtkUI_Manager (p: POINTER): GtkUI_Manager is do create Result.from_external_pointer(p) end
  331. create_gtk_vbox (p: POINTER): GTK_VBOX is do create Result.from_external_pointer(p) end
  332. create_gtk_vbutton_box (p: POINTER): GTK_VBUTTON_BOX is do create Result.from_external_pointer(p) end
  333. create_gtk_vpaned (p: POINTER): GTK_VPANED is do create Result.from_external_pointer(p) end
  334. -- create_gtk_vruler (p: POINTER): GTK_VRULER is do create Result.from_external_pointer(p) end
  335. create_gtk_vscale (p: POINTER): GTK_VSCALE is do create Result.from_external_pointer(p) end
  336. create_gtk_vscrollbar (p: POINTER): GTK_VSCROLLBAR is do create Result.from_external_pointer(p) end
  337. create_gtk_vseparator (p: POINTER): GTK_VSEPARATOR is do create Result.from_external_pointer(p) end
  338. -- create_gtk_Viewport (p: POINTER): Gtk_Viewport is do create Result.from_external_pointer(p) end
  339. create_gtk_window (p: POINTER): GTK_WINDOW is do create Result.from_external_pointer(p) end
  340. create_gtk_window_group (p: POINTER): GTK_WINDOW_GROUP is do create Result.from_external_pointer(p) end
  341. feature
  342. disable_setlocale is
  343. -- Prevents initilize_gtk and similar call (wrappers of
  344. -- gtk_init(), gtk_init_check(), gtk_init_with_args() and
  345. -- gtk_parse_args() from automatically calling setlocale
  346. -- (LC_ALL, ""). You would want to use this function if you
  347. -- wanted to set the locale for your program to something
  348. -- other than the user's locale, or if you wanted to set
  349. -- different values for different locale categories.
  350. -- Most programs should not need to call this function.
  351. do
  352. gtk_disable_setlocale
  353. end
  354. -- TODO: wrap gtk_get_default_language ()
  355. -- TODO: wrap gtk_parse_args ()
  356. initialize, initialize_gtk is
  357. -- Initialize everything needed to operate the GTK toolkit and parses
  358. -- some standard command line options. argc and argv are adjusted
  359. -- accordingly so your own code will never see those standard
  360. -- arguments.
  361. -- Note that there are some alternative ways to initialize GTK+: if you
  362. -- are calling gtk_parse_args(), gtk_init_check(), gtk_init_with_args()
  363. -- or g_option_context_parse() with the option group returned by
  364. -- gtk_get_option_group(), you don't have to call gtk_init().
  365. -- Note: This function will terminate your program if it was unable to
  366. -- initialize the GUI for some reason. If you want your program to fall
  367. -- back to a textual interface you want to call gtk_init_check()
  368. -- instead.
  369. local argc: INTEGER; argv: POINTER
  370. do
  371. if not is_initialized then
  372. argc := argument_count
  373. argv := command_arguments.to_external
  374. gtk_init ($argc, $argv)
  375. is_initialized := True
  376. end
  377. ensure initialized: is_initialized = True
  378. end
  379. is_initialized: BOOLEAN
  380. -- Have gtk been successfully initilized?
  381. try_initilizing_gtk is
  382. -- Try initiliazing GTK toolkit. If successful
  383. -- `is_gtk_initialized' will be True.
  384. local argc: INTEGER; argv: POINTER
  385. do
  386. argc := argument_count
  387. argv := command_arguments.to_external
  388. is_initialized := gtk_init_check ($argc, $argv).to_boolean
  389. end
  390. -- TODO: wrap gtk_init_with_args ()
  391. are_events_pending: BOOLEAN is
  392. -- Are there any events pending? This can be used to update
  393. -- the GUI and invoke timeouts etc. while doing some time
  394. -- intensive computation.
  395. -- TODO: Eiffelize this example Updating the GUI during a
  396. -- long computation.
  397. -- computation going on
  398. -- ...
  399. -- from until not are_events_pendind
  400. -- loop gtk_main_iteration
  401. -- ...
  402. -- computation continued
  403. do
  404. Result:=gtk_events_pending.to_boolean
  405. end
  406. run_main_loop, run_gtk_main_loop is
  407. -- Runs the main loop until (C function) gtk_main_quit() is
  408. -- called. You can nest calls to gtk_main(). In that case
  409. -- gtk_main_quit() will make the innermost invocation of the
  410. -- main loop return.
  411. require gtk_initialized: is_initialized
  412. do
  413. gtk_main
  414. std_error.put_string (once "Exiting gtk_main%N")
  415. end
  416. gtk_nesting_level: INTEGER is
  417. obsolete "use nesting level instead"
  418. do
  419. Result := nesting_level
  420. end
  421. nesting_level: INTEGER is
  422. -- the nesting level of the current invocation of the main
  423. -- loop. This can be useful when calling gtk_quit_add().
  424. do
  425. Result := gtk_main_level
  426. end
  427. gtk_quit is
  428. obsolete "use quit instead"
  429. do
  430. quit
  431. end
  432. quit is
  433. -- Makes the innermost invocation of the main loop return
  434. -- when it regains control.
  435. do
  436. gtk_main_quit
  437. end
  438. gtk_main_iteration is
  439. obsolete "use main_iteration"
  440. do
  441. main_iteration
  442. end
  443. main_iteration is
  444. -- Runs a single iteration of the mainloop. If no events are
  445. -- waiting to be processed GTK+ will block until the next event
  446. -- is noticed. If you don't want to block look at
  447. -- gtk_main_iteration_not_blocking or check if any events are pending
  448. -- with are_events_pending first.
  449. local called_on_innermost_mainloop: INTEGER
  450. do
  451. -- TODO: expose called_on_innermost_mainloop in an intelligent way
  452. called_on_innermost_mainloop := gtk_main_iteration_external
  453. end
  454. gtk_main_iteration_not_blocking is
  455. obsolete "use not_blocking_main_iteration"
  456. do
  457. not_blocking_main_iteration
  458. end
  459. not_blocking_main_iteration is
  460. local called_on_innermost_mainloop: INTEGER
  461. do
  462. -- TODO: expose called_on_innermost_mainloop in an intelligent way
  463. called_on_innermost_mainloop := gtk_main_iteration_do (0)
  464. end
  465. -- TODO: wrap gtk_main_do_event in a release distant in the
  466. -- future. Infact GTK documentation says "This is public only to
  467. -- allow filtering of events between GDK and GTK+. You will not
  468. -- usually need to call this function directly."
  469. -- GtkModuleInitFunc ()
  470. -- void (*GtkModuleInitFunc) (gint *argc,
  471. -- gchar ***argv);
  472. -- Each GTK+ module must have a function gtk_module_init() with this prototype. This function is called after loading the module with the argc and argv cleaned from any arguments that GTK+ handles itself.
  473. -- argc : Pointer to the number of arguments remaining after gtk_init().
  474. -- argv : Points to the argument vector.
  475. -- GtkModuleDisplayInitFunc ()
  476. -- void (*GtkModuleDisplayInitFunc) (GdkDisplay *display);
  477. -- void gtk_grab_add (GtkWidget *widget);
  478. -- Makes widget the current grabbed widget. This means that interaction with other widgets in the same application is blocked and mouse as well as keyboard events are delivered to this widget.
  479. -- widget : The widget that grabs keyboard and pointer events.
  480. -- gtk_grab_get_current ()
  481. -- GtkWidget* gtk_grab_get_current (void);
  482. -- Queries the current grab of the default window group.
  483. -- Returns : The widget which currently has the grab or NULL if no grab is active.
  484. -- gtk_grab_remove ()
  485. -- void gtk_grab_remove (GtkWidget *widget);
  486. -- Removes the grab from the given widget. You have to pair calls to gtk_grab_add() and gtk_grab_remove().
  487. -- widget : The widget which gives up the grab.
  488. -- gtk_init_add ()
  489. -- void gtk_init_add (GtkFunction function,
  490. -- gpointer data);
  491. -- Registers a function to be called when the mainloop is started.
  492. -- function : Function to invoke when gtk_main() is called next.
  493. -- data : Data to pass to that function.
  494. -- gtk_quit_add_destroy ()
  495. -- void gtk_quit_add_destroy (guint main_level,
  496. -- GtkObject *object);
  497. -- Trigger destruction of object in case the mainloop at level main_level is quit.
  498. -- main_level : Level of the mainloop which shall trigger the destruction.
  499. -- object : Object to be destroyed.
  500. -- gtk_quit_add ()
  501. -- guint gtk_quit_add (guint main_level,
  502. -- GtkFunction function,
  503. -- gpointer data);
  504. -- Registers a function to be called when an instance of the mainloop is left.
  505. -- main_level : Level at which termination the function shall be called. You can pass 0 here to have the function run at the termination of the current mainloop.
  506. -- function : The function to call. This should return 0 to be removed from the list of quit handlers. Otherwise the function might be called again.
  507. -- data : Pointer to pass when calling function.
  508. -- Returns : A handle for this quit handler (you need this for gtk_quit_remove()) or 0 if you passed a NULL pointer in function.
  509. -- gtk_quit_add_full ()
  510. -- guint gtk_quit_add_full (guint main_level,
  511. -- GtkFunction function,
  512. -- GtkCallbackMarshal marshal,
  513. -- gpointer data,
  514. -- GtkDestroyNotify destroy);
  515. -- Registers a function to be called when an instance of the mainloop is left. In comparison to gtk_quit_add() this function adds the possibility to pass a marshaller and a function to be called when the quit handler is freed.
  516. -- The former can be used to run interpreted code instead of a compilxfed function while the latter can be used to free the information stored in data (while you can do this in function as well)... So this function will mostly be used by GTK+ wrappers for languages other than C.
  517. -- main_level : Level at which termination the function shall be called. You can pass 0 here to have the function run at the termination of the current mainloop.
  518. -- function : The function to call. This should return 0 to be removed from the list of quit handlers. Otherwise the function might be called again.
  519. -- marshal : The marshaller to be used. If this is non-NULL, function is ignored.
  520. -- data : Pointer to pass when calling function.
  521. -- destroy : Function to call to destruct data. Gets data as argument.
  522. -- Returns : A handle for this quit handler (you need this for gtk_quit_remove()) or 0 if you passed a NULL pointer in function.
  523. -- gtk_quit_remove ()
  524. -- void gtk_quit_remove (guint quit_handler_id);
  525. -- Removes a quit handler by its identifier.
  526. -- quit_handler_id : Identifier for the handler returned when installing it.
  527. -- gtk_quit_remove_by_data ()
  528. -- void gtk_quit_remove_by_data (gpointer data);
  529. -- Removes a quit handler identified by its data field.
  530. -- data : The pointer passed as data to gtk_quit_add() or gtk_quit_add_full().
  531. -- gtk_timeout_add_full ()
  532. -- gtk_key_snooper_install ()
  533. -- guint gtk_key_snooper_install (GtkKeySnoopFunc snooper,
  534. -- gpointer func_data);
  535. -- Installs a key snooper function, which will get called on all key events before delivering them normally.
  536. -- snooper : a GtkKeySnoopFunc.
  537. -- func_data : data to pass to snooper.
  538. -- Returns : a unique id for this key snooper for use with gtk_key_snooper_remove().
  539. -- GtkKeySnoopFunc ()
  540. -- gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget,
  541. -- GdkEventKey *event,
  542. -- gpointer func_data);
  543. -- Key snooper functions are called before normal event delivery. They can be used to implement custom key event handling.
  544. -- grab_widget : the widget to which the event will be delivered.
  545. -- event : the key event.
  546. -- func_data : the func_data supplied to gtk_key_snooper_install().
  547. -- Returns : TRUE to stop further processing of event, FALSE to continue.
  548. -- gtk_key_snooper_remove ()
  549. -- void gtk_key_snooper_remove (guint snooper_handler_id);
  550. -- Removes the key snooper function with the given id.
  551. -- snooper_handler_id : Identifies the key snooper to remove.
  552. -- gtk_get_current_event ()
  553. -- GdkEvent* gtk_get_current_event (void);
  554. -- Obtains a copy of the event currently being processed by GTK+. For example, if you get a "clicked" signal from GtkButton, the current event will be the GdkEventButton that triggered the "clicked" signal. The returned event must be freed with gdk_event_free(). If there is no current event, the function returns NULL.
  555. -- Returns : a copy of the current event, or NULL if no current event.
  556. -- gtk_get_current_event_time ()
  557. -- guint32 gtk_get_current_event_time (void);
  558. -- If there is a current event and it has a timestamp, return that timestamp, otherwise return GDK_CURRENT_TIME.
  559. -- Returns : the timestamp from the current event, or GDK_CURRENT_TIME.
  560. -- gtk_get_current_event_state ()
  561. -- gboolean gtk_get_current_event_state (GdkModifierType *state);
  562. -- If there is a current event and it has a state field, place that state field in state and return TRUE, otherwise return FALSE.
  563. -- state : a location to store the state of the current event
  564. -- Returns : TRUE if there was a current event and it had a state field
  565. -- gtk_get_event_widget ()
  566. -- GtkWidget* gtk_get_event_widget (GdkEvent *event);
  567. -- If event is NULL or the event was not associated with any widget, returns NULL, otherwise returns the widget that received the event originally.
  568. -- event : a GdkEvent
  569. -- Returns : the widget that originally received event, or NULL
  570. -- gtk_propagate_event ()
  571. -- void gtk_propagate_event (GtkWidget *widget,
  572. -- GdkEvent *event);
  573. -- Sends an event to a widget, propagating the event to parent widgets if the event remains unhandled. Events received by GTK+ from GDK normally begin in gtk_main_do_event(). Depending on the type of event, existence of modal dialogs, grabs, etc., the event may be propagated; if so, this function is used. gtk_propagate_event() calls gtk_widget_event() on each widget it decides to send the event to. So gtk_widget_event() is the lowest-level function; it simply emits the "event" and possibly an event-specific signal on a widget. gtk_propagate_event() is a bit higher-level, and gtk_main_do_event() is the highest level.
  574. -- All that said, you most likely don't want to use any of these functions; synthesizing events is rarely needed. Consider asking on the mailing list for better ways to achieve your goals. For example, use gdk_window_invalidate_rect() or gtk_widget_queue_draw() instead of making up expose events.
  575. -- widget : a GtkWidget
  576. -- event : an event
  577. -- See Also
  578. -- See the GLib manual, especially GMainLoop and signal-related functions such as g_signal_connect().
  579. feature -- global windows features
  580. toplevels: G_LIST [GTK_WINDOW] is
  581. -- A list of all existing toplevel windows.
  582. do
  583. create {G_OBJECT_LIST [GTK_WINDOW]} Result.from_external_pointer (gtk_window_list_toplevels)
  584. -- Note: (adapted from original documentation)
  585. -- `gtk_window_list_toplevels' returns a list in which the
  586. -- widgets are not individually referenced. Therefore before
  587. -- performing actions involving callbacks that might destroy
  588. -- the widgets, we call "g_list_foreach (result,
  589. -- (GFunc)g_object_ref, NULL)" (implemented in
  590. -- `ref_all_toplevels') first, and then unref all the widgets
  591. -- afterwards.
  592. -- TODO: I'm not sure toplevels shall be reffed.
  593. ref_all_toplevels (Result.handle)
  594. end
  595. default_icon_list: G_LIST[GDK_PIXBUF] is
  596. -- an icon list to be used as fallback for windows that
  597. -- haven't had `icon_list' called on them to set up a
  598. -- window-specific icon list.
  599. do
  600. create {G_OBJECT_LIST[GDK_PIXBUF]} Result.from_external_pointer (gtk_window_get_default_icon_list)
  601. -- Gets the value set by
  602. -- gtk_window_set_default_icon_list(). The list is a copy and
  603. -- should be freed with g_list_free(), but the pixbufs in the
  604. -- list have not had their reference count incremented.
  605. end
  606. set_default_icon_list (some_pixbuffers: G_LIST[GDK_PIXBUF]) is
  607. -- Sets an icon list to be used as fallback for windows that
  608. -- haven't had gtk_window_set_icon_list() called on them to
  609. -- set up a window-specific icon list. This function allows
  610. -- you to set up the icon for all windows in your app at
  611. -- once. See `GTK_WINDOW.set_icon_list' for more details.
  612. require
  613. list_not_void: some_pixbuffers /= Void
  614. do
  615. gtk_window_set_default_icon_list(some_pixbuffers.handle)
  616. end
  617. set_default_icon (an_icon: GDK_PIXBUF) is
  618. -- Sets an icon to be used as fallback for windows that
  619. -- haven't had `GTK_WINDOW.set_icon' called on them from a
  620. -- pixbuf.
  621. do
  622. gtk_window_set_default_icon (an_icon.handle)
  623. end
  624. set_default_icon_from_file (a_filename: STRING) is
  625. -- Sets an icon to be used as fallback for windows that
  626. -- haven't had gtk_window_set_icon_list() called on them from
  627. -- a file on disk. Errors are stored in `error' feature
  628. require
  629. filename_not_void: a_filename /= Void
  630. do
  631. is_default_icon_set := (gtk_window_set_default_icon_from_file
  632. (a_filename.to_external,
  633. address_of (error.handle))).to_boolean
  634. -- Sets an icon to be used as fallback for windows that
  635. -- haven't had gtk_window_set_icon_list() called on them from
  636. -- a file on disk. Warns on failure if err is NULL.
  637. end
  638. is_default_icon_set: BOOLEAN
  639. -- Has last call to `set_default_icon_from_file' actually
  640. -- set up the default icon?
  641. set_default_icon_name (a_name: STRING) is
  642. -- Sets an icon to be used as fallback for windows that
  643. -- haven't had `GTK_WINDOW.set_icon_list' called on them from
  644. -- a named themed icon, see `GTK_WINDOW.set_icon_name'.
  645. do
  646. gtk_window_set_default_icon_name (a_name.to_external)
  647. end
  648. set_auto_startup_notification is
  649. -- By default, after showing the first GtkWindow for each
  650. -- GdkScreen, GTK+ calls gdk_notify_startup_complete(). Call
  651. -- this function to disable the automatic startup
  652. -- notification. You might do this if your first window is a
  653. -- splash screen, and you want to delay notification until
  654. -- after your real main window has been shown, for example.
  655. -- In that example, you would disable startup notification
  656. -- temporarily, show your splash screen, then re-enable it so
  657. -- that showing the main window would automatically result in
  658. -- notification.
  659. do
  660. gtk_window_set_auto_startup_notification (1)
  661. end
  662. unset_auto_startup_notification is
  663. -- Disable auto startup notification. Useful when dealing
  664. -- with splash-screens. See `set_auto_startup_notification'
  665. -- for further informations.
  666. do
  667. gtk_window_set_auto_startup_notification (0)
  668. end
  669. feature -- Global error
  670. error: G_ERROR
  671. -- The error eventually set up by a GTK+ call.
  672. feature {} -- External calls for global windows features
  673. ref_all_toplevels (toplevel_list: POINTER) is
  674. external "C inline use <gtk/gtk.h>"
  675. alias "g_list_foreach ($toplevel_list, (GFunc)g_object_ref, NULL)"
  676. end
  677. gtk_window_list_toplevels: POINTER is -- GList*
  678. external "C use <gtk/gtk.h>"
  679. end
  680. gtk_window_get_default_icon_list: POINTER is -- GList*
  681. external "C use <gtk/gtk.h>"
  682. end
  683. gtk_window_set_default_icon_list(a_glist: POINTER) is
  684. external "C use <gtk/gtk.h>"
  685. end
  686. gtk_window_set_default_icon (a_gdkpixbuf_icon: POINTER) is
  687. external "C use <gtk/gtk.h>"
  688. end
  689. gtk_window_set_default_icon_from_file (filename_str, gerror_handle: POINTER): INTEGER is
  690. external "C use <gtk/gtk.h>"
  691. end
  692. gtk_window_set_default_icon_name (name_str: POINTER) is
  693. external "C use <gtk/gtk.h>"
  694. end
  695. gtk_window_set_auto_startup_notification (gboolean_setting: INTEGER) is
  696. external "C use <gtk/gtk.h>"
  697. end
  698. feature {} -- Unwrapped code from "Main loop and Events"
  699. -- Main loop and Events -- Library initialization, main event loop, and
  700. -- events
  701. --
  702. --Synopsis
  703. --
  704. --
  705. -- #include <gtk/gtk.h>
  706. --
  707. --
  708. -- gchar* gtk_set_locale (void);
  709. -- void gtk_disable_setlocale (void);
  710. -- PangoLanguage* gtk_get_default_language (void);
  711. -- gboolean gtk_parse_args (int *argc,
  712. -- char ***argv);
  713. -- void gtk_init (int *argc,
  714. -- char ***argv);
  715. -- gboolean gtk_init_check (int *argc,
  716. -- char ***argv);
  717. -- gboolean gtk_init_with_args (int *argc,
  718. -- char ***argv,
  719. -- char *parameter_string,
  720. -- GOptionEntry *entries,
  721. -- char *translation_domain,
  722. -- GError **error);
  723. -- GOptionGroup* gtk_get_option_group (gboolean open_default_display);
  724. -- void gtk_exit (gint error_code);
  725. -- gboolean gtk_events_pending (void);
  726. -- void gtk_main (void);
  727. -- guint gtk_main_level (void);
  728. -- void gtk_main_quit (void);
  729. -- gboolean gtk_main_iteration (void);
  730. -- gboolean gtk_main_iteration_do (gboolean blocking);
  731. -- void gtk_main_do_event (GdkEvent *event);
  732. -- void (*GtkModuleInitFunc) (gint *argc,
  733. -- gchar ***argv);
  734. -- void (*GtkModuleDisplayInitFunc) (GdkDisplay *display);
  735. --
  736. -- gboolean gtk_true (void);
  737. -- gboolean gtk_false (void);
  738. --
  739. -- void gtk_grab_add (GtkWidget *widget);
  740. -- GtkWidget* gtk_grab_get_current (void);
  741. -- void gtk_grab_remove (GtkWidget *widget);
  742. --
  743. -- void gtk_init_add (GtkFunction function,
  744. -- gpointer data);
  745. -- void gtk_quit_add_destroy (guint main_level,
  746. -- GtkObject *object);
  747. -- guint gtk_quit_add (guint main_level,
  748. -- GtkFunction function,
  749. -- gpointer data);
  750. -- guint gtk_quit_add_full (guint main_level,
  751. -- GtkFunction function,
  752. -- GtkCallbackMarshal marshal,
  753. -- gpointer data,
  754. -- GtkDestroyNotify destroy);
  755. -- void gtk_quit_remove (guint quit_handler_id);
  756. -- void gtk_quit_remove_by_data (gpointer data);
  757. --
  758. -- guint gtk_timeout_add_full (guint32 interval,
  759. -- GtkFunction function,
  760. -- GtkCallbackMarshal marshal,
  761. -- gpointer data,
  762. -- GtkDestroyNotify destroy);
  763. -- guint gtk_timeout_add (guint32 interval,
  764. -- GtkFunction function,
  765. -- gpointer data);
  766. -- void gtk_timeout_remove (guint timeout_handler_id);
  767. --
  768. -- guint gtk_idle_add (GtkFunction function,
  769. -- gpointer data);
  770. -- guint gtk_idle_add_priority (gint priority,
  771. -- GtkFunction function,
  772. -- gpointer data);
  773. -- guint gtk_idle_add_full (gint priority,
  774. -- GtkFunction function,
  775. -- GtkCallbackMarshal marshal,
  776. -- gpointer data,
  777. -- GtkDestroyNotify destroy);
  778. -- void gtk_idle_remove (guint idle_handler_id);
  779. -- void gtk_idle_remove_by_data (gpointer data);
  780. --
  781. -- guint gtk_input_add_full (gint source,
  782. -- GdkInputCondition condition,
  783. -- GdkInputFunction function,
  784. -- GtkCallbackMarshal marshal,
  785. -- gpointer data,
  786. -- GtkDestroyNotify destroy);
  787. -- void gtk_input_remove (guint input_handler_id);
  788. --
  789. -- #define GTK_PRIORITY_REDRAW
  790. -- #define GTK_PRIORITY_RESIZE
  791. -- #define GTK_PRIORITY_HIGH
  792. -- #define GTK_PRIORITY_INTERNAL
  793. -- #define GTK_PRIORITY_DEFAULT
  794. -- #define GTK_PRIORITY_LOW
  795. --
  796. -- guint gtk_key_snooper_install (GtkKeySnoopFunc snooper,
  797. -- gpointer func_data);
  798. -- gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget,
  799. -- GdkEventKey *event,
  800. -- gpointer func_data);
  801. -- void gtk_key_snooper_remove (guint snooper_handler_id);
  802. --
  803. -- GdkEvent* gtk_get_current_event (void);
  804. -- guint32 gtk_get_current_event_time (void);
  805. -- gboolean gtk_get_current_event_state (GdkModifierType *state);
  806. -- GtkWidget* gtk_get_event_widget (GdkEvent *event);
  807. -- void gtk_propagate_event (GtkWidget *widget,
  808. -- GdkEvent *event);
  809. --
  810. --
  811. --Description
  812. --
  813. -- Before using GTK+, you need to initialize it; initialization connects to
  814. -- the window system display, and parses some standard command line
  815. -- arguments. The gtk_init() function initializes GTK+. gtk_init() exits the
  816. -- application if errors occur; to avoid this, use gtk_init_check().
  817. -- gtk_init_check() allows you to recover from a failed GTK+ initialization -
  818. -- you might start up your application in text mode instead.
  819. --
  820. -- Like all GUI toolkits, GTK+ uses an event-driven programming model. When
  821. -- the user is doing nothing, GTK+ sits in the main loop and waits for input.
  822. -- If the user performs some action - say, a mouse click - then the main loop
  823. -- "wakes up" and delivers an event to GTK+. GTK+ forwards the event to one
  824. -- or more widgets.
  825. --
  826. -- When widgets receive an event, they frequently emit one or more signals.
  827. -- Signals notify your program that "something interesting happened" by
  828. -- invoking functions you've connected to the signal with g_signal_connect().
  829. -- Functions connected to a signal are often termed callbacks.
  830. --
  831. -- When your callbacks are invoked, you would typically take some action -
  832. -- for example, when an Open button is clicked you might display a
  833. -- GtkFileSelectionDialog. After a callback finishes, GTK+ will return to the
  834. -- main loop and await more user input.
  835. --
  836. -- Example 1. Typical main function for a GTK+ application
  837. --
  838. -- int
  839. -- main (int argc, char **argv)
  840. -- {
  841. -- /* Initialize i18n support */
  842. -- gtk_set_locale ();
  843. --
  844. -- /* Initialize the widget set */
  845. -- gtk_init (&argc, &argv);
  846. --
  847. -- /* Create the main window */
  848. -- mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  849. --
  850. -- /* Set up our GUI elements */
  851. -- ...
  852. --
  853. -- /* Show the application window */
  854. -- gtk_widget_show_all (mainwin);
  855. --
  856. -- /* Enter the main event loop, and wait for user interaction */
  857. -- gtk_main ();
  858. --
  859. -- /* The user lost interest */
  860. -- return 0;
  861. -- }
  862. --
  863. -- It's OK to use the GLib main loop directly instead of gtk_main(), though
  864. -- it involves slightly more typing. See GMainLoop in the GLib documentation.
  865. --
  866. --Details
  867. --
  868. -- gtk_set_locale ()
  869. --
  870. -- gchar* gtk_set_locale (void);
  871. --
  872. -- Initializes internationalization support for GTK+. gtk_init()
  873. -- automatically does this, so there is typically no point in calling this
  874. -- function.
  875. --
  876. -- If you are calling this function because you changed the locale after GTK+
  877. -- is was initialized, then calling this function may help a bit. (Note,
  878. -- however, that changing the locale after GTK+ is initialized may produce
  879. -- inconsistent results and is not really supported.)
  880. --
  881. -- In detail - sets the current locale according to the program environment.
  882. -- This is the same as calling the C library function setlocale (LC_ALL, "")
  883. -- but also takes care of the locale specific setup of the windowing system
  884. -- used by GDK.
  885. --
  886. -- Returns : a string corresponding to the locale set, typically in the form
  887. -- lang_COUNTRY, where lang is an ISO-639 language code, and
  888. -- COUNTRY is an ISO-3166 country code. On Unix, this form matches
  889. -- the result of the setlocale(); it is also used on other
  890. -- machines, such as Windows, where the C library returns a
  891. -- different result. The string is owned by GTK+ and should not be
  892. -- modified or freed.
  893. --
  894. -- --------------------------------------------------------------------------
  895. --
  896. -- gtk_disable_setlocale ()
  897. --
  898. -- void gtk_disable_setlocale (void);
  899. --
  900. -- Prevents gtk_init(), gtk_init_check(), gtk_init_with_args() and
  901. -- gtk_parse_args() from automatically calling setlocale (LC_ALL, ""). You
  902. -- would want to use this function if you wanted to set the locale for your
  903. -- program to something other than the user's locale, or if you wanted to set
  904. -- different values for different locale categories.
  905. --
  906. -- Most programs should not need to call this function.
  907. --
  908. -- --------------------------------------------------------------------------
  909. --
  910. -- gtk_get_default_language ()
  911. --
  912. -- PangoLanguage* gtk_get_default_language (void);
  913. --
  914. -- Returns the PangoLanguage for the default language currently in effect.
  915. -- (Note that this can change over the life of an application.) The default
  916. -- language is derived from the current locale. It determines, for example,
  917. -- whether GTK+ uses the right-to-left or left-to-right text direction. See
  918. -- _gtk_get_lc_ctype() for notes on behaviour on Windows.
  919. --
  920. -- Returns : the default language as a PangoLanguage, must not be freed
  921. --
  922. -- --------------------------------------------------------------------------
  923. --
  924. -- gtk_parse_args ()
  925. --
  926. -- gboolean gtk_parse_args (int *argc,
  927. -- char ***argv);
  928. --
  929. -- Parses command line arguments, and initializes global attributes of GTK+,
  930. -- but does not actually open a connection to a display. (See
  931. -- gdk_display_open(), gdk_get_display_arg_name())
  932. --
  933. -- Any arguments used by GTK+ or GDK are removed from the array and argc and
  934. -- argv are updated accordingly.
  935. --
  936. -- You shouldn't call this function explicitely if you are using gtk_init(),
  937. -- or gtk_init_check().
  938. --
  939. -- argc : a pointer to the number of command line arguments.
  940. -- argv : a pointer to the array of command line arguments.
  941. -- Returns : TRUE if initialization succeeded, otherwise FALSE.
  942. --
  943. -- --------------------------------------------------------------------------
  944. --
  945. -- gtk_init ()
  946. --
  947. -- void gtk_init (int *argc,
  948. -- char ***argv);
  949. --
  950. -- Call this function before using any other GTK+ functions in your GUI
  951. -- applications. It will initialize everything needed to operate the toolkit
  952. -- and parses some standard command line options. argc and argv are adjusted
  953. -- accordingly so your own code will never see those standard arguments.
  954. --
  955. -- Note that there are some alternative ways to initialize GTK+: if you are
  956. -- calling gtk_parse_args(), gtk_init_check(), gtk_init_with_args() or
  957. -- g_option_context_parse() with the option group returned by
  958. -- gtk_get_option_group(), you don't have to call gtk_init().
  959. --
  960. -- Note
  961. --
  962. -- This function will terminate your program if it was unable to initialize
  963. -- the GUI for some reason. If you want your program to fall back to a
  964. -- textual interface you want to call gtk_init_check() instead.
  965. --
  966. -- Note
  967. --
  968. -- argc : Address of the argc parameter of your main() function. Changed if
  969. -- any arguments were handled.
  970. -- argv : Address of the argv parameter of main(). Any parameters understood
  971. -- by gtk_init() are stripped before return.
  972. --
  973. -- --------------------------------------------------------------------------
  974. --
  975. -- gtk_init_check ()
  976. --
  977. -- gboolean gtk_init_check (int *argc,
  978. -- char ***argv);
  979. --
  980. -- This function does the same work as gtk_init() with only a single change:
  981. -- It does not terminate the program if the GUI can't be initialized. Instead
  982. -- it returns FALSE on failure.
  983. --
  984. -- This way the application can fall back to some other means of
  985. -- communication with the user - for example a curses or command line
  986. -- interface.
  987. --
  988. -- argc : Address of the argc parameter of your main() function. Changed
  989. -- if any arguments were handled.
  990. -- argv : Address of the argv parameter of main(). Any parameters
  991. -- understood by gtk_init() are stripped before return.
  992. -- Returns : TRUE if the GUI has been successfully initialized, FALSE
  993. -- otherwise.
  994. --
  995. -- --------------------------------------------------------------------------
  996. --
  997. -- gtk_init_with_args ()
  998. --
  999. -- gboolean gtk_init_with_args (int *argc,
  1000. -- char ***argv,
  1001. -- char *parameter_string,
  1002. -- GOptionEntry *entries,
  1003. -- char *translation_domain,
  1004. -- GError **error);
  1005. --
  1006. -- This function does the same work as gtk_init_check(). Additionally, it
  1007. -- allows you to add your own commandline options, and it automatically
  1008. -- generates nicely formatted --help output. Note that your program will be
  1009. -- terminated after writing out the help output.
  1010. --
  1011. -- argc : a pointer to the number of command line arguments.
  1012. -- argv : a pointer to the array of command line arguments.
  1013. -- parameter_string : a string which is displayed in the first line of
  1014. -- --help output, after programname [OPTION...]
  1015. -- entries : a NULL-terminated array of GOptionEntrys describing
  1016. -- the options of your program
  1017. -- translation_domain : a translation domain to use for translating the
  1018. -- --help output for the options in entries with
  1019. -- gettext(), or NULL
  1020. -- error : a return location for errors
  1021. -- Returns : TRUE if the GUI has been successfully initialized,
  1022. -- FALSE otherwise.
  1023. --
  1024. -- Since 2.6
  1025. --
  1026. -- --------------------------------------------------------------------------
  1027. --
  1028. -- gtk_get_option_group ()
  1029. --
  1030. -- GOptionGroup* gtk_get_option_group (gboolean open_default_display);
  1031. --
  1032. -- Returns a GOptionGroup for the commandline arguments recognized by GTK+
  1033. -- and GDK. You should add this group to your GOptionContext with
  1034. -- g_option_context_add_group(), if you are using g_option_context_parse() to
  1035. -- parse your commandline arguments.
  1036. --
  1037. -- open_default_display : whether to open the default display when parsing
  1038. -- the commandline arguments
  1039. -- Returns : a GOptionGroup for the commandline arguments
  1040. -- recognized by GTK+
  1041. --
  1042. -- Since 2.6
  1043. --
  1044. -- --------------------------------------------------------------------------
  1045. --
  1046. -- gtk_exit ()
  1047. --
  1048. -- void gtk_exit (gint error_code);
  1049. --
  1050. -- Warning
  1051. --
  1052. -- gtk_exit is deprecated and should not be used in newly-written code. Use
  1053. -- the standard exit() function instead.
  1054. --
  1055. -- Terminates the program and returns the given exit code to the caller. This
  1056. -- function will shut down the GUI and free all resources allocated for GTK+.
  1057. --
  1058. -- error_code : Return value to pass to the caller. This is dependent on the
  1059. -- target system but at least on Unix systems 0 means success.
  1060. --
  1061. -- --------------------------------------------------------------------------
  1062. --
  1063. -- gtk_events_pending ()
  1064. --
  1065. -- gboolean gtk_events_pending (void);
  1066. --
  1067. -- Checks if any events are pending. This can be used to update the GUI and
  1068. -- invoke timeouts etc. while doing some time intensive computation.
  1069. --
  1070. -- Example 2. Updating the GUI during a long computation.
  1071. --
  1072. -- /* computation going on */
  1073. -- ...
  1074. -- while (gtk_events_pending ())
  1075. -- gtk_main_iteration ();
  1076. -- ...
  1077. -- /* computation continued */
  1078. --
  1079. -- Returns : TRUE if any events are pending, FALSE otherwise.
  1080. --
  1081. -- --------------------------------------------------------------------------
  1082. --
  1083. -- gtk_main ()
  1084. --
  1085. -- void gtk_main (void);
  1086. --
  1087. -- Runs the main loop until gtk_main_quit() is called. You can nest calls to
  1088. -- gtk_main(). In that case gtk_main_quit() will make the innermost
  1089. -- invocation of the main loop return.
  1090. --
  1091. -- --------------------------------------------------------------------------
  1092. --
  1093. -- gtk_main_level ()
  1094. --
  1095. -- guint gtk_main_level (void);
  1096. --
  1097. -- Asks for the current nesting level of the main loop. This can be useful
  1098. -- when calling gtk_quit_add().
  1099. --
  1100. -- Returns : the nesting level of the current invocation of the main loop.
  1101. --
  1102. -- --------------------------------------------------------------------------
  1103. --
  1104. -- gtk_main_quit ()
  1105. --
  1106. -- void gtk_main_quit (void);
  1107. --
  1108. -- Makes the innermost invocation of the main loop return when it regains
  1109. -- control.
  1110. --
  1111. -- --------------------------------------------------------------------------
  1112. --
  1113. -- gtk_main_iteration ()
  1114. --
  1115. -- gboolean gtk_main_iteration (void);
  1116. --
  1117. -- Runs a single iteration of the mainloop. If no events are waiting to be
  1118. -- processed GTK+ will block until the next event is noticed. If you don't
  1119. -- want to block look at gtk_main_iteration_do() or check if any events are
  1120. -- pending with gtk_events_pending() first.
  1121. --
  1122. -- Returns : TRUE if gtk_main_quit() has been called for the innermost
  1123. -- mainloop.
  1124. --
  1125. -- --------------------------------------------------------------------------
  1126. --
  1127. -- gtk_main_iteration_do ()
  1128. --
  1129. -- gboolean gtk_main_iteration_do (gboolean blocking);
  1130. --
  1131. -- Runs a single iteration of the mainloop. If no events are available either
  1132. -- return or block dependent on the value of blocking.
  1133. --
  1134. -- blocking : TRUE if you want GTK+ to block if no events are pending.
  1135. -- Returns : TRUE if gtk_main_quit() has been called for the innermost
  1136. -- mainloop.
  1137. --
  1138. -- --------------------------------------------------------------------------
  1139. --
  1140. -- gtk_main_do_event ()
  1141. --
  1142. -- void gtk_main_do_event (GdkEvent *event);
  1143. --
  1144. -- Processes a single GDK event. This is public only to allow filtering of
  1145. -- events between GDK and GTK+. You will not usually need to call this
  1146. -- function directly.
  1147. --
  1148. -- While you should not call this function directly,