/src/wrappers/gtk/library/gtk_icon_view.e

http://github.com/tybor/Liberty · Specman e · 1099 lines · 166 code · 284 blank · 649 comment · 5 complexity · f9afeb5057a2bcbe908f49435d933e40 MD5 · raw file

  1. indexing
  2. description: "GtkIconView -- A widget which displays a list of icons in a grid"
  3. copyright: "[
  4. Copyright (C) 2006 Nicolas Fafchamps <nicolas.fafchamps@gmail.com> and others
  5. Copyright (C) 2006 eiffel-libraries team, GTK+ team
  6. This library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public License
  8. as published by the Free Software Foundation; either version 2.1 of
  9. the License, or (at your option) any later version.
  10. This library is distributed in the hope that it will be useful, but
  11. WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. Lesser General Public License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. 02110-1301 USA
  18. ]"
  19. date: "$Date:$"
  20. revision "$Revision:$"
  21. class GTK_ICON_VIEW
  22. -- GtkIconView provides an alternative view on a list model.
  23. -- It displays the model as a grid of icons with labels.
  24. -- Like GtkTreeView, it allows to select one or multiple items (depending
  25. -- on the selection mode, see gtk_icon_view_set_selection_mode()). In
  26. -- addition to selection with the arrow keys, GtkIconView supports
  27. -- rubberband selection, which is controlled by dragging the pointer.
  28. inherit
  29. GTK_CONTAINER
  30. insert
  31. GTK_ICON_VIEW_EXTERNALS
  32. G_OBJECT_FACTORY [GTK_TREE_MODEL]
  33. GTK_ICON_VIEW_DROP_POSITION
  34. G_OBJECT_EXTERNALS
  35. creation
  36. make, with_model, from_external_pointer
  37. feature {} -- Creation
  38. make is
  39. -- Creates a new GtkIconView widget
  40. do
  41. from_external_pointer (gtk_icon_view_new)
  42. end
  43. with_model (a_model: GTK_TREE_MODEL) is
  44. -- Creates a new GtkIconView widget with `a_model'.
  45. require
  46. a_model /= Void
  47. do
  48. from_external_pointer (gtk_icon_view_new_with_model (a_model.handle))
  49. end
  50. -- GtkIconView;
  51. -- void (*GtkIconViewForeachFunc) (GtkIconView *icon_view,
  52. -- GtkTreePath *path,
  53. -- gpointer data);
  54. feature -- Access
  55. model: GTK_TREE_MODEL is
  56. -- the model the GtkIconView is based on. Void if the model is
  57. -- unset.
  58. do
  59. Result := wrapper_or_void (gtk_icon_view_get_model (handle))
  60. end
  61. text_column: INTEGER is
  62. do
  63. Result := gtk_icon_view_get_text_column (handle)
  64. end
  65. markup_column: INTEGER is
  66. do
  67. Result := gtk_icon_view_get_markup_column (handle)
  68. end
  69. pixbuf_column: INTEGER is
  70. do
  71. Result := gtk_icon_view_get_pixbuf_column (handle)
  72. end
  73. feature -- Operations
  74. set_model (a_model: GTK_TREE_MODEL) is
  75. -- Sets the model for a GtkIconView. If the Current icon view
  76. -- already has a model set, it will remove it before setting
  77. -- the new model.
  78. require
  79. a_model /= Void
  80. do
  81. gtk_icon_view_set_model (handle, a_model.handle)
  82. ensure set: model = a_model
  83. end
  84. unset_model is
  85. -- Unset the old model.
  86. do
  87. gtk_icon_view_set_model (handle, default_pointer)
  88. ensure unset: model = Void
  89. end
  90. set_text_column (a_column: INTEGER) is
  91. -- Sets the column with text for icon_view to be `a_column'.
  92. require
  93. -- TODO: The text column must be of type G_TYPE_STRING.
  94. do
  95. gtk_icon_view_set_text_column (handle, a_column)
  96. end
  97. set_markup_column (a_column: INTEGER) is
  98. do
  99. gtk_icon_view_set_markup_column (handle, a_column)
  100. end
  101. set_pixbuf_column (a_column: INTEGER) is
  102. do
  103. gtk_icon_view_set_pixbuf_column (handle, a_column)
  104. end
  105. -- GtkTreePath* gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
  106. -- gint x,
  107. -- gint y);
  108. -- gboolean gtk_icon_view_get_item_at_pos (GtkIconView *icon_view,
  109. -- gint x,
  110. -- gint y,
  111. -- GtkTreePath **path,
  112. -- GtkCellRenderer **cell);
  113. -- void gtk_icon_view_set_cursor (GtkIconView *icon_view,
  114. -- GtkTreePath *path,
  115. -- GtkCellRenderer *cell,
  116. -- gboolean start_editing);
  117. -- gboolean gtk_icon_view_get_cursor (GtkIconView *icon_view,
  118. -- GtkTreePath **path,
  119. -- GtkCellRenderer **cell);
  120. -- void gtk_icon_view_selected_foreach (GtkIconView *icon_view,
  121. -- GtkIconViewForeachFunc func,
  122. -- gpointer data);
  123. -- void gtk_icon_view_set_selection_mode
  124. -- (GtkIconView *icon_view,
  125. -- GtkSelectionMode mode);
  126. -- GtkSelectionMode gtk_icon_view_get_selection_mode
  127. -- (GtkIconView *icon_view);
  128. -- void gtk_icon_view_set_orientation (GtkIconView *icon_view,
  129. -- GtkOrientation orientation);
  130. -- GtkOrientation gtk_icon_view_get_orientation
  131. -- (GtkIconView *icon_view);
  132. -- void gtk_icon_view_set_columns (GtkIconView *icon_view,
  133. -- gint columns);
  134. -- gint gtk_icon_view_get_columns (GtkIconView *icon_view);
  135. -- Since 2.6
  136. -- gtk_icon_view_set_item_width ()
  137. -- void gtk_icon_view_set_item_width (GtkIconView *icon_view,
  138. -- gint item_width);
  139. item_width: INTEGER is
  140. -- Returns the value of the ::item-width property.
  141. do
  142. Result := gtk_icon_view_get_item_width (handle)
  143. end
  144. set_item_width (a_width: INTEGER) is
  145. -- Sets the ::item-width property which specifies the width
  146. -- to use for each item. If it is set to -1, the icon view will
  147. -- automatically determine a suitable item size.
  148. do
  149. gtk_icon_view_set_item_width (handle, a_width)
  150. end
  151. -- void gtk_icon_view_set_spacing (GtkIconView *icon_view,
  152. -- gint spacing);
  153. -- gint gtk_icon_view_get_spacing (GtkIconView *icon_view);
  154. -- void gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
  155. -- gint row_spacing);
  156. -- gint gtk_icon_view_get_row_spacing (GtkIconView *icon_view);
  157. -- void gtk_icon_view_set_column_spacing
  158. -- (GtkIconView *icon_view,
  159. -- gint column_spacing);
  160. -- gint gtk_icon_view_get_column_spacing
  161. -- (GtkIconView *icon_view);
  162. -- void gtk_icon_view_set_margin (GtkIconView *icon_view,
  163. -- gint margin);
  164. -- gint gtk_icon_view_get_margin (GtkIconView *icon_view);
  165. -- void gtk_icon_view_select_path (GtkIconView *icon_view,
  166. -- GtkTreePath *path);
  167. -- void gtk_icon_view_unselect_path (GtkIconView *icon_view,
  168. -- GtkTreePath *path);
  169. -- gboolean gtk_icon_view_path_is_selected (GtkIconView *icon_view,
  170. -- GtkTreePath *path);
  171. -- GList* gtk_icon_view_get_selected_items
  172. -- (GtkIconView *icon_view);
  173. -- void gtk_icon_view_select_all (GtkIconView *icon_view);
  174. -- void gtk_icon_view_unselect_all (GtkIconView *icon_view);
  175. -- void gtk_icon_view_item_activated (GtkIconView *icon_view,
  176. -- GtkTreePath *path);
  177. -- void gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
  178. -- GtkTreePath *path,
  179. -- gboolean use_align,
  180. -- gfloat row_align,
  181. -- gfloat col_align);
  182. -- gboolean gtk_icon_view_get_visible_range (GtkIconView *icon_view,
  183. -- GtkTreePath **start_path,
  184. -- GtkTreePath **end_path);
  185. -- enum GtkIconViewDropPosition;
  186. -- void gtk_icon_view_enable_model_drag_source
  187. -- (GtkIconView *icon_view,
  188. -- GdkModifierType start_button_mask,
  189. -- const GtkTargetEntry *targets,
  190. -- gint n_targets,
  191. -- GdkDragAction actions);
  192. -- void gtk_icon_view_enable_model_drag_dest
  193. -- (GtkIconView *icon_view,
  194. -- const GtkTargetEntry *targets,
  195. -- gint n_targets,
  196. -- GdkDragAction actions);
  197. -- void gtk_icon_view_unset_model_drag_source
  198. -- (GtkIconView *icon_view);
  199. -- void gtk_icon_view_unset_model_drag_dest
  200. -- (GtkIconView *icon_view);
  201. -- void gtk_icon_view_set_reorderable (GtkIconView *icon_view,
  202. -- gboolean reorderable);
  203. -- gboolean gtk_icon_view_get_reorderable (GtkIconView *icon_view);
  204. -- void gtk_icon_view_set_drag_dest_item
  205. -- (GtkIconView *icon_view,
  206. -- GtkTreePath *path,
  207. -- GtkIconViewDropPosition pos);
  208. -- void gtk_icon_view_get_drag_dest_item
  209. -- (GtkIconView *icon_view,
  210. -- GtkTreePath **path,
  211. -- GtkIconViewDropPosition *pos);
  212. -- gboolean gtk_icon_view_get_dest_item_at_pos
  213. -- (GtkIconView *icon_view,
  214. -- gint drag_x,
  215. -- gint drag_y,
  216. -- GtkTreePath **path,
  217. -- GtkIconViewDropPosition *pos);
  218. -- GdkPixmap* gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
  219. -- GtkTreePath *path);
  220. -- Description
  221. -- GtkIconViewForeachFunc ()
  222. -- void (*GtkIconViewForeachFunc) (GtkIconView *icon_view,
  223. -- GtkTreePath *path,
  224. -- gpointer data);
  225. -- A function used by gtk_icon_view_selected_foreach() to map all selected rows. It will be called on every selected row in the view.
  226. -- icon_view :
  227. -- path : The GtkTreePath of a selected row
  228. -- data : user data
  229. -- Since 2.6
  230. -- gtk_icon_view_get_text_column ()
  231. -- gint gtk_icon_view_get_text_column (GtkIconView *icon_view);
  232. -- Returns the column with text for icon_view.
  233. -- icon_view : A GtkIconView.
  234. -- Returns : the text column, or -1 if it's unset.
  235. -- Since 2.6
  236. -- gtk_icon_view_set_markup_column ()
  237. -- void gtk_icon_view_set_markup_column (GtkIconView *icon_view,
  238. -- gint column);
  239. -- Sets the column with markup information for icon_view to be column. The markup column must be of type G_TYPE_STRING. If the markup column is set to something, it overrides the text column set by gtk_icon_view_set_text_column().
  240. -- icon_view : A GtkIconView.
  241. -- column : A column in the currently used model.
  242. -- Since 2.6
  243. -- gtk_icon_view_get_markup_column ()
  244. -- gint gtk_icon_view_get_markup_column (GtkIconView *icon_view);
  245. -- Returns the column with markup text for icon_view.
  246. -- icon_view : A GtkIconView.
  247. -- Returns : the markup column, or -1 if it's unset.
  248. -- Since 2.6
  249. -- gtk_icon_view_set_pixbuf_column ()
  250. -- void gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view,
  251. -- gint column);
  252. -- Sets the column with pixbufs for icon_view to be column. The pixbuf column must be of type GDK_TYPE_PIXBUF
  253. -- icon_view : A GtkIconView.
  254. -- column : A column in the currently used model.
  255. -- Since 2.6
  256. -- gtk_icon_view_get_pixbuf_column ()
  257. -- gint gtk_icon_view_get_pixbuf_column (GtkIconView *icon_view);
  258. -- Returns the column with pixbufs for icon_view.
  259. -- icon_view : A GtkIconView.
  260. -- Returns : the pixbuf column, or -1 if it's unset.
  261. -- Since 2.6
  262. -- gtk_icon_view_get_path_at_pos ()
  263. -- GtkTreePath* gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
  264. -- gint x,
  265. -- gint y);
  266. -- Finds the path at the point (x, y), relative to widget coordinates. See gtk_icon_view_get_item_at_pos(), if you are also interested in the cell at the specified position.
  267. -- icon_view : A GtkIconView.
  268. -- x : The x position to be identified
  269. -- y : The y position to be identified
  270. -- Returns : The GtkTreePath corresponding to the icon or NULL if no icon exists at that position.
  271. -- Since 2.6
  272. -- gtk_icon_view_get_item_at_pos ()
  273. -- gboolean gtk_icon_view_get_item_at_pos (GtkIconView *icon_view,
  274. -- gint x,
  275. -- gint y,
  276. -- GtkTreePath **path,
  277. -- GtkCellRenderer **cell);
  278. -- Finds the path at the point (x, y), relative to widget coordinates. In contrast to gtk_icon_view_get_path_at_pos(), this function also obtains the cell at the specified position. The returned path should be freed with gtk_tree_path_free().
  279. -- icon_view : A GtkIconView.
  280. -- x : The x position to be identified
  281. -- y : The y position to be identified
  282. -- path : Return location for the path, or NULL
  283. -- cell : Return location for the renderer responsible for the cell at (x, y), or NULL
  284. -- Returns : TRUE if an item exists at the specified position
  285. -- Since 2.8
  286. -- gtk_icon_view_set_cursor ()
  287. -- void gtk_icon_view_set_cursor (GtkIconView *icon_view,
  288. -- GtkTreePath *path,
  289. -- GtkCellRenderer *cell,
  290. -- gboolean start_editing);
  291. -- Sets the current keyboard focus to be at path, and selects it. This is useful when you want to focus the user's attention on a particular item. If cell is not NULL, then focus is given to the cell specified by it. Additionally, if start_editing is TRUE, then editing should be started in the specified cell.
  292. -- This function is often followed by gtk_widget_grab_focus (icon_view) in order to give keyboard focus to the widget. Please note that editing can only happen when the widget is realized.
  293. -- icon_view : A GtkIconView
  294. -- path : A GtkTreePath
  295. -- cell : A GtkCellRenderer or NULL
  296. -- start_editing : TRUE if the specified cell should start being edited.
  297. -- Since 2.8
  298. cursor: TUPLE [GTK_TREE_PATH, GTK_CELL_RENDERER] is
  299. -- Fills in path and cell with the current cursor path and cell.
  300. -- If the cursor isn't currently set, then *path will be NULL.
  301. -- If no cell currently has focus, then *cell will be NULL.
  302. -- The returned GtkTreePath must be freed with gtk_successtree_path_free().
  303. local
  304. path_ptr, cell_ptr: POINTER
  305. res: BOOLEAN
  306. path: GTK_TREE_PATH
  307. cell: GTK_CELL_RENDERER
  308. cell_name: STRING
  309. retriever: G_OBJECT_EXPANDED_FACTORY [GTK_CELL_RENDERER]
  310. do
  311. res := gtk_icon_view_get_cursor (handle, $path_ptr, $cell_ptr).to_boolean
  312. if path_ptr.is_not_null then create path.from_external_pointer (path_ptr)
  313. else path := Void
  314. end
  315. cell := retriever.wrapper_or_void(cell_ptr)
  316. Result := [path, cell]
  317. end
  318. -- TODO:gtk_icon_view_selected_foreach ()
  319. -- void gtk_icon_view_selected_foreach (GtkIconView *icon_view,
  320. -- GtkIconViewForeachFunc func,
  321. -- gpointer data);
  322. -- Calls a function for each selected icon. Note that the model or selection cannot be modified from within this function.
  323. -- icon_view : A GtkIconView.
  324. -- func : The funcion to call for each selected icon.
  325. -- data : User data to pass to the function.
  326. -- Since 2.6
  327. -- gtk_icon_view_set_selection_mode ()
  328. -- void gtk_icon_view_set_selection_mode
  329. -- (GtkIconView *icon_view,
  330. -- GtkSelectionMode mode);
  331. -- Sets the selection mode of the icon_view.
  332. -- icon_view : A GtkIconView.
  333. -- mode : The selection mode
  334. -- Since 2.6
  335. -- gtk_icon_view_get_selection_mode ()
  336. -- GtkSelectionMode gtk_icon_view_get_selection_mode
  337. -- (GtkIconView *icon_view);
  338. -- Gets the selection mode of the icon_view.
  339. -- icon_view : A GtkIconView.
  340. -- Returns : the current selection mode
  341. -- Since 2.6
  342. -- gtk_icon_view_set_orientation ()
  343. -- void gtk_icon_view_set_orientation (GtkIconView *icon_view,
  344. -- GtkOrientation orientation);
  345. -- Sets the ::orientation property which determines whether the labels are drawn beside the icons instead of below.
  346. -- icon_view : a GtkIconView
  347. -- orientation : the relative position of texts and icons
  348. -- Since 2.6
  349. -- gtk_icon_view_get_orientation ()
  350. -- GtkOrientation gtk_icon_view_get_orientation
  351. -- (GtkIconView *icon_view);
  352. -- Returns the value of the ::orientation property which determines whether the labels are drawn beside the icons instead of below.
  353. -- icon_view : a GtkIconView
  354. -- Returns : the relative position of texts and icons
  355. -- Since 2.6
  356. -- gtk_icon_view_set_columns ()
  357. -- void gtk_icon_view_set_columns (GtkIconView *icon_view,
  358. -- gint columns);
  359. -- Sets the ::columns property which determines in how many columns the icons are arranged. If columns is -1, the number of columns will be chosen automatically to fill the available area.
  360. -- icon_view : a GtkIconView
  361. -- columns : the number of columns
  362. -- Since 2.6
  363. -- gtk_icon_view_get_columns ()
  364. -- gint gtk_icon_view_get_columns (GtkIconView *icon_view);
  365. -- Returns the value of the ::columns property.
  366. -- icon_view : a GtkIconView
  367. -- Returns : the number of columns, or -1
  368. -- Since 2.6
  369. -- gtk_icon_view_set_spacing ()
  370. -- void gtk_icon_view_set_spacing (GtkIconView *icon_view,
  371. -- gint spacing);
  372. -- Sets the ::spacing property which specifies the space which is inserted between the cells (i.e. the icon and the text) of an item.
  373. -- icon_view : a GtkIconView
  374. -- spacing : the spacing
  375. -- Since 2.6
  376. -- gtk_icon_view_get_spacing ()
  377. -- gint gtk_icon_view_get_spacing (GtkIconView *icon_view);
  378. -- Returns the value of the ::spacing property.
  379. -- icon_view : a GtkIconView
  380. -- Returns : the space between cells
  381. -- Since 2.6
  382. -- gtk_icon_view_set_row_spacing ()
  383. -- void gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
  384. -- gint row_spacing);
  385. -- Sets the ::row-spacing property which specifies the space which is inserted between the rows of the icon view.
  386. -- icon_view : a GtkIconView
  387. -- row_spacing : the row spacing
  388. -- Since 2.6
  389. -- gtk_icon_view_get_row_spacing ()
  390. -- gint gtk_icon_view_get_row_spacing (GtkIconView *icon_view);
  391. -- Returns the value of the ::row-spacing property.
  392. -- icon_view : a GtkIconView
  393. -- Returns : the space between rows
  394. -- Since 2.6
  395. -- gtk_icon_view_set_column_spacing ()
  396. -- void gtk_icon_view_set_column_spacing
  397. -- (GtkIconView *icon_view,
  398. -- gint column_spacing);
  399. -- Sets the ::column-spacing property which specifies the space which is inserted between the columns of the icon view.
  400. -- icon_view : a GtkIconView
  401. -- column_spacing : the column spacing
  402. -- Since 2.6
  403. -- gtk_icon_view_get_column_spacing ()
  404. -- gint gtk_icon_view_get_column_spacing
  405. -- (GtkIconView *icon_view);
  406. -- Returns the value of the ::column-spacing property.
  407. -- icon_view : a GtkIconView
  408. -- Returns : the space between columns
  409. -- Since 2.6
  410. -- gtk_icon_view_set_margin ()
  411. -- void gtk_icon_view_set_margin (GtkIconView *icon_view,
  412. -- gint margin);
  413. -- Sets the ::margin property which specifies the space which is inserted at the top, bottom, left and right of the icon view.
  414. -- icon_view : a GtkIconView
  415. -- margin : the margin
  416. -- Since 2.6
  417. -- gtk_icon_view_get_margin ()
  418. -- gint gtk_icon_view_get_margin (GtkIconView *icon_view);
  419. -- Returns the value of the ::margin property.
  420. -- icon_view : a GtkIconView
  421. -- Returns : the space at the borders
  422. -- Since 2.6
  423. -- gtk_icon_view_select_path ()
  424. -- void gtk_icon_view_select_path (GtkIconView *icon_view,
  425. -- GtkTreePath *path);
  426. -- Selects the row at path.
  427. -- icon_view : A GtkIconView.
  428. -- path : The GtkTreePath to be selected.
  429. -- Since 2.6
  430. -- gtk_icon_view_unselect_path ()
  431. -- void gtk_icon_view_unselect_path (GtkIconView *icon_view,
  432. -- GtkTreePath *path);
  433. -- Unselects the row at path.
  434. -- icon_view : A GtkIconView.
  435. -- path : The GtkTreePath to be unselected.
  436. -- Since 2.6
  437. -- gtk_icon_view_path_is_selected ()
  438. -- gboolean gtk_icon_view_path_is_selected (GtkIconView *icon_view,
  439. -- GtkTreePath *path);
  440. -- Returns TRUE if the icon pointed to by path is currently selected. If icon does not point to a valid location, FALSE is returned.
  441. -- icon_view : A GtkIconView.
  442. -- path : A GtkTreePath to check selection on.
  443. -- Returns : TRUE if path is selected.
  444. -- Since 2.6
  445. -- gtk_icon_view_get_selected_items ()
  446. -- GList* gtk_icon_view_get_selected_items
  447. -- (GtkIconView *icon_view);
  448. -- Creates a list of paths of all selected items. Additionally, if you are planning on modifying the model after calling this function, you may want to convert the returned list into a list of GtkTreeRowReferences. To do this, you can use gtk_tree_row_reference_new().
  449. -- To free the return value, use:
  450. -- g_list_foreach (list, gtk_tree_path_free, NULL);
  451. -- g_list_free (list);
  452. -- icon_view : A GtkIconView.
  453. -- Returns : A GList containing a GtkTreePath for each selected row.
  454. -- Since 2.6
  455. -- gtk_icon_view_select_all ()
  456. -- void gtk_icon_view_select_all (GtkIconView *icon_view);
  457. -- Selects all the icons. icon_view must has its selection mode set to GTK_SELECTION_MULTIPLE.
  458. -- icon_view : A GtkIconView.
  459. -- Since 2.6
  460. -- gtk_icon_view_unselect_all ()
  461. -- void gtk_icon_view_unselect_all (GtkIconView *icon_view);
  462. -- Unselects all the icons.
  463. -- icon_view : A GtkIconView.
  464. -- Since 2.6
  465. -- gtk_icon_view_item_activated ()
  466. -- void gtk_icon_view_item_activated (GtkIconView *icon_view,
  467. -- GtkTreePath *path);
  468. -- Activates the item determined by path.
  469. -- icon_view : A GtkIconView
  470. -- path : The GtkTreePath to be activated
  471. -- Since 2.6
  472. -- gtk_icon_view_scroll_to_path ()
  473. -- void gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
  474. -- GtkTreePath *path,
  475. -- gboolean use_align,
  476. -- gfloat row_align,
  477. -- gfloat col_align);
  478. -- Moves the alignments of icon_view to the position specified by path. row_align determines where the row is placed, and col_align determines where column is placed. Both are expected to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means center.
  479. -- If use_align is FALSE, then the alignment arguments are ignored, and the tree does the minimum amount of work to scroll the item onto the screen. This means that the item will be scrolled to the edge closest to its current position. If the item is currently visible on the screen, nothing is done.
  480. -- This function only works if the model is set, and path is a valid row on the model. If the model changes before the icon_view is realized, the centered path will be modified to reflect this change.
  481. -- icon_view : A GtkIconView.
  482. -- path : The path of the item to move to.
  483. -- use_align : whether to use alignment arguments, or FALSE.
  484. -- row_align : The vertical alignment of the item specified by path.
  485. -- col_align : The horizontal alignment of the item specified by path.
  486. -- Since 2.8
  487. -- gtk_icon_view_get_visible_range ()
  488. -- gboolean gtk_icon_view_get_visible_range (GtkIconView *icon_view,
  489. -- GtkTreePath **start_path,
  490. -- GtkTreePath **end_path);
  491. -- Sets start_path and end_path to be the first and last visible path. Note that there may be invisible paths in between.
  492. -- Both paths should be freed with gtk_tree_path_free() after use.
  493. -- icon_view : A GtkIconView
  494. -- start_path : Return location for start of region, or NULL
  495. -- end_path : Return location for end of region, or NULL
  496. -- Returns : TRUE, if valid paths were placed in start_path and end_path
  497. -- Since 2.8
  498. -- enum GtkIconViewDropPosition
  499. -- typedef enum
  500. -- {
  501. -- GTK_ICON_VIEW_NO_DROP,
  502. -- GTK_ICON_VIEW_DROP_INTO,
  503. -- GTK_ICON_VIEW_DROP_LEFT,
  504. -- GTK_ICON_VIEW_DROP_RIGHT,
  505. -- GTK_ICON_VIEW_DROP_ABOVE,
  506. -- GTK_ICON_VIEW_DROP_BELOW
  507. -- } GtkIconViewDropPosition;
  508. enable_model_drag_source (a_start_button_mask: INTEGER;
  509. a_target: GTK_TARGET_ENTRY;
  510. some_actions: INTEGER) is
  511. -- Turns icon_view into a drag source for automatic DND.
  512. -- start_button_mask : Mask of allowed buttons to start drag
  513. -- some_targets : the table of targets that the drag will support
  514. -- n_targets : the number of items in targets
  515. -- some_actions : the bitmask of possible actions for a drag from this widget
  516. require
  517. is_valid_gdk_modifier_type (a_start_button_mask)
  518. a_target /= Void
  519. is_valid_gdk_drag_action (some_actions)
  520. do
  521. -- XXX: WATCH OUT! this implemetation allows the setting of only ONE target.
  522. -- In order to allow a list of them, we'd need to develop some C code so we can transform
  523. -- a NATIVE_ARRAY [POINTER] with the handle's of the different GTK_TARGET_ENTRY
  524. -- into a GtkTargetEntry *.
  525. -- nessa, 2006-10-30
  526. gtk_icon_view_enable_model_drag_source (handle, a_start_button_mask,
  527. a_target.handle, 1, some_actions)
  528. end
  529. enable_model_drag_dest (a_target: GTK_TARGET_ENTRY; some_actions: INTEGER) is
  530. -- Turns icon_view into a drop destination for automatic DND.
  531. -- some_targets : the table of targets that the drag will support
  532. -- n_targets : the number of items in targets
  533. -- some_actions : the bitmask of possible actions for a drag from this widget
  534. require
  535. a_target /= Void
  536. is_valid_gdk_drag_action (some_actions)
  537. do
  538. -- XXX: WATCH OUT! thsi implemetation allows the setting of only ONE target.
  539. -- In order to allow a list of them, we'd need to develop some C code so we can transform
  540. -- a NATIVE_ARRAY [POINTER] with the handle's of the different GTK_TARGET_ENTRY
  541. -- into a GtkTargetEntry *.
  542. -- nessa, 2006-10-30
  543. gtk_icon_view_enable_model_drag_dest (handle, a_target.handle, 1, some_actions)
  544. end
  545. unset_model_drag_source is
  546. -- Undoes the effect of `enable_model_drag_source'
  547. do
  548. gtk_icon_view_unset_model_drag_source (handle)
  549. end
  550. unset_model_drag_dest is
  551. -- Undoes the effect of `enable_model_drag_dest'
  552. do
  553. gtk_icon_view_unset_model_drag_dest (handle)
  554. end
  555. set_reorderable (a_boolean: BOOLEAN) is
  556. -- This function is a convenience function to allow you to
  557. -- reorder models that support the GtkTreeDragSourceIface
  558. -- and the GtkTreeDragDestIface. Both GtkTreeStore
  559. -- and GtkListStore support these. If reorderable is TRUE,
  560. -- then the user can reorder the model by dragging and dropping rows.
  561. -- The developer can listen to these changes by connecting to the
  562. -- model's row_inserted and row_deleted signals
  563. -- This function does not give you any degree of control over the order
  564. -- (any reordering is allowed). If more control is needed, you should
  565. -- probably handle drag and drop manually.
  566. do
  567. gtk_icon_view_set_reorderable (handle, a_boolean.to_integer)
  568. end
  569. reorderable: BOOLEAN is
  570. -- Retrieves whether the user can reorder the list via drag-and-drop.
  571. -- See `set_reorderable'.
  572. do
  573. Result := gtk_icon_view_get_reorderable (handle).to_boolean
  574. end
  575. -- gtk_icon_view_set_drag_dest_item ()
  576. -- void gtk_icon_view_set_drag_dest_item
  577. -- (GtkIconView *icon_view,
  578. -- GtkTreePath *path,
  579. -- GtkIconViewDropPosition pos);
  580. -- Sets the item that is highlighted for feedback.
  581. -- icon_view : a GtkIconView
  582. -- path : The path of the item to highlight, or NULL.
  583. -- pos : Specifies where to drop, relative to the item
  584. -- Since 2.8
  585. -- gtk_icon_view_get_drag_dest_item ()
  586. -- void gtk_icon_view_get_drag_dest_item
  587. -- (GtkIconView *icon_view,
  588. -- GtkTreePath **path,
  589. -- GtkIconViewDropPosition *pos);
  590. -- Gets information about the item that is highlighted for feedback.
  591. -- icon_view : a GtkIconView
  592. -- path : Return location for the path of the highlighted item, or NULL.
  593. -- pos : Return location for the drop position, or NULL
  594. -- Since 2.8
  595. dest_item_at_pos (drag_x, drag_y: INTEGER): TUPLE [GTK_TREE_PATH, INTEGER] is
  596. -- Determines the destination item for a given position.
  597. -- drag_x : the position to determine the destination item for
  598. -- drag_y : the position to determine the destination item for
  599. -- a_path : Return location for the path of the item, or NULL.
  600. -- a_position : Return location for the drop position, or NULL
  601. -- Returns : whether there is an item at the given position.
  602. local
  603. item_exists: BOOLEAN
  604. a_path: GTK_TREE_PATH
  605. a_path_ptr: POINTER
  606. a_position: INTEGER
  607. do
  608. item_exists := gtk_icon_view_get_dest_item_at_pos (handle, drag_x, drag_y, $a_path_ptr, $a_position).to_boolean
  609. if item_exists then
  610. create a_path.from_external_pointer (a_path_ptr)
  611. end
  612. Result := [a_path, a_position]
  613. ensure
  614. Result /= Void
  615. Result.first /= Void implies is_valid_gtk_icon_view_drop_position (Result.second)
  616. end
  617. -- gtk_icon_view_create_drag_icon ()
  618. -- GdkPixmap* gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
  619. -- GtkTreePath *path);
  620. -- Creates a GdkPixmap representation of the item at path. This image is used for a drag icon.
  621. -- icon_view : a GtkIconView
  622. -- path : a GtkTreePath in icon_view
  623. -- Returns : a newly-allocated pixmap of the drag icon.
  624. -- Since 2.8
  625. -- Implemented Interfaces
  626. -- GtkIconView implements AtkImplementorIface and GtkCellLayout.
  627. -- Properties
  628. -- "column-spacing" gint : Read / Write
  629. -- "columns" gint : Read / Write
  630. -- "item-width" gint : Read / Write
  631. -- "margin" gint : Read / Write
  632. -- "markup-column" gint : Read / Write
  633. -- "model" GtkTreeModel : Read / Write
  634. -- "orientation" GtkOrientation : Read / Write
  635. -- "pixbuf-column" gint : Read / Write
  636. -- "reorderable" gboolean : Read / Write
  637. -- "row-spacing" gint : Read / Write
  638. -- "selection-mode" GtkSelectionMode : Read / Write
  639. -- "spacing" gint : Read / Write
  640. -- "text-column" gint : Read / Write
  641. -- Property Details
  642. -- The "column-spacing" property
  643. -- "column-spacing" gint : Read / Write
  644. -- Space which is inserted between grid column.
  645. -- Allowed values: >= 0
  646. -- Default value: 6
  647. -- The "columns" property
  648. -- "columns" gint : Read / Write
  649. -- The columns property contains the number of the columns in which the items should be displayed. If it is -1, the number of columns will be chosen automatically to fill the available area.
  650. -- Allowed values: >= -1
  651. -- Default value: -1
  652. -- Since 2.6
  653. -- The "item-width" property
  654. -- "item-width" gint : Read / Write
  655. -- The width used for each item.
  656. -- Allowed values: >= -1
  657. -- Default value: -1
  658. -- The "margin" property
  659. -- "margin" gint : Read / Write
  660. -- Space which is inserted at the edges of the icon view.
  661. -- Allowed values: >= 0
  662. -- Default value: 6
  663. -- The "markup-column" property
  664. -- "markup-column" gint : Read / Write
  665. -- The ::markup-column property contains the number of the model column containing markup information to be displayed. The markup column must be of type G_TYPE_STRING. If this property and the :text-column property are both set to column numbers, it overrides the text column. If both are set to -1, no texts are displayed.
  666. -- Allowed values: >= -1
  667. -- Default value: -1
  668. -- Since 2.6
  669. -- The "model" property
  670. -- "model" GtkTreeModel : Read / Write
  671. -- The model for the icon view.
  672. -- The "orientation" property
  673. -- "orientation" GtkOrientation : Read / Write
  674. -- How the text and icon of each item are positioned relative to each other.
  675. -- Default value: GTK_ORIENTATION_VERTICAL
  676. -- The "pixbuf-column" property
  677. -- "pixbuf-column" gint : Read / Write
  678. -- The ::pixbuf-column property contains the number of the model column containing the pixbufs which are displayed. The pixbuf column must be of type GDK_TYPE_PIXBUF. Setting this property to -1 turns off the display of pixbufs.
  679. -- Allowed values: >= -1
  680. -- Default value: -1
  681. -- Since 2.6
  682. -- The "reorderable" property
  683. -- "reorderable" gboolean : Read / Write
  684. -- The reorderable property specifies if the items can be reordered by drag-and-drop.
  685. -- Default value: FALSE
  686. -- Since 2.8
  687. -- The "row-spacing" property
  688. -- "row-spacing" gint : Read / Write
  689. -- Space which is inserted between grid rows.
  690. -- Allowed values: >= 0
  691. -- Default value: 6
  692. -- The "selection-mode" property
  693. -- "selection-mode" GtkSelectionMode : Read / Write
  694. -- The ::selection-mode property specifies the selection mode of icon view. If the mode is GTK_SELECTION_MULTIPLE, rubberband selection is enabled, for the other modes, only keyboard selection is possible.
  695. -- Default value: GTK_SELECTION_SINGLE
  696. -- Since 2.6
  697. -- The "spacing" property
  698. -- "spacing" gint : Read / Write
  699. -- Space which is inserted between cells of an item.
  700. -- Allowed values: >= 0
  701. -- Default value: 0
  702. -- The "text-column" property
  703. -- "text-column" gint : Read / Write
  704. -- The ::text-column property contains the number of the model column containing the texts which are displayed. The text column must be of type G_TYPE_STRING. If this property and the :markup-column property are both set to -1, no texts are displayed.
  705. -- Allowed values: >= -1
  706. -- Default value: -1
  707. -- Since 2.6
  708. feature -- TODO: Style Properties
  709. -- "selection-box-alpha" guchar : Read
  710. -- "selection-box-color" GdkColor : Read
  711. -- Style Property Details
  712. -- The "selection-box-alpha" style property
  713. -- "selection-box-alpha" guchar : Read
  714. -- Opacity of the selection box.
  715. -- Default value: 64
  716. -- The "selection-box-color" style property
  717. -- "selection-box-color" GdkColor : Read
  718. -- Color of the selection box.
  719. feature -- TODO: Signals
  720. -- "activate-cursor-item"
  721. -- gboolean user_function (GtkIconView *iconview,
  722. -- gpointer user_data);
  723. -- "item-activated"
  724. -- void user_function (GtkIconView *iconview,
  725. -- GtkTreePath *arg1,
  726. -- gpointer user_data);
  727. -- "move-cursor"
  728. -- gboolean user_function (GtkIconView *iconview,
  729. -- GtkMovementStep arg1,
  730. -- gint arg2,
  731. -- gpointer user_data);
  732. -- "select-all"
  733. -- void user_function (GtkIconView *iconview,
  734. -- gpointer user_data);
  735. -- "select-cursor-item"
  736. -- void user_function (GtkIconView *iconview,
  737. -- gpointer user_data);
  738. -- "selection-changed"
  739. -- void user_function (GtkIconView *iconview,
  740. -- gpointer user_data);
  741. -- "set-scroll-adjustments"
  742. -- void user_function (GtkIconView *iconview,
  743. -- GtkAdjustment *arg1,
  744. -- GtkAdjustment *arg2,
  745. -- gpointer user_data);
  746. -- "toggle-cursor-item"
  747. -- void user_function (GtkIconView *iconview,
  748. -- gpointer user_data);
  749. -- "unselect-all"
  750. -- void user_function (GtkIconView *iconview,
  751. -- gpointer user_data);
  752. -- Signal Details
  753. -- The "activate-cursor-item" signal
  754. -- gboolean user_function (GtkIconView *iconview,
  755. -- gpointer user_data);
  756. -- iconview : the object which received the signal.
  757. -- user_data : user data set when the signal handler was connected.
  758. -- Returns :
  759. -- The "item-activated" signal
  760. -- void user_function (GtkIconView *iconview,
  761. -- GtkTreePath *arg1,
  762. -- gpointer user_data);
  763. -- iconview : the object which received the signal.
  764. -- arg1 :
  765. -- user_data : user data set when the signal handler was connected.
  766. -- The "move-cursor" signal
  767. -- gboolean user_function (GtkIconView *iconview,
  768. -- GtkMovementStep arg1,
  769. -- gint arg2,
  770. -- gpointer user_data);
  771. -- iconview : the object which received the signal.
  772. -- arg1 :
  773. -- arg2 :
  774. -- user_data : user data set when the signal handler was connected.
  775. -- Returns :
  776. -- The "select-all" signal
  777. -- void user_function (GtkIconView *iconview,
  778. -- gpointer user_data);
  779. -- iconview : the object which received the signal.
  780. -- user_data : user data set when the signal handler was connected.
  781. -- The "select-cursor-item" signal
  782. -- void user_function (GtkIconView *iconview,
  783. -- gpointer user_data);
  784. -- iconview : the object which received the signal.
  785. -- user_data : user data set when the signal handler was connected.
  786. -- The "selection-changed" signal
  787. -- void user_function (GtkIconView *iconview,
  788. -- gpointer user_data);
  789. -- iconview : the object which received the signal.
  790. -- user_data : user data set when the signal handler was connected.
  791. -- The "set-scroll-adjustments" signal
  792. -- void user_function (GtkIconView *iconview,
  793. -- GtkAdjustment *arg1,
  794. -- GtkAdjustment *arg2,
  795. -- gpointer user_data);
  796. -- iconview : the object which received the signal.
  797. -- arg1 :
  798. -- arg2 :
  799. -- user_data : user data set when the signal handler was connected.
  800. -- The "toggle-cursor-item" signal
  801. -- void user_function (GtkIconView *iconview,
  802. -- gpointer user_data);
  803. -- iconview : the object which received the signal.
  804. -- user_data : user data set when the signal handler was connected.
  805. -- The "unselect-all" signal
  806. -- void user_function (GtkIconView *iconview,
  807. -- gpointer user_data);
  808. -- iconview : the object which received the signal.
  809. -- user_data : user data set when the signal handler was connected.
  810. feature
  811. struct_size: INTEGER is
  812. external "C inline use <gtk/gtk.h>"
  813. alias "sizeof(GtkIconView)"
  814. end
  815. end -- class GTK_ICON_VIEW