// Generated by gmmproc 2.84.0 -- DO NOT MODIFY! #ifndef _GTKMM_NOTEBOOK_H #define _GTKMM_NOTEBOOK_H #include #include #include /* Copyright (C) 1998-2002 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 . */ #include #include #include #include #ifndef DOXYGEN_SHOULD_SKIP_THIS using GtkNotebook = struct _GtkNotebook; using GtkNotebookClass = struct _GtkNotebookClass; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { class GTKMM_API Notebook_Class; } // namespace Gtk #endif //DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { /** Container which shows one of its children at a time, in tabbed windows. * * The Gtk::Notebook widget is a layout container whose children are pages that * can be switched between using tab labels along one edge. * * A Notebook widget looks like this: * @image html notebook1.png * * @ingroup Widgets * @ingroup Containers */ class GTKMM_API Notebook : public Widget { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef Notebook CppObjectType; typedef Notebook_Class CppClassType; typedef GtkNotebook BaseObjectType; typedef GtkNotebookClass BaseClassType; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ Notebook(Notebook&& src) noexcept; Notebook& operator=(Notebook&& src) noexcept; // noncopyable Notebook(const Notebook&) = delete; Notebook& operator=(const Notebook&) = delete; ~Notebook() noexcept override; #ifndef DOXYGEN_SHOULD_SKIP_THIS private: friend GTKMM_API class Notebook_Class; static CppClassType notebook_class_; protected: explicit Notebook(const Glib::ConstructParams& construct_params); explicit Notebook(GtkNotebook* 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 GObject. GtkNotebook* gobj() { return reinterpret_cast(gobject_); } /// Provides access to the underlying C GObject. const GtkNotebook* gobj() const { return reinterpret_cast(gobject_); } private: public: Notebook(); /** Prepends a page to @a notebook. * * @param child The Gtk::Widget to use as the contents of the page. * @param tab_label The Gtk::Widget to be used as the label for the page. */ int prepend_page(Widget& child, Widget& tab_label); int prepend_page(Widget& child); int prepend_page(Widget& child, const Glib::ustring& tab_label, bool use_mnemonic = false); /** Prepends a page to @a notebook, specifying the widget to use as the * label in the popup menu. * * @param child The Gtk::Widget to use as the contents of the page. * @param tab_label The Gtk::Widget to be used as the label for the page. * @param menu_label The widget to use as a label for the page-switch * menu. */ int prepend_page(Widget& child, Widget& tab_label, Widget& menu_label); //Ignore the possible-0 menu_label version of this method. It would have the same signature as another method. int prepend_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, bool use_mnemonic); /** Appends a page to @a notebook. * * @param child The Gtk::Widget to use as the contents of the page. * @param tab_label The Gtk::Widget to be used as the label for the page. */ int append_page(Widget& child, Widget& tab_label); int append_page(Widget& child); int append_page(Widget& child, const Glib::ustring& tab_label, bool use_mnemonic = false); /** Appends a page to @a notebook, specifying the widget to use as the * label in the popup menu. * * @param child The Gtk::Widget to use as the contents of the page. * @param tab_label The Gtk::Widget to be used as the label for the page. * @param menu_label The widget to use as a label for the page-switch * menu. */ int append_page(Widget& child, Widget& tab_label, Widget& menu_label); //Ignore the possible-0 menu_label version of this method. It would have the same signature as another method. int append_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, bool use_mnemonic = false); /** Insert a page into @a notebook at the given position. * * @param child The Gtk::Widget to use as the contents of the page. * @param tab_label The Gtk::Widget to be used as the label for the page. * @param position The index (starting at 0) at which to insert the page, * or -1 to append the page after all other pages. */ int insert_page(Widget& child, Widget& tab_label, int position); int insert_page(Widget& child, int position); int insert_page(Widget& child, const Glib::ustring& tab_label, int position, bool use_mnemonic = false); /** Insert a page into @a notebook at the given position, specifying * the widget to use as the label in the popup menu. * * @param child The Gtk::Widget to use as the contents of the page. * @param tab_label The Gtk::Widget to be used as the label for the page.. * @param menu_label The widget to use as a label for the page-switch * menu. * @param position The index (starting at 0) at which to insert the page, * or -1 to append the page after all other pages. */ int insert_page(Widget& child, Widget& tab_label, Widget& menu_label, int position); //Ignore the possible-0 menu_label version of this method. It would have the same signature as another method. int insert_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, int position, bool use_mnemonic = false); /** Removes a page from the notebook given its index * in the notebook. * * @param page_number The index of a notebook page, starting * from 0. If -1, the last page will be removed. */ void remove_page(int page_number = 0); void remove_page(Widget& child); /** Sets a group name for @a notebook. * * Notebooks with the same name will be able to exchange tabs * via drag and drop. A notebook with a nullptr group name will * not be able to exchange tabs with any other notebook. * * @param group_name The name of the notebook group, * or nullptr to unset it. */ void set_group_name(const Glib::ustring& group_name); /** Gets the current group name for @a notebook. * * @return The group name, * or nullptr if none is set. */ Glib::ustring get_group_name() const; /** Returns the page number of the current page. * * @return The index (starting from 0) of the current * page in the notebook. If the notebook has no pages, * then -1 will be returned. */ int get_current_page() const; /** Returns the child widget contained in page number @a page_number. * * @param page_number The index of a page in the notebook, or -1 * to get the last page. * @return The child widget, or nullptr if @a page_number * is out of bounds. */ Widget* get_nth_page(int page_number); /** Returns the child widget contained in page number @a page_number. * * @param page_number The index of a page in the notebook, or -1 * to get the last page. * @return The child widget, or nullptr if @a page_number * is out of bounds. */ const Widget* get_nth_page(int page_number) const; /** Gets the number of pages in a notebook. * * @return The number of pages in the notebook. */ int get_n_pages() const; /*Widget* get_current_page();*/ /*inconsistency with set_current_page*/ /** Finds the index of the page which contains the given child * widget. * * @param child A `Gtk::Widget`. * @return The index of the page containing @a child, or * -1 if @a child is not in the notebook. */ int page_num(const Widget& child) const; /** Switches to the page number @a page_number. * * Note that due to historical reasons, GtkNotebook refuses * to switch to a page unless the child widget is visible. * Therefore, it is recommended to show child widgets before * adding them to a notebook. * * @param page_number Index of the page to switch to, starting from 0. * If negative, the last page will be used. If greater * than the number of pages in the notebook, nothing * will be done. */ void set_current_page(int page_number); /** Switches to the next page. * * Nothing happens if the current page is the last page. */ void next_page(); /** Switches to the previous page. * * Nothing happens if the current page is the first page. */ void prev_page(); /** Sets whether a bevel will be drawn around the notebook pages. * * This only has a visual effect when the tabs are not shown. * * @param show_border true if a bevel should be drawn around the notebook. */ void set_show_border(bool show_border = true); /** Returns whether a bevel will be drawn around the notebook pages. * * @return true if the bevel is drawn. */ bool get_show_border() const; /** Sets whether to show the tabs for the notebook or not. * * @param show_tabs true if the tabs should be shown. */ void set_show_tabs(bool show_tabs = true); /** Returns whether the tabs of the notebook are shown. * * @return true if the tabs are shown. */ bool get_show_tabs() const; /** Sets the edge at which the tabs are drawn. * * @param pos The edge to draw the tabs at. */ void set_tab_pos(PositionType pos); /** Gets the edge at which the tabs are drawn. * * @return The edge at which the tabs are drawn. */ PositionType get_tab_pos() const; /** Sets whether the tab label area will have arrows for * scrolling if there are too many tabs to fit in the area. * * @param scrollable true if scroll arrows should be added. */ void set_scrollable(bool scrollable = true); /** Returns whether the tab label area has arrows for scrolling. * * @return true if arrows for scrolling are present. */ bool get_scrollable() const; /** Enables the popup menu. * * If the user clicks with the right mouse button on the tab labels, * a menu with all the pages will be popped up. */ void popup_enable(); /** Disables the popup menu. */ void popup_disable(); /** Returns the tab label widget for the page @a child. * * nullptr is returned if @a child is not in @a notebook or * if no tab label has specifically been set for @a child. * * @param child The page. * @return The tab label. */ Widget* get_tab_label(Widget& child); /** Returns the tab label widget for the page @a child. * * nullptr is returned if @a child is not in @a notebook or * if no tab label has specifically been set for @a child. * * @param child The page. * @return The tab label. */ const Widget* get_tab_label(Widget& child) const; /** Changes the tab label for @a child. * * If nullptr is specified for @a tab_label, then the page will * have the label “page N”. * * @param child The page. * @param tab_label The tab label widget to use, or nullptr * for default tab label. */ void set_tab_label(Widget& child, Widget& tab_label); /** Creates a new label and sets it as the tab label for the page * containing @a child. * * @param child The page. * @param tab_text The label text. */ void set_tab_label_text(Widget& child, const Glib::ustring& tab_text); /** Retrieves the text of the tab label for the page containing * @a child. * * @param child A widget contained in a page of @a notebook. * @return The text of the tab label. */ Glib::ustring get_tab_label_text(Widget& child) const; /** Retrieves the menu label widget of the page containing @a child. * * @param child A widget contained in a page of @a notebook. * @return The menu label, or nullptr * if the notebook page does not have a menu label other than * the default (the tab label). */ Widget* get_menu_label(Widget& child); /** Retrieves the menu label widget of the page containing @a child. * * @param child A widget contained in a page of @a notebook. * @return The menu label, or nullptr * if the notebook page does not have a menu label other than * the default (the tab label). */ const Widget* get_menu_label(Widget& child) const; /** Changes the menu label for the page containing @a child. * * @param child The child widget. * @param menu_label The menu label, or nullptr for default. */ void set_menu_label(Widget& child, Widget& menu_label); /** Creates a new label and sets it as the menu label of @a child. * * @param child The child widget. * @param menu_text The label text. */ void set_menu_label_text(Widget& child, const Glib::ustring& menu_text); /** Retrieves the text of the menu label for the page containing * @a child. * * @param child The child widget of a page of the notebook. * @return The text of the tab label. */ Glib::ustring get_menu_label_text(Widget& child) const; /** Reorders the page containing @a child, so that it appears in position * @a position. * * If @a position is greater than or equal to the number of children in * the list or negative, @a child will be moved to the end of the list. * * @param child The child to move. * @param position The new position, or -1 to move to the end. */ void reorder_child(Widget& child, int position); /** Gets whether the tab can be reordered via drag and drop or not. * * @param child A child `Gtk::Widget`. * @return true if the tab is reorderable. */ bool get_tab_reorderable(Widget& child) const; /** Sets whether the notebook tab can be reordered * via drag and drop or not. * * @param child A child `Gtk::Widget`. * @param reorderable Whether the tab is reorderable or not. */ void set_tab_reorderable(Widget& child, bool reorderable = true); /** Returns whether the tab contents can be detached from @a notebook. * * @param child A child `Gtk::Widget`. * @return true if the tab is detachable. */ bool get_tab_detachable(Widget& child) const; /** Sets whether the tab can be detached from @a notebook to another * notebook or widget. * * Note that two notebooks must share a common group identifier * (see set_group_name()) to allow automatic tabs * interchange between them. * * If you want a widget to interact with a notebook through DnD * (i.e.: accept dragged tabs from it) it must be set as a drop * destination by adding to it a Gtk::DropTarget controller that accepts * the GType `GTK_TYPE_NOTEBOOK_PAGE`. The `:value` of said drop target will be * preloaded with a Gtk::NotebookPage object that corresponds to the * dropped tab, so you can process the value via `::accept` or `::drop` signals. * * Note that you should use detach_tab() instead * of remove_page() if you want to remove the tab * from the source notebook as part of accepting a drop. Otherwise, * the source notebook will think that the dragged tab was removed * from underneath the ongoing drag operation, and will initiate a * drag cancel animation. * * * [C example ellipted] * * If you want a notebook to accept drags from other widgets, * you will have to set your own DnD code to do it. * * @param child A child `Gtk::Widget`. * @param detachable Whether the tab is detachable or not. */ void set_tab_detachable(Widget& child, bool detachable = true); /** Removes the child from the notebook. * * This function is very similar to remove_page(), * but additionally informs the notebook that the removal * is happening as part of a tab DND operation, which should * not be cancelled. * * @param child A child. */ void detach_tab(Widget& child); /** Gets one of the action widgets. * * See set_action_widget(). * * @param pack_type Pack type of the action widget to receive. * @return The action widget * with the given @a pack_type or nullptr when this action * widget has not been set. */ Widget* get_action_widget(PackType pack_type = PackType::START); /** Sets @a widget as one of the action widgets. * * Depending on the pack type the widget will be placed before * or after the tabs. You can use a `Gtk::Box` if you need to pack * more than one widget on the same side. * * @param widget A `Gtk::Widget`. * @param pack_type Pack type of the action widget. */ void set_action_widget(Widget* widget, PackType pack_type = PackType::START); /** Returns the `Gtk::NotebookPage` for @a child. * * @param child A child of @a notebook. * @return The `Gtk::NotebookPage` for @a child. */ Glib::RefPtr get_page(Widget& child); /** Returns the `Gtk::NotebookPage` for @a child. * * @param child A child of @a notebook. * @return The `Gtk::NotebookPage` for @a child. */ Glib::RefPtr get_page(const Widget& child) const; /** Returns a Gio::ListModel that contains the pages of the notebook. * * It can be used to keep an up-to-date view. The model also * implements Gtk::SelectionModel and can be used to track * and modify the visible page. * * To use Gtk::SelectionModel API, do something like * @code * auto pages = notebook->get_pages(); * auto selection_model = std::dynamic_pointer_cast(pages); * if (selection_model) * selection_model->do_something(); * @endcode * * @return A Gio::ListModel for the notebook's children. The caller becomes * the owner of the returned instance. When the caller's reference is dropped, * the instance is deleted. */ Glib::RefPtr get_pages(); /** See the non-const version. */ Glib::RefPtr get_pages() const; // no_default_handler because GtkNotebookClass is private. /** * @par Slot Prototype: * void on_my_%switch_page(Widget* page, guint page_number) * * Flags: Run Last * * Emitted when the user or a function changes the current page. * * @param page The new current page. * @param page_number The index of the page. */ Glib::SignalProxy signal_switch_page(); /** * @par Slot Prototype: * void on_my_%page_reordered(Widget* page, guint page_num) * * Flags: Run Last * * the signal_page_reordered() signal is emitted in the notebook * right after a page has been reordered. * * @param page The child `Gtk::Widget` affected. * @param page_num The new page number for @a page. */ Glib::SignalProxy signal_page_reordered(); /** * @par Slot Prototype: * void on_my_%page_removed(Widget* page, guint page_num) * * Flags: Run Last * * the signal_page_removed() signal is emitted in the notebook * right after a page is removed from the notebook. * * @param page The child `Gtk::Widget` affected. * @param page_num The @a page page number. */ Glib::SignalProxy signal_page_removed(); /** * @par Slot Prototype: * void on_my_%page_added(Widget* page, guint page_num) * * Flags: Run Last * * the signal_page_added() signal is emitted in the notebook * right after a page is added to the notebook. * * @param page The child `Gtk::Widget` affected. * @param page_num The new page number for @a page. */ Glib::SignalProxy signal_page_added(); //Key-binding signals: //This doesn't seem generally useful: /** Which side of the notebook holds the tabs. * * Default value: Gtk::PositionType::TOP * * @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< PositionType > property_tab_pos() ; /** Which side of the notebook holds the tabs. * * Default value: Gtk::PositionType::TOP * * @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< PositionType > property_tab_pos() const; /** Whether tabs should be shown. * * Default value: true * * @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_show_tabs() ; /** Whether tabs should be shown. * * Default value: true * * @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_show_tabs() const; /** Whether the border should be shown. * * Default value: true * * @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_show_border() ; /** Whether the border should be shown. * * Default value: true * * @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_show_border() const; /** If true, scroll arrows are added if there are too many pages to fit. * * Default value: false * * @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_scrollable() ; /** If true, scroll arrows are added if there are too many pages to fit. * * Default value: false * * @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_scrollable() const; /** The index of the current page. * * Default value: -1 * * @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< int > property_page() ; /** The index of the current page. * * Default value: -1 * * @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< int > property_page() const; /** Group name for tab drag and drop. * * Default value: "" * * @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< Glib::ustring > property_group_name() ; /** Group name for tab drag and drop. * * Default value: "" * * @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< Glib::ustring > property_group_name() const; /** If true, pressing the right mouse button on the notebook shows a page switching menu. * * Default value: false * * @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_enable_popup() ; /** If true, pressing the right mouse button on the notebook shows a page switching menu. * * Default value: false * * @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_enable_popup() const; /** A selection model with the pages. * * @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< Glib::RefPtr > property_pages() const; public: public: //C++ methods used to invoke GTK+ virtual functions: protected: //GTK+ Virtual Functions (override these to change behaviour): //Default Signal Handlers:: }; } // 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::Notebook */ GTKMM_API Gtk::Notebook* wrap(GtkNotebook* object, bool take_copy = false); } //namespace Glib #endif /* _GTKMM_NOTEBOOK_H */