glade-- [ Never use. I use instead XML extension in Gtk



Message: 1
Date: Tue, 31 Jul 2007 12:12:43 -0700
From: Noah Roberts <noah roberts eng-software com>
Subject: glade--
To: gtkmm-list gnome org
Message-ID: <46AF89AB 3070304 eng-software com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

It seems that the source for glade-- is the only archive without a visual studio build. I had to rebuild all the c++ libs because of this stupid manifest error. glade-- crashes. Anyone have a VS project for this? Did I download the wrong thing or something? The website says nothing about VS and claims gcc is a requirement.






I use glade's XML file and read it directly by using the code:
const Glib::RefPtr<Gnome::Glade::Xml>& refGlade in the class CTOR, which gives me a "pointer" into glade's XML file.

Please Note the "Main" function in the Main.cpp file. The line Gnome::Glade::Xml::create(GLADE_FILE_NET_FIRE_MORTAR, "window_MortarFire")->get_widget_derived( "window_MortarFire", winMain ); actually connects the object attribute, m_refGlade, to be correctly assigned to the Glade XML file w/in this create method and it is passed to the winMain object during instantiation w/in this very same call.

Hope this helps....

HEADER

// GTK+ C functions
#include <gtk/gtk.h>


// Gtkmm Headers
//
#include <gtkmm.h>
#include <libglademm.h>
#include <gtkmm/button.h>
#include <gtkmm/window.h>
#include <gtkmm/menubar.h>
#include <gtkmm/menu.h>
#include <gtkmm/main.h>
#include <glibmm/thread.h>
#include <gtkmm/drawingarea.h>
#include <cairomm/cairomm.h>
#include <gdkmm.h>

class X
{
X( BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade ); ///< CTOR // Glade & Timer Attributes
     //
bool m_bUpdateGUI(void) {m_vUpdateGUI(); return true;}; ///< Returns True for times this is needed

Glib::RefPtr<Gnome::Glade::Xml> m_refGlade; ///< Reference to GLADE XML file sigc::connection m_sigcGuiUpdateTimerConnection; ///< Gui Update Timer Connection

}; // X



CPP

X::X( BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade ) : Gtk::Window( cobject ), m_refGlade( refGlade )
{
  m_refGlade->get_widget( "vbox_mainWindowArea", m_vbMainWindowVBox);
// Lables
  //
  m_refGlade->get_widget( "label_drawingMode", m_labelDrawingMode);
// Menu Bar widgets
  //
  m_refGlade->get_widget( "menubar_mainMenuBar",  m_MainMenuBar );
  m_refGlade->get_widget( "imagemenuitem_new",    m_FileNew);
  m_refGlade->get_widget( "imagemenuitem_open",   m_FileOpen);
  m_refGlade->get_widget( "imagemenuitem_save",   m_FileSave);
  m_refGlade->get_widget( "imagemenuitem_saveAs", m_FileSaveAs);
  m_refGlade->get_widget( "imagemenuitem_quit",   m_FileQuit);

}// ctor



MAIN!!


main.cpp

/**
* \brief necessary to undef max because it's a #define somewhere w/in windows.h & it * screws up gtkmm\pango\coverage.h file, which has a max "method" that appears
*        - to the compiler - as a C macro
*/
#undef max

#include <iostream>

#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>


#include "CFireMortarsGui.h"

#undef __STANDALONE__


//int _tmain(int argc, _TCHAR* argv[])
int main(int argc, char* argv[])
{
   // Starts up GLib Thread-Safe & Thread Aware
   //
   if(!Glib::thread_supported())
       Glib::thread_init();

   gtk_rc_parse( RC_FILE_FIRE_MORTAR );
   Gtk::Main m(&argc, &argv);

// There and be NO underscores within the name of the Top Level window, windowMainWindow.
   //
CFireMortarsGui* winMain = 0; #ifdef __STANDALONE__ Gnome::Glade::Xml::create(GLADE_FILE_STANDALONE_FIRE_MORTAR, "window_MortarFire")->get_widget_derived( "window_MortarFire", winMain );
   #else
Gnome::Glade::Xml::create(GLADE_FILE_NET_FIRE_MORTAR, "window_MortarFire")->get_widget_derived( "window_MortarFire", winMain );
   #endif

   std::string s("GuidGen.ico");
   boost::filesystem::path p(s, boost::filesystem::native);
   if (boost::filesystem::exists(p))
   {
       ;//std::cout << "found it\n";
   }
   else
       ;//std::cout << "!found\n";

   winMain->set_sensitive(true);
   //winMain->raise();
m.run( *winMain );
   delete winMain;

   return 0;
} // main


--Allen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]