1 // $Id: dialog.cc,v 1.34 2003/03/31 14:09:27 christof Exp $
2 /* glade--: C++ frontend for glade (Gtk+ User Interface Builder)
3 * Copyright (C) 1998 Christof Petig
4 * Copyright (C) 1999-2002 Adolf Petig GmbH & Co. KG, written by Christof Petig
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 #include "dialog.hh"
22
23 static Gtk_Dialog Gtk_Dialog;
24
TypeName(const Widget & w) const25 const std::string Gtk_Dialog::TypeName(const Widget &w) const
26 { return GtkPrefix()+"Dialog";
27 }
28
IncludeName(const Widget & w) const29 const std::string Gtk_Dialog::IncludeName(const Widget &w) const
30 { return Configuration.GtkmmIncludePath()+"dialog.h";
31 }
32
Gtk_Dialog()33 Gtk_Dialog::Gtk_Dialog()
34 { Writer["GtkDialog"]=this;
35 }
36
IsSubwidget(const Widget & w,const Widget & ch) const37 Subwidget Gtk_Dialog::IsSubwidget(const Widget &w,const Widget &ch) const
38 { const std::string chn(ch.ChildName());
39 if (chn=="Dialog:vbox" || chn=="vbox") return is_Subwidget;
40 if (chn=="Dialog:action_area" || chn=="action_area") return is_Subwidget_only;
41 if (!chn.empty()) { std::cerr << "Dialog: Unexpected child name '" << chn << "'\n"; }
42 return not_Subwidget;
43 }
44
InternalInstance(const Widget & parent,const Widget & w2) const45 const std::string Gtk_Dialog::InternalInstance(const Widget &parent,const Widget &w2) const
46 { const std::string chn(w2.ChildName());
47 if (chn=="Dialog:vbox" || chn=="vbox") return "get_vbox()->";
48 if (chn=="Dialog:action_area" || chn=="action_area") return "get_action_area()->";
49 return Parent::InternalInstance(parent,w2);
50 }
51
AddChildren(const Widget & w,CxxFile & f,const std::string & instance,const WriterBase & writer_for_subw,const Widget & widget_for_subw) const52 void Gtk_Dialog::AddChildren(const Widget &w,CxxFile &f,const std::string &instance,const WriterBase &writer_for_subw, const Widget &widget_for_subw) const
53 { Parent::AddChildren(w,f,instance,writer_for_subw,widget_for_subw);
54
55 if (!GTKMM2) return;
56 for (Widget::const_contained_iterator i=w.begin_contained(Internal_Both);
57 i!=w.end_contained();++i)
58 { if ((*i).Class()!="Placeholder" && (*i).hasProperty("response_id"))
59 { f.Statement() << instance << "add_action_widget"
60 << '(' << Reference(*i) << ", "
61 << (*i).getIntProperty("response_id") << ')';
62 }
63 }
64 }
65
Configure(const Widget & w,CxxFile & f,const std::string & instance) const66 void Gtk_Dialog::Configure(const Widget &w, CxxFile &f,const std::string &instance) const
67 { Parent::Configure(w,f,instance);
68
69 if (GTKMM2) WriteBoolProperty(w,f,instance, "has_separator");
70 }
71