summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 23131b6)
raw | patch | inline | side by side (parent: 23131b6)
author | joncruz <joncruz@users.sourceforge.net> | |
Sun, 9 Apr 2006 04:54:24 +0000 (04:54 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Sun, 9 Apr 2006 04:54:24 +0000 (04:54 +0000) |
src/ui/widget/panel.cpp | patch | blob | history | |
src/ui/widget/panel.h | patch | blob | history |
index 11235d083948fba78c60b22732a87b6f7bfb9bcb..7ee919cb46434978d18f80242ceace3c74328489 100644 (file)
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
Panel::Panel(const gchar *prefs_path) :
_prefs_path(NULL),
+ _tempArrow( Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_OUT ),
+ menu(0),
_fillable(0)
{
_prefs_path = prefs_path;
Panel::Panel() :
_prefs_path(NULL),
+ _tempArrow( Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_OUT ),
+ menu(0),
_fillable(0)
{
init();
Panel::Panel(Glib::ustring const &label) :
_prefs_path(NULL),
+ _tempArrow( Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_OUT ),
+ menu(0),
_fillable(0)
{
this->label = label;
Panel::~Panel()
{
+ delete menu;
+}
+
+void Panel::_popper(GdkEventButton* event)
+{
+ if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 3 || event->button == 1) ) {
+ if (menu) {
+ menu->popup( event->button, event->time );
+ }
+ }
}
void Panel::init()
panel_mode = prefs_get_int_attribute_limited (_prefs_path, "panel_mode", 1, 0, 10);
}
- tabButton.set_menu(menu);
- Gtk::MenuItem* dummy = manage(new Gtk::MenuItem(tmp));
- menu.append( *dummy );
- menu.append( *manage(new Gtk::SeparatorMenuItem()) );
+ menu = new Gtk::Menu();
{
const char *things[] = {
N_("small"),
for ( unsigned int i = 0; i < G_N_ELEMENTS(things); i++ ) {
Glib::ustring foo(gettext(things[i]));
Gtk::RadioMenuItem* single = manage(new Gtk::RadioMenuItem(groupOne, foo));
- menu.append(*single);
+ menu->append(*single);
if ( i == panel_size ) {
single->set_active(true);
}
single->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), 0, i) );
}
}
- menu.append( *manage(new Gtk::SeparatorMenuItem()) );
+ menu->append( *manage(new Gtk::SeparatorMenuItem()) );
Gtk::RadioMenuItem::Group group;
Glib::ustring oneLab(_("List"));
Glib::ustring twoLab(_("Grid"));
two->set_active(true);
}
- menu.append( *one );
- menu.append( *two );
- menu.append( *manage(new Gtk::SeparatorMenuItem()) );
+ menu->append( *one );
+ menu->append( *two );
+ menu->append( *manage(new Gtk::SeparatorMenuItem()) );
one->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), 1, 0) );
two->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), 1, 1) );
+ menu->show_all_children();
+
//closeButton.set_label("X");
topBar.pack_start(tabTitle);
//topBar.pack_end(closeButton, false, false);
- topBar.pack_end(tabButton, false, false);
+
+
+ topBar.pack_end(menuPopper, false, false);
+ Gtk::Frame* outliner = manage(new Gtk::Frame());
+ outliner->set_shadow_type( Gtk::SHADOW_ETCHED_IN );
+ outliner->add( _tempArrow );
+ menuPopper.add( *outliner );
+ menuPopper.signal_button_press_event().connect_notify( sigc::mem_fun(*this, &Panel::_popper) );
pack_start( topBar, false, false );
case Gtk::ANCHOR_NORTH:
case Gtk::ANCHOR_SOUTH:
{
- tabButton.reference();
- topBar.remove(tabButton);
- rightBar.pack_start(tabButton, false, false);
- tabButton.unreference();
+ menuPopper.reference();
+ topBar.remove(menuPopper);
+ rightBar.pack_start(menuPopper, false, false);
+ menuPopper.unreference();
topBar.remove(tabTitle);
}
void Panel::_regItem( Gtk::MenuItem* item, int group, int id )
{
- menu.append( *item );
+ menu->append( *item );
item->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), group + 2, id) );
+ item->show();
}
void Panel::restorePanelPrefs()
void Panel::bounceCall(int i, int j)
{
- menu.set_active(0);
+ menu->set_active(0);
switch ( i ) {
case 0:
if (_prefs_path) prefs_set_int_attribute (_prefs_path, "panel_size", j);
diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h
index fbe52d5f5f840d00a4178ccf8736840b07a32165..8fb4b517a79978f1d21cd8ada31c2505708926fd 100644 (file)
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
#ifndef SEEN_INKSCAPE_UI_WIDGET_PANEL_H
#define SEEN_INKSCAPE_UI_WIDGET_PANEL_H
+#include <gtkmm/arrow.h>
#include <gtkmm/box.h>
+#include <gtkmm/eventbox.h>
#include <gtkmm/frame.h>
#include <gtkmm/table.h>
#include <gtkmm/button.h>
void init();
void bounceCall(int i, int j);
+ void _popper(GdkEventButton* btn);
+
Glib::ustring label;
Gtk::HBox topBar;
Gtk::VBox rightBar;
Gtk::VBox contents;
Gtk::Label tabTitle;
- Gtk::OptionMenu tabButton;
- Gtk::Menu menu;
+ Gtk::Arrow _tempArrow;
+ Gtk::EventBox menuPopper;
Gtk::Button closeButton;
+ Gtk::Menu* menu;
PreviewFillable *_fillable;
};