| 1 |
/* Copyright (C) 1998-2002 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtk/gtk.h> |
| 18 |
#include <gtkmm/label.h> |
| 19 |
#include <algorithm> |
| 20 |
|
| 21 |
namespace Gtk |
| 22 |
{ |
| 23 |
|
| 24 |
int Notebook::prepend_page(Widget& child, const Glib::ustring& tab_label, bool use_mnemonic) |
| 25 |
{ |
| 26 |
auto pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) ); |
| 27 |
return prepend_page(child, *pLabel); |
| 28 |
} |
| 29 |
|
| 30 |
int Notebook::prepend_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, bool use_mnemonic) |
| 31 |
{ |
| 32 |
auto pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) ); |
| 33 |
auto pLabelMenu = Gtk::manage( new Label(menu_label, use_mnemonic) ); |
| 34 |
return prepend_page(child, *pLabel, *pLabelMenu); |
| 35 |
} |
| 36 |
|
| 37 |
int Notebook::append_page(Widget& child, const Glib::ustring& tab_label, bool use_mnemonic) |
| 38 |
{ |
| 39 |
auto pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) ); |
| 40 |
return append_page(child, *pLabel); |
| 41 |
} |
| 42 |
|
| 43 |
int Notebook::append_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, bool use_mnemonic) |
| 44 |
{ |
| 45 |
auto pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) ); |
| 46 |
auto pLabelMenu = Gtk::manage( new Label(menu_label, use_mnemonic) ); |
| 47 |
return append_page(child, *pLabel, *pLabelMenu); |
| 48 |
} |
| 49 |
|
| 50 |
int Notebook::insert_page(Widget& child, const Glib::ustring& tab_label, int position, bool use_mnemonic) |
| 51 |
{ |
| 52 |
auto pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) ); |
| 53 |
return insert_page(child, *pLabel, position); |
| 54 |
} |
| 55 |
|
| 56 |
int Notebook::insert_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, int position, bool use_mnemonic) |
| 57 |
{ |
| 58 |
auto pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) ); |
| 59 |
auto pLabelMenu = Gtk::manage( new Label(menu_label, use_mnemonic) ); |
| 60 |
return insert_page(child, *pLabel, *pLabelMenu, position); |
| 61 |
} |
| 62 |
|
| 63 |
void Notebook::remove_page(Widget& child) |
| 64 |
{ |
| 65 |
int pos = page_num(child); |
| 66 |
if(pos != -1) |
| 67 |
remove_page(pos); |
| 68 |
} |
| 69 |
|
| 70 |
int Notebook::prepend_page(Widget& child) |
| 71 |
{ |
| 72 |
return gtk_notebook_prepend_page(gobj(), child.gobj(), nullptr /* see GTK+ docs */); |
| 73 |
} |
| 74 |
|
| 75 |
int Notebook::append_page(Widget& child) |
| 76 |
{ |
| 77 |
return gtk_notebook_append_page(gobj(), child.gobj(), nullptr /* see GTK+ docs */); |
| 78 |
} |
| 79 |
|
| 80 |
int Notebook::insert_page(Widget& child, int position) |
| 81 |
{ |
| 82 |
return gtk_notebook_insert_page(gobj(), child.gobj(), nullptr /* see GTK+ docs */, position); |
| 83 |
} |
| 84 |
|
| 85 |
} //namespace Gtk |