/usr/include/gtkmm-3.0/gtkmm/flowbox.h is in libgtkmm-3.0-dev 3.22.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | // Generated by gmmproc 2.50.0 -- DO NOT MODIFY!
#ifndef _GTKMM_FLOWBOX_H
#define _GTKMM_FLOWBOX_H
#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>
/* Copyright (C) 2014 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gtkmm/container.h>
#include <gtkmm/orientable.h>
#include <gtkmm/flowboxchild.h>
#include <giomm/liststore.h>
#include <glibmm/exceptionhandler.h>
#include <vector>
#include <utility> // std::forward
#ifndef DOXYGEN_SHOULD_SKIP_THIS
using GtkFlowBox = struct _GtkFlowBox;
using GtkFlowBoxClass = struct _GtkFlowBoxClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Gtk
{ class FlowBox_Class; } // namespace Gtk
#endif //DOXYGEN_SHOULD_SKIP_THIS
namespace Gtk
{
/** A container that allows reflowing its children.
*
* A FlowBox positions child widgets in sequence according to its
* orientation.
*
* For instance, with the horizontal orientation, the widgets will be
* arranged from left to right, starting a new row under the previous
* row when necessary. Reducing the width in this case will require more
* rows, so a larger height will be requested.
*
* Likewise, with the vertical orientation, the widgets will be arranged
* from top to bottom, starting a new column to the right when necessary.
* Reducing the height will require more columns, so a larger width will
* be requested.
*
* The children of a FlowBox can be dynamically sorted and filtered.
*
* Although a FlowBox must have only FlowBoxChild children,
* you can add any kind of widget to it via Container::add(), and
* a FlowBoxChild widget will automatically be inserted between
* the box and the widget.
*
* Also see ListBox.
*
* @ingroup Widgets
* @ingroup Containers
*
* @newin{3,12}
*/
class FlowBox
: public Container,
public Orientable
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef FlowBox CppObjectType;
typedef FlowBox_Class CppClassType;
typedef GtkFlowBox BaseObjectType;
typedef GtkFlowBoxClass BaseClassType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
FlowBox(FlowBox&& src) noexcept;
FlowBox& operator=(FlowBox&& src) noexcept;
// noncopyable
FlowBox(const FlowBox&) = delete;
FlowBox& operator=(const FlowBox&) = delete;
~FlowBox() noexcept override;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
friend class FlowBox_Class;
static CppClassType flowbox_class_;
protected:
explicit FlowBox(const Glib::ConstructParams& construct_params);
explicit FlowBox(GtkFlowBox* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
/** Get the GType for this class, for use with the underlying GObject type system.
*/
static GType get_type() G_GNUC_CONST;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GtkObject.
GtkFlowBox* gobj() { return reinterpret_cast<GtkFlowBox*>(gobject_); }
///Provides access to the underlying C GtkObject.
const GtkFlowBox* gobj() const { return reinterpret_cast<GtkFlowBox*>(gobject_); }
public:
//C++ methods used to invoke GTK+ virtual functions:
protected:
//GTK+ Virtual Functions (override these to change behaviour):
//Default Signal Handlers::
/// This is a default handler for the signal signal_child_activated().
virtual void on_child_activated(FlowBoxChild* child);
/// This is a default handler for the signal signal_selected_children_changed().
virtual void on_selected_children_changed();
private:
public:
/** Creates a FlowBox.
*/
FlowBox();
/** For instance: void foreach_child(FlowBox* box, FlowBoxChild* child);
*
* A function used by FlowBox::selected_foreach().
* It will be called on every selected child of the @a box.
*
* @param box FlowBox containing the selected children
* @param child Each selected FlowBoxChild
*
* @newin{3,12}
*/
typedef sigc::slot<void, FlowBox*, FlowBoxChild*> SlotSelectedForeach;
/** For instance: bool on_filter(FlowBoxChild* child);
*
* Will be called for each child after a call to FlowBox::set_filter_func(),
* and it will continue to be called each time a child changes (via
* FlowBoxChild::changed()) or when FlowBox::invalidate_filter()
* is called.
*
* @param child A FlowBoxChild that may be filtered
* @returns <tt>true</tt> if the child should be visible, <tt>false</tt> otherwise
*
* @newin{3,12}
*/
typedef sigc::slot<bool, FlowBoxChild*> SlotFilter;
/** For instance: int on_sort(FlowBoxChild* child1, FlowBoxChild* child2)
*
* Will be called for each child after a call to FlowBox::set_sort_func(),
* and will continue to be called each time a child changes (via
* FlowBoxChild::changed()) and when FlowBox::invalidate_sort()
* is called.
*
* @param child1 The first child.
* @param child2 The second child.
* @returns < 0 if @a child1 should be before @a child2, 0 if
* they are equal, and > 0 otherwise
*
* @newin{3,12}
*/
typedef sigc::slot<int, FlowBoxChild*, FlowBoxChild*> SlotSort;
/** Sets the Gtk::FlowBox::property_homogeneous() property of @a box, controlling
* whether or not all children of @a box are given equal space
* in the box.
*
* @newin{3,12}
*
* @param homogeneous <tt>true</tt> to create equal allotments,
* <tt>false</tt> for variable allotments.
*/
void set_homogeneous(bool homogeneous = true);
/** Returns whether the box is homogeneous (all children are the
* same size). See Gtk::Box::set_homogeneous().
*
* @newin{3,12}
*
* @return <tt>true</tt> if the box is homogeneous.
*/
bool get_homogeneous() const;
/** Sets the vertical space to add between children.
* See the Gtk::FlowBox::property_row_spacing() property.
*
* @newin{3,12}
*
* @param spacing The spacing to use.
*/
void set_row_spacing(guint spacing);
/** Gets the vertical spacing.
*
* @newin{3,12}
*
* @return The vertical spacing.
*/
guint get_row_spacing() const;
/** Sets the horizontal space to add between children.
* See the Gtk::FlowBox::property_column_spacing() property.
*
* @newin{3,12}
*
* @param spacing The spacing to use.
*/
void set_column_spacing(guint spacing);
/** Gets the horizontal spacing.
*
* @newin{3,12}
*
* @return The horizontal spacing.
*/
guint get_column_spacing() const;
/** Sets the minimum number of children to line up
* in @a box’s orientation before flowing.
*
* @newin{3,12}
*
* @param n_children The minimum number of children per line.
*/
void set_min_children_per_line(guint n_children);
/** Gets the minimum number of children per line.
*
* @newin{3,12}
*
* @return The minimum number of children per line.
*/
guint get_min_children_per_line() const;
/** Sets the maximum number of children to request and
* allocate space for in @a box’s orientation.
*
* Setting the maximum number of children per line
* limits the overall natural size request to be no more
* than @a n_children children long in the given orientation.
*
* @newin{3,12}
*
* @param n_children The maximum number of children per line.
*/
void set_max_children_per_line(guint n_children);
/** Gets the maximum number of children per line.
*
* @newin{3,12}
*
* @return The maximum number of children per line.
*/
guint get_max_children_per_line() const;
/** If @a single is <tt>true</tt>, children will be activated when you click
* on them, otherwise you need to double-click.
*
* @newin{3,12}
*
* @param single <tt>true</tt> to emit child-activated on a single click.
*/
void set_activate_on_single_click(bool single = true);
/** Returns whether children activate on single clicks.
*
* @newin{3,12}
*
* @return <tt>true</tt> if children are activated on single click,
* <tt>false</tt> otherwise.
*/
bool get_activate_on_single_click() const;
/** Inserts the @a widget into @a box at @a position.
*
* If a sort function is set, the widget will actually be inserted
* at the calculated position and this function has the same effect
* as Gtk::Container::add().
*
* If @a position is -1, or larger than the total number of children
* in the @a box, then the @a widget will be appended to the end.
*
* @newin{3,12}
*
* @param widget The Gtk::Widget to add.
* @param position The position to insert @a child in.
*/
void insert(Widget& widget, int position);
/** Gets the nth child in the @a box.
*
* @newin{3,12}
*
* @param idx The position of the child.
* @return The child widget, which will
* always be a Gtk::FlowBoxChild or <tt>nullptr</tt> in case no child widget
* with the given index exists.
*/
FlowBoxChild* get_child_at_index(int idx);
/** Gets the nth child in the @a box.
*
* @newin{3,12}
*
* @param idx The position of the child.
* @return The child widget, which will
* always be a Gtk::FlowBoxChild or <tt>nullptr</tt> in case no child widget
* with the given index exists.
*/
const FlowBoxChild* get_child_at_index(int idx) const;
/** Calls a function for each selected child.
*
* Note that the selection cannot be modified from within
* this function.
*
* @param slot The function to call for each selected child
*
* @newin{3,12}
*/
void selected_foreach(const SlotSelectedForeach& slot);
// transfer container
/** Creates a list of all selected children.
*
* @newin{3,12}
*
* @return A List containing the Gtk::Widget for each selected child.
*/
std::vector< Gtk::FlowBoxChild*> get_selected_children();
/** Creates a list of all selected children.
*
* @newin{3,12}
*
* @return A List containing the Gtk::Widget for each selected child.
*/
std::vector< const Gtk::FlowBoxChild*> get_selected_children() const;
/** Selects a single child of @a box, if the selection
* mode allows it.
*
* @newin{3,12}
*
* @param child A child of @a box.
*/
void select_child(FlowBoxChild& child);
/** Unselects a single child of @a box, if the selection
* mode allows it.
*
* @newin{3,12}
*
* @param child A child of @a box.
*/
void unselect_child(FlowBoxChild& child);
/** Select all children of @a box, if the selection
* mode allows it.
*
* @newin{3,12}
*/
void select_all();
/** Unselect all children of @a box, if the selection
* mode allows it.
*
* @newin{3,12}
*/
void unselect_all();
/** Sets how selection works in @a box.
* See Gtk::SelectionMode for details.
*
* @newin{3,12}
*
* @param mode The new selection mode.
*/
void set_selection_mode(SelectionMode mode = SELECTION_NONE);
/** Gets the selection mode of @a box.
*
* @newin{3,12}
*
* @return The Gtk::SelectionMode.
*/
SelectionMode get_selection_mode() const;
/** Hooks up an adjustment to focus handling in @a box.
* The adjustment is also used for autoscrolling during
* rubberband selection. See Gtk::ScrolledWindow::get_hadjustment()
* for a typical way of obtaining the adjustment, and
* set_vadjustment()for setting the vertical
* adjustment.
*
* The adjustments have to be in pixel units and in the same
* coordinate system as the allocation for immediate children
* of the box.
*
* @newin{3,12}
*
* @param adjustment An adjustment which should be adjusted
* when the focus is moved among the descendents of @a container.
*/
void set_hadjustment(const Glib::RefPtr<Adjustment>& adjustment);
/** Hooks up an adjustment to focus handling in @a box.
* The adjustment is also used for autoscrolling during
* rubberband selection. See Gtk::ScrolledWindow::get_vadjustment()
* for a typical way of obtaining the adjustment, and
* set_hadjustment()for setting the horizontal
* adjustment.
*
* The adjustments have to be in pixel units and in the same
* coordinate system as the allocation for immediate children
* of the box.
*
* @newin{3,12}
*
* @param adjustment An adjustment which should be adjusted
* when the focus is moved among the descendents of @a container.
*/
void set_vadjustment(const Glib::RefPtr<Adjustment>& adjustment);
/** Sets a filter function.
*
* By setting a filter function on the FlowBox one can decide dynamically
* which of the children to show. For instance, to implement a search
* function that only shows the children matching the search terms.
*
* The @a slot will be called for each child after the call, and
* it will continue to be called each time a child changes (via
* FlowBoxChild::changed()) or when FlowBox::invalidate_filter()
* is called.
*
* @param slot Callback that lets you filter which children to show
*
* @newin{3,12}
*/
void set_filter_func(const SlotFilter& slot);
/** Removes the filter function, if any.
*
* @newin{3,12}
*/
void unset_filter_func();
/** Updates the filtering for all children.
*
* Call this function when the result of the filter
* function on the @a box is changed due ot an external
* factor. For instance, this would be used if the
* filter function just looked for a specific search
* term, and the entry with the string has changed.
*
* @newin{3,12}
*/
void invalidate_filter();
/** Sets a sort function.
*
* By setting a sort function on the FlowBox, one can dynamically
* reorder the children of the box, based on the contents of
* the children.
*
* The @a slot will be called for each child after the call,
* and will continue to be called each time a child changes (via
* FlowBoxChild::changed()) and when FlowBox::invalidate_sort()
* is called.
*
* @param slot The sort function
*
* @newin{3,12}
*/
void set_sort_func(const SlotSort& slot);
/** Removes the sort function, if any.
*
* @newin{3,12}
*/
void unset_sort_func();
/** Updates the sorting for all children.
*
* Call this when the result of the sort function on
* @a box is changed due to an external factor.
*
* @newin{3,12}
*/
void invalidate_sort();
/** For instance:
* Gtk::Widget* on_create_widget(const Glib::RefPtr<T_item>& item);
*
* Called for flow boxes that are bound to a Gio::ListModel with bind_model()
* or bind_list_store() for each item that gets added to the model.
*
* @newin{3,22}
*
* @tparam T_item Base class of the items in the Gio::ListModel. All items must
* be of type T_item or a type derived from T_item.
* T_item must be Glib::Object or a type derived from Glib::Object.
* @param item The item from the model for which to create a widget.
* @eturn A Gtk::Widget that represents @a item.
*/
template <typename T_item>
using SlotCreateWidget = sigc::slot<Gtk::Widget*, const Glib::RefPtr<T_item>&>;
/** Binds a Gio::ListModel.
*
* If this FlowBox was already bound to a model, that previous binding is
* destroyed.
*
* The contents of the FlowBox are cleared and then filled with widgets that
* represent items from @a model. The FlowBox is updated whenever @a model changes.
* If @a model is an empty Glib::RefPtr, the FlowBox is left empty.
*
* It is undefined to add or remove widgets directly (for example, with
* insert() or Gtk::Container::add()) while the FlowBox is bound to a model.
*
* Note that using a model is incompatible with the filtering and sorting
* functionality in FlowBox. When using a model, filtering and sorting
* should be implemented by the model.
*
* @newin{3,22}
*
* @param model The Gio::ListModel to be bound.
* @param slot_create_widget A slot that creates widgets for items.
*
* @see bind_list_store()
*/
void bind_model(const Glib::RefPtr<Gio::ListModel>& model,
const SlotCreateWidget<Glib::Object>& slot_create_widget);
/** Binds a Gio::ListStore<>.
*
* If this FlowBox was already bound to a Gio::ListModel, that previous binding is
* destroyed. (Gio::ListStore is a Gio::ListModel.)
*
* The contents of the FlowBox are cleared and then filled with widgets that
* represent items from @a store. The FlowBox is updated whenever @a store changes.
* If @a store is an empty Glib::RefPtr, the FlowBox is left empty.
*
* It is undefined to add or remove widgets directly (for example, with
* insert() or Gtk::Container::add()) while the FlowBox is bound to a model.
*
* Note that using a model is incompatible with the filtering and sorting
* functionality in FlowBox. When using a model, filtering and sorting
* should be implemented by the model.
*
* @newin{3,22}
*
* @tparam T_item Base class of the items in the Gio::ListStore. All items must
* be of type T_item or a type derived from T_item.
* T_item must be Glib::Object or a type derived from Glib::Object.
* @tparam T_slot SlotCreateWidget<T_item> or a type that can be converted
* to SlotCreateWidget<T_item>.
* @param store The Gio::ListStore<> to be bound.
* @param slot_create_widget A slot that creates widgets for items.
*/
template <typename T_item, typename T_slot>
void bind_list_store(const Glib::RefPtr<Gio::ListStore<T_item>>& store,
T_slot&& slot_create_widget);
/** The selection mode used by the flow box.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< SelectionMode > property_selection_mode() ;
/** The selection mode used by the flow box.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< SelectionMode > property_selection_mode() const;
/** Determines whether children can be activated with a single
* click, or require a double-click.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< bool > property_activate_on_single_click() ;
/** Determines whether children can be activated with a single
* click, or require a double-click.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< bool > property_activate_on_single_click() const;
/** Determines whether all children should be allocated the
* same size.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< bool > property_homogeneous() ;
/** Determines whether all children should be allocated the
* same size.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< bool > property_homogeneous() const;
/** The minimum number of children to allocate consecutively
* in the given orientation.
*
* Setting the minimum children per line ensures
* that a reasonably small height will be requested
* for the overall minimum width of the box.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< guint > property_min_children_per_line() ;
/** The minimum number of children to allocate consecutively
* in the given orientation.
*
* Setting the minimum children per line ensures
* that a reasonably small height will be requested
* for the overall minimum width of the box.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< guint > property_min_children_per_line() const;
/** The maximum amount of children to request space for consecutively
* in the given orientation.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< guint > property_max_children_per_line() ;
/** The maximum amount of children to request space for consecutively
* in the given orientation.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< guint > property_max_children_per_line() const;
/** The amount of vertical space between two children.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< guint > property_row_spacing() ;
/** The amount of vertical space between two children.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< guint > property_row_spacing() const;
/** The amount of horizontal space between two children.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< guint > property_column_spacing() ;
/** The amount of horizontal space between two children.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< guint > property_column_spacing() const;
/**
* @par Slot Prototype:
* <tt>void on_my_%child_activated(FlowBoxChild* child)</tt>
*
* The signal_child_activated() signal is emitted when a child has been
* activated by the user.
*
* @param child The child that is activated.
*/
Glib::SignalProxy< void,FlowBoxChild* > signal_child_activated();
/**
* @par Slot Prototype:
* <tt>void on_my_%selected_children_changed()</tt>
*
* The signal_selected_children_changed() signal is emitted when the
* set of selected children changes.
*
* Use Gtk::FlowBox::selected_foreach() or
* Gtk::FlowBox::get_selected_children() to obtain the
* selected children.
*/
Glib::SignalProxy< void > signal_selected_children_changed();
// Action signals
private:
template <typename T_item>
static GtkWidget* proxy_bind_list_store_create_widget_callback(void* item, void* data);
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <typename T_item, typename T_slot>
void FlowBox::bind_list_store(const Glib::RefPtr<Gio::ListStore<T_item>>& store,
T_slot&& slot_create_widget)
{
// Create a copy of the slot.
// It will be deleted by Glib::destroy_notify_delete<SlotCreateWidget>.
auto slot_copy = new SlotCreateWidget<T_item>(std::forward<T_slot>(slot_create_widget));
gtk_flow_box_bind_model(gobj(),
Glib::unwrap(Glib::RefPtr<Gio::ListModel>::cast_static(store)),
&proxy_bind_list_store_create_widget_callback<T_item>,
slot_copy, &Glib::destroy_notify_delete<SlotCreateWidget<T_item>>);
}
template <typename T_item>
GtkWidget* FlowBox::proxy_bind_list_store_create_widget_callback(void* item, void* data)
{
auto& slot = *static_cast<SlotCreateWidget<T_item>*>(data);
auto cobject = static_cast<typename T_item::BaseObjectType*>(item);
try
{
// cast_dynamic is necessary if T_item is a user-defined type, such as
// class MyObject : public Glib::Object
// take_copy is true here, because wrap() returns a Glib::RefPtr<>.
// cobject will be unreferenced when the RefPtr is deleted.
Gtk::Widget* widget = slot(Glib::RefPtr<T_item>::cast_dynamic(Glib::wrap(cobject, true)));
if (widget)
return widget->gobj();
}
catch(...)
{
Glib::exception_handlers_invoke();
}
return nullptr;
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
} // namespace Gtk
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates Gtk::FlowBox
*/
Gtk::FlowBox* wrap(GtkFlowBox* object, bool take_copy = false);
} //namespace Glib
#endif /* _GTKMM_FLOWBOX_H */
|