ocarina: Create default content for the window

I'm not using a notebook as the main widget anymore.  I'm also setting
the content directly, rather than getting the widget from the body code
and setting it in the window code.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-03-11 12:06:10 -04:00
parent c0df8f2e2b
commit 3d11ea47ba
5 changed files with 38 additions and 0 deletions

View File

@ -9,4 +9,16 @@ void push_page(GtkWidget *, GtkWidget *, bool);
void remove_page(GtkWidget *);
void set_current_page(GtkWidget *);
namespace ocarina
{
namespace body
{
void init();
}
}; /* Namespace: ocarina */
#endif /* OCARINA_BODY_H */

View File

@ -14,6 +14,7 @@ namespace ocarina
void set_title(string);
void set_icon(string);
void set_content(GtkWidget *);
}; /* Namespace: window */
/*void window_resize(int, int);

18
ocarina/body/body.cpp Normal file
View File

@ -0,0 +1,18 @@
// Copyright (c) 2012 Bryan Schumaker
#include <ocarina/ocarina.h>
#include <ocarina/window.h>
#include <ocarina/body.h>
static GtkWidget *content;
namespace ocarina
{
void body::init()
{
content = gtk_vbox_new(FALSE, 0);
gtk_widget_show(content);
}
}; /* Namespace: ocarina */

View File

@ -5,6 +5,7 @@
#include <ocarina/ocarina.h>
#include <ocarina/window.h>
#include <ocarina/body.h>
/*#include <version.h>
#include <ocarina/callback.h>
#include <ocarina/body.h>
@ -77,6 +78,7 @@ static void init(int argc, char **argv)
{
gtk_init(&argc, &argv);
ocarina::window::init();
ocarina::body::init();
}
int main(int argc, char **argv)

View File

@ -132,4 +132,9 @@ namespace ocarina
gtk_window_set_icon_from_file(GTK_WINDOW(win), path.c_str(), NULL);
}
void window::set_content(GtkWidget *content)
{
gtk_container_add(GTK_CONTAINER(win), content);
}
} /* Namespace: ocarina */