Lumiera  0.pre.03
»edit your freedom«
name-chooser.cpp
Go to the documentation of this file.
1 /*
2  NameChooser - dialog to enter a string name
3 
4  Copyright (C) Lumiera.org
5  2008, Joel Holdsworth <joel@airwebreathe.org.uk>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
23 
33 #include "stage/gtk-base.hpp"
35 #include "stage/dialog/dialog.hpp"
36 
37 using namespace Gtk;
38 using namespace Glib;
39 
40 namespace stage {
41 namespace dialog {
42 
43  NameChooser::NameChooser (Window &parent,
44  cuString title,
45  cuString defaultName)
46  : Dialog::Dialog(title, parent, true)
47  , caption_(_("Name:"))
48  {
49  // Add the controls
50  name_.set_text (defaultName);
51  name_.set_activates_default();
52 
53  hBox_.pack_start (caption_);
54  hBox_.pack_start (name_);
55  hBox_.set_spacing (BoxSpacing);
56 
57  Box* const v_box = get_vbox();
58  REQUIRE (v_box != NULL);
59  v_box->pack_start (hBox_);
60 
61  // Configure the dialog
62  v_box->set_spacing (BoxSpacing);
63  set_border_width (BorderPadding);
64  set_resizable (false);
65 
66  // Configure the Cancel and Render buttons
67  add_button (Stock::CANCEL, RESPONSE_CANCEL);
68  add_button (Stock::OK, RESPONSE_OK);
69  set_default_response (RESPONSE_OK);
70 
71  show_all_children();
72  }
73 
74 
75 
76 }} // namespace stage::dialog
static const int BorderPadding
The space in pixels to pad the border of Lumiera dialog boxes.
Definition: dialog.hpp:38
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46
static const int BoxSpacing
The spacing for VBoxes and HBoxes in Lumiera dialogs.
Definition: dialog.hpp:43
Global constants and definitions for dialogs.
Dialog to enter a string name.
A set of basic GTK includes for the UI.