Gtk-- & CList



Hello.
        Gtk-- does not include GtkCList widget, so I used the C
interface to
it. It works but row`s background and foreground colors are black and
the text is not visible (obvius).
        With this message is included a modified hello.cc that tries to
do it.
Have I done something wrong or is it a bug?
        
        Another question: to pack a GTK+ widget in a GTK-- vbox I create
a C++
Gtk_Widget to encapsulate it:
vbox1->pack_start(new Gtk_Widget(lista));

        Is this the right way?
        Thanks.
-- 
+--------------------------+---------------------------+
|David Abilleira Freijeiro | Pontevedra, España        |
+--------------------------+---------------------------+
|http://members.xoom.com/odaf   (mailto:odaf@nexo.es)  |
|    (UNED, Mis Programas, Linux, Programación, etc.)  |
+------------------------------------------------------+
#include <gtk--.h>


char *titles[3]={
    "One","Two","Three"};
    
class HelloWorld : public Gtk_Window { // (1)
   Gtk_Button b;
public:
   HelloWorld() : b( "Hello World" ) {
      int i;
      static char *Texts[]={"text 1","text 2","text 3"};
        
      Gtk_VBox *vbox1=new Gtk_VBox(FALSE,10);
      // This is a C widget
      GtkWidget *lista=gtk_clist_new_with_titles(3,titles);

      // Initialicing
      for (i=1; i<10; i++)
        gtk_clist_append(GTK_CLIST(lista),Textss);
      
      // Packing
      add(vbox1);
      vbox1->pack_start( &b);
      vbox1->pack_start(new Gtk_HSeparator());
      vbox1->pack_start(new Gtk_Widget(lista));

      // Showing
      b.show(); // (4)
      vbox1->show();
      gtk_widget_show(lista);

      // Connecting
      connect( b.clicked, Gtk_Main::instance(), &Gtk_Main::quit ); // (3)

   }
   gint delete_event_impl(GdkEventAny *) { // (5) 
      Gtk_Main::instance()->quit(); 
      return 0;
   } 
};


int main( int argc, char **argv )
{
   Gtk_Main m( &argc, &argv ); // (7)
   HelloWorld w; // (6)
	
   w.set_usize( 500,400 );
   w.show(); // (4)

   m.run(); // (8)
   return 0;
}




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