Get rid of null state
[synfig.git] / synfig-studio / src / gtkmm / dialog_tooloptions.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file dialog_tooloptions.cpp
3 **      \brief Template File
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **      Copyright (c) 2009 Nikita Kitaev
10 **
11 **      This package is free software; you can redistribute it and/or
12 **      modify it under the terms of the GNU General Public License as
13 **      published by the Free Software Foundation; either version 2 of
14 **      the License, or (at your option) any later version.
15 **
16 **      This package is distributed in the hope that it will be useful,
17 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
18 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 **      General Public License for more details.
20 **      \endlegal
21 */
22 /* ========================================================================= */
23
24 /* === H E A D E R S ======================================================= */
25
26 #ifdef USING_PCH
27 #       include "pch.h"
28 #else
29 #ifdef HAVE_CONFIG_H
30 #       include <config.h>
31 #endif
32
33 #include <gtkmm/label.h>
34 #include <gtkmm/scrolledwindow.h>
35 #include <synfig/general.h>
36 #include "dialog_tooloptions.h"
37 #include "general.h"
38
39 #endif
40
41 /* === U S I N G =========================================================== */
42
43 using namespace std;
44 using namespace etl;
45 using namespace synfig;
46 using namespace studio;
47
48 /* === M A C R O S ========================================================= */
49
50 /* === G L O B A L S ======================================================= */
51
52 /* === P R O C E D U R E S ================================================= */
53
54 /* === M E T H O D S ======================================================= */
55
56 Dialog_ToolOptions::Dialog_ToolOptions():
57         Dockable("tool_options",_("Tool Options"),Gtk::StockID("synfig-about")),
58         empty_label(_("This tool has no options"))
59 {
60         //scrolled_.add(sub_vbox_);
61         //scrolled_.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC);
62         //scrolled_.show();
63         //get_vbox()->pack_start(scrolled_);
64
65         add(sub_vbox_);
66
67         set_widget(empty_label);
68         empty_label.show();
69 }
70
71 Dialog_ToolOptions::~Dialog_ToolOptions()
72 {
73 }
74
75 void
76 Dialog_ToolOptions::clear()
77 {
78         Dockable::clear();
79         set_local_name(_("Tool Options"));
80         add(sub_vbox_);
81         set_widget(empty_label);
82         empty_label.show();
83
84         set_stock_id(Gtk::StockID("synfig-about"));
85 }
86
87 void
88 Dialog_ToolOptions::set_widget(Gtk::Widget&x)
89 {
90         if(!sub_vbox_.children().empty())
91                 sub_vbox_.children().clear();
92
93         sub_vbox_.show();
94         sub_vbox_.pack_start(x,false,false);
95         x.show();
96 }
97
98 void
99 Dialog_ToolOptions::set_name(const synfig::String& name)
100 {
101         set_stock_id(Gtk::StockID("synfig-"+name));
102 }