diff options
author | neoraider <devnull@localhost> | 2007-10-05 01:38:05 +0200 |
---|---|---|
committer | neoraider <devnull@localhost> | 2007-10-05 01:38:05 +0200 |
commit | b660b965bcb679e53cc89e7b8903190d2d162ff6 (patch) | |
tree | 31d2e3309e0906e03a8e415f430a99f8716b23b6 /SidebarAdd.cpp | |
parent | ea3fc9f27f6feb14ea3b7cfc8b1e921195dd3c3f (diff) | |
download | zoomedit-b660b965bcb679e53cc89e7b8903190d2d162ff6.tar zoomedit-b660b965bcb679e53cc89e7b8903190d2d162ff6.zip |
zoomedit: Gro?e Teile der GUI in Klassen gekapselt.
Diffstat (limited to 'SidebarAdd.cpp')
-rw-r--r-- | SidebarAdd.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/SidebarAdd.cpp b/SidebarAdd.cpp new file mode 100644 index 0000000..78509e0 --- /dev/null +++ b/SidebarAdd.cpp @@ -0,0 +1,43 @@ +#include "SidebarAdd.h" +#include "edit.h" + + +void SidebarAdd::buttonClicked(GtkButton *button, SidebarAdd *sidebar) { + sidebar->editor->finishRoom(); +} + +SidebarAdd::SidebarAdd(EditManager *editor) { + this->editor = editor; + + sidebar = gtk_vbox_new(FALSE, 0); + g_object_ref_sink(G_OBJECT(sidebar)); + + GtkWidget *labelRoomInfo = gtk_label_new(NULL); + gtk_label_set_markup(GTK_LABEL(labelRoomInfo), "<b>Add room</b>"); + gtk_misc_set_alignment(GTK_MISC(labelRoomInfo), 0.0, 0.5); + gtk_box_pack_start(GTK_BOX(sidebar), labelRoomInfo, FALSE, FALSE, 5); + + buttonAdd = gtk_button_new_with_label("Add room"); + g_signal_connect(G_OBJECT(buttonAdd), "clicked", G_CALLBACK(buttonClicked), this); + gtk_box_pack_end(GTK_BOX(sidebar), buttonAdd, FALSE, FALSE, 0); + + gtk_widget_show_all(sidebar); +} + +SidebarAdd::~SidebarAdd() { + g_object_unref(G_OBJECT(sidebar)); +} + +GtkWidget* SidebarAdd::getWidget() { + return sidebar; +} + +void SidebarAdd::update() { + if(!getActiveRoom()) + return; + + if(getActiveRoom()->size() > 2 && isPolygonOk(getActiveRoom())) + gtk_widget_set_sensitive(buttonAdd, TRUE); + else + gtk_widget_set_sensitive(buttonAdd, FALSE); +} |