1 // $Id: accelgroup.cc,v 1.7 2002/05/14 08:25:44 christof Exp $
2 /* glade--: C++ frontend for glade (Gtk+ User Interface Builder)
3 * Copyright (C) 1998 Christof Petig
4 * Copyright (C) 1999-2000 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 "WriterBase.hh"
22
23 class Gtk_AccelGroup : public WriterBase
24 {public:
25 typedef WriterBase Parent;
26 virtual const std::string TypeName(const Widget &w) const;
27 virtual const std::string IncludeName(const Widget &w) const;
28 Gtk_AccelGroup(bool base_class_init=true);
NeedExplicitCtor(const Widget & w) const29 virtual bool NeedExplicitCtor(const Widget &w) const
30 { return false; }
ConstructionArgs(const Widget & w,CxxFile & f) const31 virtual void ConstructionArgs(const Widget &w, CxxFile &f) const
32 { f.FunctionArg(); }
33 virtual void CreatePointer(const Widget &, CxxFile &) const;
34 };
35
36 static Gtk_AccelGroup Gtk_AccelGroup(false);
37
TypeName(const Widget & w) const38 const std::string Gtk_AccelGroup::TypeName(const Widget &w) const
39 { return GtkPrefix()+"AccelGroup";
40 }
41
IncludeName(const Widget & w) const42 const std::string Gtk_AccelGroup::IncludeName(const Widget &w) const
43 { return Configuration.GtkmmIncludePath()+"accelgroup.h";
44 }
45
Gtk_AccelGroup(bool base_class_init)46 Gtk_AccelGroup::Gtk_AccelGroup(bool base_class_init)
47 { if (!base_class_init) Writer["GtkAccelGroup"]=this;
48 }
49
CreatePointer(const Widget & w,CxxFile & f) const50 void Gtk_AccelGroup::CreatePointer(const Widget &w, CxxFile &f) const
51 { if (w.getProperty("cxx_visibility","private")=="private") // && CanBeManaged
52 f.Declaration() << TypeName(w) << " *";
53 else
54 f.Statement();
55 f << Configuration.InstanceName(w.Name());
56 f.Assignment();
57 f.FunctionName() << TypeName(w) << "::create";
58 ConstructionArgs(w,f);
59 f.EndLine();
60 }
61