1 // Generated by gmmproc 2.60.0 -- DO NOT MODIFY!
2 #ifndef _GTKMM_TREEVIEWCOLUMN_H
3 #define _GTKMM_TREEVIEWCOLUMN_H
4
5 #include <gtkmmconfig.h>
6
7
8 #include <glibmm/ustring.h>
9 #include <sigc++/sigc++.h>
10
11 /* Copyright(C) 2002 The gtkmm Development Team
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or(at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 */
27
28 // This is for including the config header before any code (such as
29 // the #ifndef GTKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
30
31
32 #include <gtkmm/treeiter.h>
33 #include <gtkmm/button.h>
34 #include <gdkmm/window.h>
35 #include <gtkmm/treemodel.h>
36 #include <gtkmm/celllayout.h>
37 #include <gtkmm/cellrenderer_generation.h>
38
39
40 #ifndef DOXYGEN_SHOULD_SKIP_THIS
41 using GtkTreeViewColumn = struct _GtkTreeViewColumn;
42 using GtkTreeViewColumnClass = struct _GtkTreeViewColumnClass;
43 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
44
45
46 #ifndef DOXYGEN_SHOULD_SKIP_THIS
47 namespace Gtk
48 { class TreeViewColumn_Class; } // namespace Gtk
49 #endif //DOXYGEN_SHOULD_SKIP_THIS
50
51 namespace Gtk
52 {
53
54
55 /** @addtogroup gtkmmEnums gtkmm Enums and Flags */
56
57 /**
58 * @var TreeViewColumnSizing TREE_VIEW_COLUMN_GROW_ONLY
59 * Columns only get bigger in reaction to changes in the model.
60 *
61 * @var TreeViewColumnSizing TREE_VIEW_COLUMN_AUTOSIZE
62 * Columns resize to be the optimal size everytime the model changes.
63 *
64 * @var TreeViewColumnSizing TREE_VIEW_COLUMN_FIXED
65 * Columns are a fixed numbers of pixels wide.
66 *
67 * @enum TreeViewColumnSizing
68 *
69 * The sizing method the column uses to determine its width. Please note
70 * that @a GTK_TREE_VIEW_COLUMN_AUTOSIZE are inefficient for large views, and
71 * can make columns appear choppy.
72 *
73 * @ingroup gtkmmEnums
74 */
75 enum TreeViewColumnSizing
76 {
77 TREE_VIEW_COLUMN_GROW_ONLY,
78 TREE_VIEW_COLUMN_AUTOSIZE,
79 TREE_VIEW_COLUMN_FIXED
80 };
81
82 } // namespace Gtk
83
84 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85 namespace Glib
86 {
87
88 template <>
89 class Value<Gtk::TreeViewColumnSizing> : public Glib::Value_Enum<Gtk::TreeViewColumnSizing>
90 {
91 public:
92 static GType value_type() G_GNUC_CONST;
93 };
94
95 } // namespace Glib
96 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
97
98 namespace Gtk
99 {
100
101
102 // We use GTKMM_API here because gcc needs the extra help on win32 , even
103 // when using --export-all and auto-import.
104 // See http://bugzilla.gnome.org/show_bug.cgi?id=309030.
105
106 class TreeView;
107
108 //TODO: Deal with the GtkObject->GObject change?
109 /** Typedefed as Gtk::TreeView::Column.
110 * This is a visible column in a Gtk::TreeView widget. It determines the geometry, type.
111 *
112 * @ingroup TreeView
113 */
114
115 class GTKMM_API TreeViewColumn
116 : public Object,
117 public CellLayout
118 {
119 public:
120 #ifndef DOXYGEN_SHOULD_SKIP_THIS
121 typedef TreeViewColumn CppObjectType;
122 typedef TreeViewColumn_Class CppClassType;
123 typedef GtkTreeViewColumn BaseObjectType;
124 typedef GtkTreeViewColumnClass BaseClassType;
125 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
126
127 TreeViewColumn(TreeViewColumn&& src) noexcept;
128 TreeViewColumn& operator=(TreeViewColumn&& src) noexcept;
129
130 // noncopyable
131 TreeViewColumn(const TreeViewColumn&) = delete;
132 TreeViewColumn& operator=(const TreeViewColumn&) = delete;
133
134 ~TreeViewColumn() noexcept override;
135
136 #ifndef DOXYGEN_SHOULD_SKIP_THIS
137
138 private:
139 friend class TreeViewColumn_Class;
140 static CppClassType treeviewcolumn_class_;
141
142 protected:
143 explicit TreeViewColumn(const Glib::ConstructParams& construct_params);
144 explicit TreeViewColumn(GtkTreeViewColumn* castitem);
145
146 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
147
148 public:
149
150 /** Get the GType for this class, for use with the underlying GObject type system.
151 */
152 static GType get_type() G_GNUC_CONST;
153
154 #ifndef DOXYGEN_SHOULD_SKIP_THIS
155
156
157 static GType get_base_type() G_GNUC_CONST;
158 #endif
159
160 /// Provides access to the underlying C GObject.
gobj()161 GtkTreeViewColumn* gobj() { return reinterpret_cast<GtkTreeViewColumn*>(gobject_); }
162
163 /// Provides access to the underlying C GObject.
gobj()164 const GtkTreeViewColumn* gobj() const { return reinterpret_cast<GtkTreeViewColumn*>(gobject_); }
165
166
167 public:
168 //C++ methods used to invoke GTK+ virtual functions:
169
170 protected:
171 //GTK+ Virtual Functions (override these to change behaviour):
172
173 //Default Signal Handlers::
174 /// This is a default handler for the signal signal_clicked().
175 virtual void on_clicked();
176
177
178 private:
179
180
181 public:
182 typedef TreeViewColumn Column;
183
184 TreeViewColumn();
185
186 explicit TreeViewColumn(const Glib::ustring& title);
187 TreeViewColumn(const Glib::ustring& title, CellRenderer& cell);
188
189 /** Create a default view column for the given model column type.
190 */
191 template<class T_ModelColumnType>
192 TreeViewColumn(const Glib::ustring& title, const TreeModelColumn<T_ModelColumnType>& column);
193
194
195 /** Packs the @a cell into the beginning of the column. If @a expand is <tt>false</tt>, then
196 * the @a cell is allocated no more space than it needs. Any unused space is divided
197 * evenly between cells for which @a expand is <tt>true</tt>.
198 *
199 * @param cell The Gtk::CellRenderer.
200 * @param expand <tt>true</tt> if @a cell is to be given extra space allocated to @a tree_column.
201 */
202 void pack_start(CellRenderer& cell, bool expand = true);
203
204 /** Adds the @a cell to end of the column. If @a expand is <tt>false</tt>, then the @a cell
205 * is allocated no more space than it needs. Any unused space is divided
206 * evenly between cells for which @a expand is <tt>true</tt>.
207 *
208 * @param cell The Gtk::CellRenderer.
209 * @param expand <tt>true</tt> if @a cell is to be given extra space allocated to @a tree_column.
210 */
211 void pack_end(CellRenderer& cell, bool expand = true);
212
213 /** Creates an appropriate CellRenderer for the @a column, and packs that cell into the beginning of the column.
214 * If @a expand is <tt>false</tt>, then
215 * the cell is allocated no more space than it needs. Any unused space is divided
216 * evenly between cells for which @a expand is <tt>true</tt>.
217 *
218 * You can use get_first_cell() or get_cells() to access the generated CellRenderer.
219 *
220 * @param column The model column that will be rendered by the view cell.
221 * @param expand <tt>true</tt> if the cell is to be given extra space allocated to the view column.
222 */
223 template<class T_ModelColumnType>
224 void pack_start(const TreeModelColumn<T_ModelColumnType>& column, bool expand = true);
225
226 /** Creates an appropriate CellRenderer for the @a column, and packs that cell at the end of the column.
227 * If @a expand is <tt>false</tt>, then
228 * the cell is allocated no more space than it needs. Any unused space is divided
229 * evenly between cells for which @a expand is <tt>true</tt>.
230 *
231 * You can use get_first_cell() or get_cells() to access the generated CellRenderer.
232 *
233 * @param column The model column that will be rendered by the view cell.
234 * @param expand <tt>true</tt> if the cell is to be given extra space allocated to the view column.
235 */
236 template<class T_ModelColumnType>
237 void pack_end(const TreeModelColumn<T_ModelColumnType>& column, bool expand = true);
238
239
240 /** Unsets all the mappings on all renderers on the @a tree_column.
241 */
242 void clear();
243
244
245 /** Adds an attribute mapping to the list in @a tree_column. The @a column is the
246 * column of the model to get a value from, and the @a attribute is the
247 * parameter on @a cell_renderer to be set from the value. So for example
248 * if column 2 of the model contains strings, you could have the
249 * “text” attribute of a Gtk::CellRendererText get its values from
250 * column 2.
251 *
252 * @param cell_renderer The Gtk::CellRenderer to set attributes on.
253 * @param attribute An attribute on the renderer.
254 * @param column The column position on the model to get the attribute from.
255 */
256 void add_attribute(CellRenderer& cell_renderer, const Glib::ustring& attribute, int column);
257
258 void add_attribute(const Glib::PropertyProxy_Base& property, const TreeModelColumnBase& column);
259
260 void add_attribute(Gtk::CellRenderer& cell, const Glib::ustring& property_name, const TreeModelColumnBase& column);
261
262
263 /** Associate a view CellRenderer with a model column, so that the CellRenderer renders the data in the model column.
264 *
265 * @param renderer The view cell renderer which will render the model column.
266 * @param column The model column to be renderered by this view.
267 */
268 void set_renderer(Gtk::CellRenderer& renderer, const TreeModelColumnBase& column);
269
270 // _WRAP_METHOD(void set_attributes(CellRenderer& cell_renderer, ...), )
271
272 #ifndef GTKMM_DISABLE_DEPRECATED
273
274 /** For instance,
275 * void on_cell_data(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
276 *
277 * This function is used instead of the standard attributes mapping for setting the column value, and should set the
278 * value of the column's cell renderer as appropriate.
279 *
280 * @deprecated Use SlotTreeCellData instead.
281 */
282 typedef sigc::slot<void, CellRenderer*, const Gtk::TreeModel::iterator&> SlotCellData;
283 #endif // GTKMM_DISABLE_DEPRECATED
284
285
286 /** For instance,
287 * void on_cell_data(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
288 *
289 * This function is used instead of the standard attributes mapping for setting the column value, and should set the
290 * value of the column's cell renderer as appropriate.
291 */
292 typedef sigc::slot<void, CellRenderer*, const Gtk::TreeModel::iterator&> SlotTreeCellData;
293
294 /** Sets the slot callback to use for the column.
295 * This callback function is used instead of the standard attributes mapping for setting the column value, and should set the
296 * value of the column's cell renderer as appropriate.
297 *
298 * See also unset_cell_data_func().
299 *
300 * @param cell_renderer A Gtk::CellRenderer
301 * @param slot The callback slot to use. Create this with sigc::mem_fun(), or sigc::ptr_fun().
302 */
303 void set_cell_data_func(CellRenderer& cell_renderer, const SlotTreeCellData& slot);
304
305 /** Removes a previously set callback slot. See set_cell_data_func().
306 */
307 void unset_cell_data_func(CellRenderer& cell_renderer);
308
309
310 /** Clears all existing attributes previously set with
311 * set_attributes().
312 *
313 * @param cell_renderer A Gtk::CellRenderer to clear the attribute mapping on.
314 */
315 void clear_attributes(CellRenderer& cell_renderer);
316
317 /** Sets the spacing field of @a tree_column, which is the number of pixels to
318 * place between cell renderers packed into it.
319 *
320 * @param spacing Distance between cell renderers in pixels.
321 */
322 void set_spacing(int spacing);
323
324 /** Returns the spacing of @a tree_column.
325 *
326 * @return The spacing of @a tree_column.
327 */
328 int get_spacing() const;
329
330 /** Sets the visibility of @a tree_column.
331 *
332 * @param visible <tt>true</tt> if the @a tree_column is visible.
333 */
334 void set_visible(bool visible = true);
335
336 /** Returns <tt>true</tt> if @a tree_column is visible.
337 *
338 * @return Whether the column is visible or not. If it is visible, then
339 * the tree will show the column.
340 */
341 bool get_visible() const;
342
343 /** If @a resizable is <tt>true</tt>, then the user can explicitly resize the column by
344 * grabbing the outer edge of the column button. If resizable is <tt>true</tt> and
345 * sizing mode of the column is Gtk::TREE_VIEW_COLUMN_AUTOSIZE, then the sizing
346 * mode is changed to Gtk::TREE_VIEW_COLUMN_GROW_ONLY.
347 *
348 * @param resizable <tt>true</tt>, if the column can be resized.
349 */
350 void set_resizable(bool resizable = true);
351
352 /** Returns <tt>true</tt> if the @a tree_column can be resized by the end user.
353 *
354 * @return <tt>true</tt>, if the @a tree_column can be resized.
355 */
356 bool get_resizable() const;
357
358 /** Sets the growth behavior of @a tree_column to @a type.
359 *
360 * @param type The Gtk::TreeViewColumnSizing.
361 */
362 void set_sizing(TreeViewColumnSizing type);
363
364 /** Returns the current type of @a tree_column.
365 *
366 * @return The type of @a tree_column.
367 */
368 TreeViewColumnSizing get_sizing();
369
370 /** Returns the current X offset of @a tree_column in pixels.
371 *
372 * @newin{3,2}
373 *
374 * @return The current X offset of @a tree_column.
375 */
376 int get_x_offset() const;
377
378 /** Returns the current size of @a tree_column in pixels.
379 *
380 * @return The current width of @a tree_column.
381 */
382 int get_width() const;
383
384 /** Gets the fixed width of the column. This may not be the actual displayed
385 * width of the column; for that, use get_width().
386 *
387 * @return The fixed width of the column.
388 */
389 int get_fixed_width() const;
390
391 /** If @a fixed_width is not -1, sets the fixed width of @a tree_column; otherwise
392 * unsets it. The effective value of @a fixed_width is clamped between the
393 * minimum and maximum width of the column; however, the value stored in the
394 * “fixed-width” property is not clamped. If the column sizing is
395 * Gtk::TREE_VIEW_COLUMN_GROW_ONLY or Gtk::TREE_VIEW_COLUMN_AUTOSIZE, setting
396 * a fixed width overrides the automatically calculated width. Note that
397 * @a fixed_width is only a hint to GTK+; the width actually allocated to the
398 * column may be greater or less than requested.
399 *
400 * Along with “expand”, the “fixed-width” property changes when the column is
401 * resized by the user.
402 *
403 * @param fixed_width The new fixed width, in pixels, or -1.
404 */
405 void set_fixed_width(int fixed_width);
406
407 /** Sets the minimum width of the @a tree_column. If @a min_width is -1, then the
408 * minimum width is unset.
409 *
410 * @param min_width The minimum width of the column in pixels, or -1.
411 */
412 void set_min_width(int min_width);
413
414 /** Returns the minimum width in pixels of the @a tree_column, or -1 if no minimum
415 * width is set.
416 *
417 * @return The minimum width of the @a tree_column.
418 */
419 int get_min_width() const;
420
421 /** Sets the maximum width of the @a tree_column. If @a max_width is -1, then the
422 * maximum width is unset. Note, the column can actually be wider than max
423 * width if it’s the last column in a view. In this case, the column expands to
424 * fill any extra space.
425 *
426 * @param max_width The maximum width of the column in pixels, or -1.
427 */
428 void set_max_width(int max_width);
429
430 /** Returns the maximum width in pixels of the @a tree_column, or -1 if no maximum
431 * width is set.
432 *
433 * @return The maximum width of the @a tree_column.
434 */
435 int get_max_width() const;
436
437 /** Emits the “clicked” signal on the column. This function will only work if
438 * @a tree_column is clickable.
439 */
440 void clicked();
441
442
443 /** Sets the title of the @a tree_column. If a custom widget has been set, then
444 * this value is ignored.
445 *
446 * @param title The title of the @a tree_column.
447 */
448 void set_title(const Glib::ustring& title);
449
450 /** Returns the title of the widget.
451 *
452 * @return The title of the column. This string should not be
453 * modified or freed.
454 */
455 Glib::ustring get_title() const;
456
457
458 /** Sets the column to take available extra space. This space is shared equally
459 * amongst all columns that have the expand set to <tt>true</tt>. If no column has this
460 * option set, then the last column gets all extra space. By default, every
461 * column is created with this <tt>false</tt>.
462 *
463 * Along with “fixed-width”, the “expand” property changes when the column is
464 * resized by the user.
465 *
466 * @newin{2,4}
467 *
468 * @param expand <tt>true</tt> if the column should expand to fill available space.
469 */
470 void set_expand(bool expand = true);
471
472 /** Returns <tt>true</tt> if the column expands to fill available space.
473 *
474 * @newin{2,4}
475 *
476 * @return <tt>true</tt> if the column expands to fill available space.
477 */
478 bool get_expand() const;
479
480
481 /** Sets the header to be active if @a clickable is <tt>true</tt>. When the header is
482 * active, then it can take keyboard focus, and can be clicked.
483 *
484 * @param clickable <tt>true</tt> if the header is active.
485 */
486 void set_clickable(bool clickable = true);
487
488 /** Returns <tt>true</tt> if the user can click on the header for the column.
489 *
490 * @return <tt>true</tt> if user can click the column header.
491 */
492 bool get_clickable() const;
493
494 /** Sets the widget in the header to be @a widget. If widget is <tt>nullptr</tt>, then the
495 * header button is set with a Gtk::Label set to the title of @a tree_column.
496 *
497 * @param widget A child Gtk::Widget, or <tt>nullptr</tt>.
498 */
499 void set_widget(Gtk::Widget& widget);
500
501 /** Returns the Gtk::Widget in the button on the column header.
502 * If a custom widget has not been set then <tt>nullptr</tt> is returned.
503 *
504 * @return The Gtk::Widget in the column
505 * header, or <tt>nullptr</tt>.
506 */
507 Widget* get_widget();
508
509 /** Returns the Gtk::Widget in the button on the column header.
510 * If a custom widget has not been set then <tt>nullptr</tt> is returned.
511 *
512 * @return The Gtk::Widget in the column
513 * header, or <tt>nullptr</tt>.
514 */
515 const Widget* get_widget() const;
516
517
518 /** Sets the alignment of the title or custom widget inside the column header.
519 * The alignment determines its location inside the button -- 0.0 for left, 0.5
520 * for center, 1.0 for right.
521 *
522 * @param xalign The alignment, which is between [0.0 and 1.0] inclusive.
523 */
524 void set_alignment(float xalign);
525
526 /** Sets the alignment of the title or custom widget inside the column header.
527 * The alignment determines its location inside the button -- 0.0 for left, 0.5
528 * for center, 1.0 for right.
529 *
530 * @param xalign The alignment, which is between [0.0 and 1.0] inclusive.
531 */
532 void set_alignment(Align xalign);
533
534
535 /** Returns the current x alignment of @a tree_column. This value can range
536 * between 0.0 and 1.0.
537 *
538 * @return The current alignent of @a tree_column.
539 */
540 float get_alignment() const;
541
542 /** If @a reorderable is <tt>true</tt>, then the column can be reordered by the end user
543 * dragging the header.
544 *
545 * @param reorderable <tt>true</tt>, if the column can be reordered.
546 */
547 void set_reorderable(bool reorderable = true);
548
549 /** Returns <tt>true</tt> if the @a tree_column can be reordered by the user.
550 *
551 * @return <tt>true</tt> if the @a tree_column can be reordered by the user.
552 */
553 bool get_reorderable() const;
554
555
556 /** Sets the logical @a sort_column_id that this column sorts on when this column
557 * is selected for sorting. Doing so makes the column header clickable.
558 *
559 * @param sort_column_id The @a sort_column_id of the model to sort on.
560 */
561 void set_sort_column(const TreeModelColumnBase& sort_column_id);
562
563 /** Sets the logical @a sort_column_id that this column sorts on when this column
564 * is selected for sorting. Doing so makes the column header clickable.
565 *
566 * @param sort_column_id The @a sort_column_id of the model to sort on.
567 */
568 void set_sort_column(int sort_column_id);
569
570
571 /** Gets the logical @a sort_column_id that the model sorts on when this
572 * column is selected for sorting.
573 * See set_sort_column_id().
574 *
575 * @return The current @a sort_column_id for this column, or -1 if
576 * this column can’t be used for sorting.
577 */
578 int get_sort_column_id() const;
579
580 /** Call this function with a @a setting of <tt>true</tt> to display an arrow in
581 * the header button indicating the column is sorted. Call
582 * set_sort_order() to change the direction of
583 * the arrow.
584 *
585 * @param setting <tt>true</tt> to display an indicator that the column is sorted.
586 */
587 void set_sort_indicator(bool setting);
588
589 /** Gets the value set by set_sort_indicator().
590 *
591 * @return Whether the sort indicator arrow is displayed.
592 */
593 bool get_sort_indicator() const;
594
595 /** Changes the appearance of the sort indicator.
596 *
597 * This does not actually sort the model. Use
598 * set_sort_column_id() if you want automatic sorting
599 * support. This function is primarily for custom sorting behavior, and should
600 * be used in conjunction with Gtk::TreeSortable::set_sort_column_id() to do
601 * that. For custom models, the mechanism will vary.
602 *
603 * The sort indicator changes direction to indicate normal sort or reverse sort.
604 * Note that you must have the sort indicator enabled to see anything when
605 * calling this function; see set_sort_indicator().
606 *
607 * @param order Sort order that the sort indicator should indicate.
608 */
609 void set_sort_order(SortType order);
610
611 /** Gets the value set by set_sort_order().
612 *
613 * @return The sort order the sort indicator is indicating.
614 */
615 SortType get_sort_order() const;
616
617
618 /** Sets the cell renderer based on the @a tree_model and @a iter. That is, for
619 * every attribute mapping in @a tree_column, it will get a value from the set
620 * column on the @a iter, and use that value to set the attribute on the cell
621 * renderer. This is used primarily by the Gtk::TreeView.
622 *
623 * @param tree_model The Gtk::TreeModel to to get the cell renderers attributes from.
624 * @param iter The Gtk::TreeIter to to get the cell renderer’s attributes from.
625 * @param is_expander <tt>true</tt>, if the row has children.
626 * @param is_expanded <tt>true</tt>, if the row has visible children.
627 */
628 void cell_set_cell_data(const Glib::RefPtr<TreeModel>& tree_model, const TreeModel::iterator& iter, bool is_expander, bool is_expanded);
629
630 //TODO: cell_area can be NULL. Add a method overload.
631 //But see http://bugzilla.gnome.org/show_bug.cgi?id=542329 about the lack of C documentation.
632
633 /** Obtains the width and height needed to render the column. This is used
634 * primarily by the Gtk::TreeView.
635 *
636 * @param cell_area The area a cell in the column will be allocated.
637 * @param x_offset Location to return x offset of a cell relative to @a cell_area.
638 * @param y_offset Location to return y offset of a cell relative to @a cell_area.
639 * @param width Location to return width needed to render a cell.
640 * @param height Location to return height needed to render a cell.
641 */
642 void cell_get_size(const Gdk::Rectangle& cell_area, int& x_offset, int& y_offset, int& width, int& height) const;
643
644
645 /** Returns <tt>true</tt> if any of the cells packed into the @a tree_column are visible.
646 * For this to be meaningful, you must first initialize the cells with
647 * cell_set_cell_data()
648 *
649 * @return <tt>true</tt>, if any of the cells packed into the @a tree_column are currently visible.
650 */
651 bool cell_is_visible() const;
652
653 /** Sets the current keyboard focus to be at @a cell, if the column contains
654 * 2 or more editable and activatable cells.
655 *
656 * @newin{2,2}
657 *
658 * @param cell A Gtk::CellRenderer.
659 */
660 void focus_cell(CellRenderer& cell);
661
662
663 /** Obtains the horizontal position and size of a cell in a column. If the
664 * cell is not found in the column, @a start_pos and @a width are not changed and
665 * <tt>false</tt> is returned.
666 *
667 * @param cell_renderer A Gtk::CellRenderer.
668 * @param start_pos Return location for the horizontal position of @a cell within
669 * @a tree_column.
670 * @param width Return location for the width of @a cell.
671 * @return <tt>true</tt> if @a cell belongs to @a tree_column.
672 */
673 bool get_cell_position(const CellRenderer& cell_renderer, int& start_pos, int& width) const;
674
675 /** Flags the column, and the cell renderers added to this column, to have
676 * their sizes renegotiated.
677 *
678 * @newin{2,8}
679 */
680 void queue_resize();
681
682
683 /** Returns the Gtk::TreeView wherein @a tree_column has been inserted.
684 * If @a column is currently not inserted in any tree view, <tt>nullptr</tt> is
685 * returned.
686 *
687 * @newin{2,12}
688 *
689 * @return The tree view wherein @a column has
690 * been inserted if any, <tt>nullptr</tt> otherwise.
691 */
692 TreeView* get_tree_view();
693
694 /** Returns the Gtk::TreeView wherein @a tree_column has been inserted.
695 * If @a column is currently not inserted in any tree view, <tt>nullptr</tt> is
696 * returned.
697 *
698 * @newin{2,12}
699 *
700 * @return The tree view wherein @a column has
701 * been inserted if any, <tt>nullptr</tt> otherwise.
702 */
703 const TreeView* get_tree_view() const;
704
705
706 /** Returns the button used in the treeview column header
707 *
708 * @newin{3,0}
709 *
710 * @return The button for the column header.
711 */
712 Button* get_button();
713
714 /** Returns the button used in the treeview column header
715 *
716 * @newin{3,0}
717 *
718 * @return The button for the column header.
719 */
720 const Button* get_button() const;
721
722
723 /**
724 * @par Slot Prototype:
725 * <tt>void on_my_%clicked()</tt>
726 *
727 * Flags: Run Last
728 *
729 */
730
731 Glib::SignalProxy< void > signal_clicked();
732
733
734 /** Whether to display the column.
735 *
736 * Default value: <tt>true</tt>
737 *
738 * @return A PropertyProxy that allows you to get or set the value of the property,
739 * or receive notification when the value of the property changes.
740 */
741 Glib::PropertyProxy< bool > property_visible() ;
742
743 /** Whether to display the column.
744 *
745 * Default value: <tt>true</tt>
746 *
747 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
748 * or receive notification when the value of the property changes.
749 */
750 Glib::PropertyProxy_ReadOnly< bool > property_visible() const;
751
752 /** Column is user-resizable.
753 *
754 * Default value: <tt>false</tt>
755 *
756 * @return A PropertyProxy that allows you to get or set the value of the property,
757 * or receive notification when the value of the property changes.
758 */
759 Glib::PropertyProxy< bool > property_resizable() ;
760
761 /** Column is user-resizable.
762 *
763 * Default value: <tt>false</tt>
764 *
765 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
766 * or receive notification when the value of the property changes.
767 */
768 Glib::PropertyProxy_ReadOnly< bool > property_resizable() const;
769
770 /** Current X position of the column.
771 *
772 * Default value: 0
773 *
774 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
775 * or receive notification when the value of the property changes.
776 */
777 Glib::PropertyProxy_ReadOnly< int > property_x_offset() const;
778
779
780 /** Current width of the column.
781 *
782 * Default value: 0
783 *
784 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
785 * or receive notification when the value of the property changes.
786 */
787 Glib::PropertyProxy_ReadOnly< int > property_width() const;
788
789
790 /** Space which is inserted between cells.
791 *
792 * Default value: 0
793 *
794 * @return A PropertyProxy that allows you to get or set the value of the property,
795 * or receive notification when the value of the property changes.
796 */
797 Glib::PropertyProxy< int > property_spacing() ;
798
799 /** Space which is inserted between cells.
800 *
801 * Default value: 0
802 *
803 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
804 * or receive notification when the value of the property changes.
805 */
806 Glib::PropertyProxy_ReadOnly< int > property_spacing() const;
807
808 /** Resize mode of the column.
809 *
810 * Default value: Gtk::TREE_VIEW_COLUMN_GROW_ONLY
811 *
812 * @return A PropertyProxy that allows you to get or set the value of the property,
813 * or receive notification when the value of the property changes.
814 */
815 Glib::PropertyProxy< TreeViewColumnSizing > property_sizing() ;
816
817 /** Resize mode of the column.
818 *
819 * Default value: Gtk::TREE_VIEW_COLUMN_GROW_ONLY
820 *
821 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
822 * or receive notification when the value of the property changes.
823 */
824 Glib::PropertyProxy_ReadOnly< TreeViewColumnSizing > property_sizing() const;
825
826 /** Current fixed width of the column.
827 *
828 * Default value: -1
829 *
830 * @return A PropertyProxy that allows you to get or set the value of the property,
831 * or receive notification when the value of the property changes.
832 */
833 Glib::PropertyProxy< int > property_fixed_width() ;
834
835 /** Current fixed width of the column.
836 *
837 * Default value: -1
838 *
839 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
840 * or receive notification when the value of the property changes.
841 */
842 Glib::PropertyProxy_ReadOnly< int > property_fixed_width() const;
843
844 /** Minimum allowed width of the column.
845 *
846 * Default value: -1
847 *
848 * @return A PropertyProxy that allows you to get or set the value of the property,
849 * or receive notification when the value of the property changes.
850 */
851 Glib::PropertyProxy< int > property_min_width() ;
852
853 /** Minimum allowed width of the column.
854 *
855 * Default value: -1
856 *
857 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
858 * or receive notification when the value of the property changes.
859 */
860 Glib::PropertyProxy_ReadOnly< int > property_min_width() const;
861
862 /** Maximum allowed width of the column.
863 *
864 * Default value: -1
865 *
866 * @return A PropertyProxy that allows you to get or set the value of the property,
867 * or receive notification when the value of the property changes.
868 */
869 Glib::PropertyProxy< int > property_max_width() ;
870
871 /** Maximum allowed width of the column.
872 *
873 * Default value: -1
874 *
875 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
876 * or receive notification when the value of the property changes.
877 */
878 Glib::PropertyProxy_ReadOnly< int > property_max_width() const;
879
880 /** Title to appear in column header.
881 *
882 * Default value: ""
883 *
884 * @return A PropertyProxy that allows you to get or set the value of the property,
885 * or receive notification when the value of the property changes.
886 */
887 Glib::PropertyProxy< Glib::ustring > property_title() ;
888
889 /** Title to appear in column header.
890 *
891 * Default value: ""
892 *
893 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
894 * or receive notification when the value of the property changes.
895 */
896 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_title() const;
897
898 /** Column gets share of extra width allocated to the widget.
899 *
900 * Default value: <tt>false</tt>
901 *
902 * @return A PropertyProxy that allows you to get or set the value of the property,
903 * or receive notification when the value of the property changes.
904 */
905 Glib::PropertyProxy< bool > property_expand() ;
906
907 /** Column gets share of extra width allocated to the widget.
908 *
909 * Default value: <tt>false</tt>
910 *
911 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
912 * or receive notification when the value of the property changes.
913 */
914 Glib::PropertyProxy_ReadOnly< bool > property_expand() const;
915
916 /** Whether the header can be clicked.
917 *
918 * Default value: <tt>false</tt>
919 *
920 * @return A PropertyProxy that allows you to get or set the value of the property,
921 * or receive notification when the value of the property changes.
922 */
923 Glib::PropertyProxy< bool > property_clickable() ;
924
925 /** Whether the header can be clicked.
926 *
927 * Default value: <tt>false</tt>
928 *
929 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
930 * or receive notification when the value of the property changes.
931 */
932 Glib::PropertyProxy_ReadOnly< bool > property_clickable() const;
933
934 /** Widget to put in column header button instead of column title.
935 *
936 * @return A PropertyProxy that allows you to get or set the value of the property,
937 * or receive notification when the value of the property changes.
938 */
939 Glib::PropertyProxy< Widget* > property_widget() ;
940
941 /** Widget to put in column header button instead of column title.
942 *
943 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
944 * or receive notification when the value of the property changes.
945 */
946 Glib::PropertyProxy_ReadOnly< Widget* > property_widget() const;
947
948 /** X Alignment of the column header text or widget.
949 *
950 * Default value: 0
951 *
952 * @return A PropertyProxy that allows you to get or set the value of the property,
953 * or receive notification when the value of the property changes.
954 */
955 Glib::PropertyProxy< float > property_alignment() ;
956
957 /** X Alignment of the column header text or widget.
958 *
959 * Default value: 0
960 *
961 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
962 * or receive notification when the value of the property changes.
963 */
964 Glib::PropertyProxy_ReadOnly< float > property_alignment() const;
965
966 /** Whether the column can be reordered around the headers.
967 *
968 * Default value: <tt>false</tt>
969 *
970 * @return A PropertyProxy that allows you to get or set the value of the property,
971 * or receive notification when the value of the property changes.
972 */
973 Glib::PropertyProxy< bool > property_reorderable() ;
974
975 /** Whether the column can be reordered around the headers.
976 *
977 * Default value: <tt>false</tt>
978 *
979 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
980 * or receive notification when the value of the property changes.
981 */
982 Glib::PropertyProxy_ReadOnly< bool > property_reorderable() const;
983
984 /** Whether to show a sort indicator.
985 *
986 * Default value: <tt>false</tt>
987 *
988 * @return A PropertyProxy that allows you to get or set the value of the property,
989 * or receive notification when the value of the property changes.
990 */
991 Glib::PropertyProxy< bool > property_sort_indicator() ;
992
993 /** Whether to show a sort indicator.
994 *
995 * Default value: <tt>false</tt>
996 *
997 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
998 * or receive notification when the value of the property changes.
999 */
1000 Glib::PropertyProxy_ReadOnly< bool > property_sort_indicator() const;
1001
1002 /** Sort direction the sort indicator should indicate.
1003 *
1004 * Default value: Gtk::SORT_ASCENDING
1005 *
1006 * @return A PropertyProxy that allows you to get or set the value of the property,
1007 * or receive notification when the value of the property changes.
1008 */
1009 Glib::PropertyProxy< SortType > property_sort_order() ;
1010
1011 /** Sort direction the sort indicator should indicate.
1012 *
1013 * Default value: Gtk::SORT_ASCENDING
1014 *
1015 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
1016 * or receive notification when the value of the property changes.
1017 */
1018 Glib::PropertyProxy_ReadOnly< SortType > property_sort_order() const;
1019
1020 /** Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header
1021 * clickable. Set to -1 to make the column unsortable.
1022 *
1023 * @newin{2,18}
1024 *
1025 * Default value: -1
1026 *
1027 * @return A PropertyProxy that allows you to get or set the value of the property,
1028 * or receive notification when the value of the property changes.
1029 */
1030 Glib::PropertyProxy< int > property_sort_column_id() ;
1031
1032 /** Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header
1033 * clickable. Set to -1 to make the column unsortable.
1034 *
1035 * @newin{2,18}
1036 *
1037 * Default value: -1
1038 *
1039 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
1040 * or receive notification when the value of the property changes.
1041 */
1042 Glib::PropertyProxy_ReadOnly< int > property_sort_column_id() const;
1043
1044 /** The Gtk::CellArea used to layout cell renderers for this column.
1045 *
1046 * If no area is specified when creating the tree view column with Gtk::TreeViewColumn::new_with_area()
1047 * a horizontally oriented Gtk::CellAreaBox will be used.
1048 *
1049 * @newin{3,0}
1050 *
1051 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
1052 * or receive notification when the value of the property changes.
1053 */
1054 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<CellArea> > property_cell_area() const;
1055
1056
1057 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1058 private:
1059 // Only necessary because of the templated ctor, see below.
1060 static const Glib::Class& class_init_();
1061 #endif //DOXYGEN_SHOULD_SKIP_THIS
1062
1063
1064 };
1065
1066 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1067
1068 template<class T_ModelColumnType> inline
pack_start(const TreeModelColumn<T_ModelColumnType> & column,bool expand)1069 void TreeViewColumn::pack_start(const TreeModelColumn<T_ModelColumnType>& column, bool expand)
1070 {
1071 //Generate appropriate Renderer for the column:
1072 CellRenderer* pCellRenderer = manage( CellRenderer_Generation::generate_cellrenderer<T_ModelColumnType>() );
1073
1074 //Use the renderer:
1075 pack_start(*pCellRenderer, expand);
1076 set_renderer(*pCellRenderer, column);
1077 }
1078
1079 template<class T_ModelColumnType> inline
pack_end(const TreeModelColumn<T_ModelColumnType> & column,bool expand)1080 void TreeViewColumn::pack_end(const TreeModelColumn<T_ModelColumnType>& column, bool expand)
1081 {
1082 //Generate appropriate Renderer for the column:
1083 CellRenderer* pCellRenderer= manage( CellRenderer_Generation::generate_cellrenderer<T_ModelColumnType>() );
1084
1085 //Use the renderer:
1086 pack_end(*pCellRenderer, expand);
1087 set_renderer(*pCellRenderer, column);
1088 }
1089
1090 template <class T_ModelColumnType> inline
TreeViewColumn(const Glib::ustring & title,const TreeModelColumn<T_ModelColumnType> & column)1091 TreeViewColumn::TreeViewColumn(const Glib::ustring& title,
1092 const TreeModelColumn<T_ModelColumnType>& column)
1093 :
1094 Glib::ObjectBase(nullptr), // not (yet) a custom class
1095 Gtk::Object(Glib::ConstructParams(class_init_(), "title", title.c_str(), nullptr))
1096 {
1097 pack_start(column, true /* expand */);
1098 }
1099
1100 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1101
1102 } // namespace Gtk
1103
1104
1105 namespace Glib
1106 {
1107 /** A Glib::wrap() method for this object.
1108 *
1109 * @param object The C instance.
1110 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
1111 * @result A C++ instance that wraps this C instance.
1112 *
1113 * @relates Gtk::TreeViewColumn
1114 */
1115 Gtk::TreeViewColumn* wrap(GtkTreeViewColumn* object, bool take_copy = false);
1116 } //namespace Glib
1117
1118
1119 #endif /* _GTKMM_TREEVIEWCOLUMN_H */
1120
1121