1 // $Id: GladeTag.cc,v 1.4 2002/06/15 13:22:13 christof Exp $
2 /*  glade--: C++ frontend for glade (Gtk+ User Interface Builder)
3  *  Copyright (C) 2002  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 "GladeTag.hh"
21 #include "Configuration.hh"
22 
getGladeAttr(const std::string & name,const std::string & def) const23 std::string GladeTag::getGladeAttr(const std::string &name, const std::string &def) const
24 {  if (Configuration.glade2) return getAttr(name,def);
25    else return getString(name,def);
26 }
27 
hasGladeAttr(const std::string & name) const28 bool GladeTag::hasGladeAttr(const std::string &name) const
29 {  if (Configuration.glade2) return hasAttr(name);
30    else return hasTag(name);
31 }
32 
getGladeBoolAttr(const std::string & name,bool def) const33 bool GladeTag::getGladeBoolAttr(const std::string &name, bool def) const
34 {  if (Configuration.glade2) return getBoolAttr(name,def);
35    else return getBool(name,def);
36 }
37 
38 // this is needed to switch to another widget type during ApplyPreferences
setWidgetType(const std::string & type)39 void GladeTag::setWidgetType(const std::string &type)
40 {  if (Configuration.glade2)
41    {  assert(begin()!=end());
42       assert(begin()->Type()=="widget");
43       begin()->setAttr("class",type);
44    }
45    else mark("class",type);
46 }
47