Re: colors of labels in event boxes



ok. i skipped many things to create the test-case.. hope that i did not anything
important. I attach also tar.gz with glade file and makefile.
m.
PS: sorry murray for sending it directly.

CODE:
#include <gtkmm.h>
#include <libglademm.h>

class TestWindow;

class TableLine{
	public:
		TableLine(TestWindow* tw, Gtk::VBox* vboxIntx);
	protected:
		Gtk::EventBox* m_EventBox1;
	private:
		Gtk::VBox* vboxInt;
		Gtk::Label* interfaceL;
};

TableLine::TableLine(TestWindow* tw, Gtk::VBox* vboxIntx){
	vboxInt=vboxIntx;
	m_EventBox1 = new Gtk::EventBox();
	interfaceL = new Gtk::Label("none detected");
	m_EventBox1->add(*interfaceL);
	vboxInt->pack_start(*m_EventBox1);
	m_EventBox1->show();
	interfaceL->show();

	m_EventBox1->modify_bg(Gtk::STATE_NORMAL, Gdk::Color("yellow"));
}

class TestWindow: public Gtk::Window {
	public:
		TestWindow();
	private:
		Gtk::VBox* m_Box;
		Glib::RefPtr<Gtk::UIManager> m_refUIManager;
		Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
		Glib::RefPtr<Gnome::Glade::Xml> m_refGlade;
		TableLine* t_line;
};

TestWindow::TestWindow(){
	set_title("GUI for GTK");
	set_default_size(500,300);
	m_refGlade = Gnome::Glade::Xml::create("testglade.glade", "frame1");

	Gtk::Frame* pFrame = 0;
	m_refGlade->get_widget("frame1", pFrame);
	add(*pFrame);

	m_refGlade->get_widget("vbox2", m_Box);

	// add a line into the table
	TableLine* tl =  new TableLine(this, m_Box);

	show_all_children();
}


int main (int argc, char *argv[]){
	Gtk::Main kit(argc, argv);
	TestWindow tw;
	kit.run(tw);
	return 0;
}



Attachment: testCase.tar.gz
Description: application/tgz



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