| 1 |
/* Copyright (C) 2003 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 |
|
| 19 |
|
| 20 |
namespace Gtk |
| 21 |
{ |
| 22 |
|
| 23 |
_DEPRECATE_IFDEF_START |
| 24 |
ToggleAction::ToggleAction(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip, bool is_active) |
| 25 |
: |
| 26 |
_CONSTRUCT("name", name.c_str(), "stock_id", stock_id.get_c_str(), "label", (label.empty() ? nullptr : label.c_str()), "tooltip", (tooltip.empty() ? nullptr : tooltip.c_str())) |
| 27 |
{ |
| 28 |
set_active(is_active); |
| 29 |
} |
| 30 |
|
| 31 |
ToggleAction::ToggleAction(const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip, bool is_active) |
| 32 |
: |
| 33 |
_CONSTRUCT("name", name.c_str(), "icon_name", icon_name.c_str(), "label", (label.empty() ? nullptr : label.c_str()), "tooltip", (tooltip.empty() ? nullptr : tooltip.c_str())) |
| 34 |
{ |
| 35 |
set_active(is_active); |
| 36 |
} |
| 37 |
_DEPRECATE_IFDEF_END |
| 38 |
|
| 39 |
_DEPRECATE_IFDEF_START |
| 40 |
Glib::RefPtr<ToggleAction> ToggleAction::create(const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip, bool is_active) |
| 41 |
{ |
| 42 |
return Glib::RefPtr<ToggleAction>( new ToggleAction(name, Gtk::StockID(), label, tooltip, is_active) ); |
| 43 |
} |
| 44 |
|
| 45 |
Glib::RefPtr<ToggleAction> ToggleAction::create(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip, bool is_active) |
| 46 |
{ |
| 47 |
return Glib::RefPtr<ToggleAction>( new ToggleAction(name, stock_id, label, tooltip, is_active) ); |
| 48 |
} |
| 49 |
|
| 50 |
Glib::RefPtr<ToggleAction> ToggleAction::create_with_icon_name(const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip, bool is_active) |
| 51 |
{ |
| 52 |
return Glib::RefPtr<ToggleAction>( new ToggleAction(name, icon_name, label, tooltip, is_active) ); |
| 53 |
} |
| 54 |
_DEPRECATE_IFDEF_END |
| 55 |
|
| 56 |
} // namespace Gtk |