[no subject]
thanx!
The code below is working but is not what I want.
What I want is comment main_vbox = gtk_vbox_new(FALSE,
0); and uncomment //w = gtk_vbox_new(FALSE, 0);
// Compile : g++ -o test test.cpp `gtk-config --cflags
--libs`
#include <gtk/gtk.h>
#include <string> // string
#include <iostream> // cout
using std::cout;
using std::string;
class TEST
{
private:
GtkWidget *window, *main_vbox;
public:
TEST();
void add_something(GtkWidget *w);
};
TEST::TEST()
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect(GTK_OBJECT(window),
"delete_event", GTK_SIGNAL_FUNC(gtk_main_quit),
NULL);
gtk_window_set_title(GTK_WINDOW(window), "Notebook");
gtk_widget_set_usize(GTK_WIDGET(window), 800, 600);
gtk_container_border_width(GTK_CONTAINER(window), 3);
gtk_widget_show(window);
main_vbox = gtk_vbox_new(FALSE, 0);// Don't want to
write this here!
add_something(main_vbox);
// Add a button to main_vbox.
GtkWidget *bb = gtk_button_new_with_label("Button");
gtk_box_pack_start(GTK_BOX(main_vbox), bb, TRUE,
TRUE, 20);// Connect to main_vbox
gtk_widget_show(bb);
}
void TEST::add_something(GtkWidget *w)
{
//w = gtk_vbox_new(FALSE, 0); // Want to pass
main_vbox here but not working
gtk_container_add(GTK_CONTAINER(window), w); // Link
main_vbox to window.
gtk_widget_show(w);
}
int main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
TEST test;
gtk_main();
return(0);
}
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]