1 // $Id: gnome_druidpage.cc,v 1.6 2002/11/04 11:31:03 christof Exp $
2 /*  glade--: C++ frontend for glade (Gtk+ User Interface Builder)
3  *  Copyright (C) 2001 Christof Petig
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19 
20 #include <cstdio>
21 #include "gnome_druidpage.hh"
22 
23 static Gnome_DruidPage Gnome_DruidPage(false);
24 
25 const std::string Gnome_DruidPage::TypeName(const Widget &w) const
26 {  return GnomeUIPrefix()+"DruidPage";
27 }
28 
29 const std::string Gnome_DruidPage::IncludeName(const Widget &w) const
30 {  return Configuration.GnomeUImmIncludePath()+"druid-page.h";
31 }
32 
33 Gnome_DruidPage::Gnome_DruidPage(bool base_class_init)
34 {  if (!base_class_init) Writer["GnomeDruidPage"]=this;
35 }
36 
37 void Gnome_DruidPage::ConstructionArgs(const Widget &w, CxxFile &f) const
38 {  f.FunctionArg();
39 }
40 
41 void Gnome_DruidPage::Configure(const Widget &w, CxxFile &f,const std::string &instance) const
42 {  Parent::Configure(w,f,instance);
43    const std::string title_color(w.getProperty("title_color"));
44    const std::string background_color(w.getProperty("background_color"));
45    const std::string logo_background_color(w.getProperty("logo_background_color"));
46    const std::string logo_image(w.getProperty("logo_image"));
47 
48    if (!title_color.empty())
49    	f.Statement() << instance << "set_title_color(" << PushColor(title_color) << ')';
50    if (!background_color.empty())
51    	f.Statement() << instance << "set_bg_color(" << PushColor(background_color) << ')';
52    if (!logo_background_color.empty())
53    	f.Statement() << instance << "set_logo_bg_color(" << PushColor(logo_background_color) << ')';
54    if (!logo_image.empty())
55    	f.Statement() << instance << "set_logo(Gdk_Imlib::Image(" << Configuration.CString_WithQuotes(logo_image) << "))";
56    WriteTranslatableProperty(w,f,instance, "title");
57 }
58 
59 #warning signals are missing: next, prepare, back, finish, cancel
60 
61 //#include <cstdio>
62 
63 const std::string Gnome_DruidPage::PushColor(const std::string &s)
64 {  int r=0,g=0,b=0;
65    sscanf(s.c_str(),"%d,%d,%d",&r,&g,&b);
66    char buf[60];
67    snprintf(buf,sizeof buf,"#%02x%02x%02x",r&0xff,g&0xff,b&0xff);
68    return std::string("Gdk_Color(\"")+buf+"\")";
69 }
70