Added initial PanelBar implementation

This commit is contained in:
Joel Holdsworth 2009-03-08 16:50:23 +00:00
parent d3d703e200
commit 0599428045
7 changed files with 173 additions and 7 deletions

View file

@ -83,6 +83,8 @@ gtk_gui_la_SOURCES = \
$(lumigui_srcdir)/widgets/menu-button.cpp \
$(lumigui_srcdir)/widgets/menu-button.hpp \
$(lumigui_srcdir)/widgets/mini-button.hpp \
$(lumigui_srcdir)/widgets/panel-bar.cpp \
$(lumigui_srcdir)/widgets/panel-bar.hpp \
$(lumigui_srcdir)/widgets/video-display-widget.cpp \
$(lumigui_srcdir)/widgets/video-display-widget.hpp \
$(lumigui_srcdir)/widgets/timeline-widget.cpp \

View file

@ -22,6 +22,7 @@
#include "panel.hpp"
#include "../gtk-lumiera.hpp"
#include <libgdl-1.0/gdl/gdl-dock-item-grip.h>
namespace gui {
namespace panels {
@ -29,6 +30,7 @@ namespace panels {
Panel::Panel(workspace::WorkspaceWindow &workspace_window,
const gchar *name, const gchar *long_name,
GdlDockItemBehavior behavior) :
bar(long_name),
workspace(workspace_window)
{
REQUIRE(name != NULL);
@ -44,6 +46,7 @@ Panel::Panel(workspace::WorkspaceWindow &workspace_window,
Panel::Panel(workspace::WorkspaceWindow &workspace_window,
const gchar *name, const gchar *long_name, const gchar *stock_id,
GdlDockItemBehavior behavior) :
bar(long_name, stock_id),
workspace(workspace_window)
{
REQUIRE(name != NULL);
@ -90,9 +93,13 @@ void
Panel::internal_setup()
{
REQUIRE(dock_item != NULL);
REQUIRE(gobj() != NULL);
REQUIRE(gobj() != NULL);
gdl_dock_item_hide_grip(dock_item);
//pack_start(bar);
GdlDockItemGrip *grip = GDL_DOCK_ITEM_GRIP(
gdl_dock_item_get_grip(dock_item));
gdl_dock_item_grip_set_label(grip, ((Widget&)bar).gobj());
gtk_container_add ((GtkContainer*)dock_item, (GtkWidget*)gobj());
gtk_widget_show ((GtkWidget*)dock_item);
}

View file

@ -30,6 +30,8 @@
#include "../gtk-lumiera.hpp"
#include <libgdl-1.0/gdl/gdl-dock-item.h>
#include "../widgets/panel-bar.hpp"
namespace gui {
namespace workspace {
@ -102,6 +104,8 @@ protected:
workspace::WorkspaceWindow &workspace;
GdlDockItem* dock_item;
widgets::PanelBar bar;
};
} // namespace panels

View file

@ -27,6 +27,8 @@
using namespace Gtk;
using namespace sigc;
const int CaptionPadding = 4;
namespace gui {
namespace widgets {
@ -40,15 +42,24 @@ MenuButton::MenuButton() :
setup_button();
}
MenuButton::MenuButton(const Gtk::StockID& stock_id) :
Button(stock_id),
MenuButton::MenuButton(const StockID& stock_id) :
Button(),
image(stock_id, ICON_SIZE_MENU),
caption(),
arrow(arrowType, shadowType)
{
StockItem stock_item;
REQUIRE(StockItem::lookup(stock_id, stock_item));
caption.set_text_with_mnemonic(stock_item.get_label());
hBox.pack_start(image);
setup_button();
}
MenuButton::MenuButton(const Glib::ustring& label, bool mnemonic) :
Button(label, mnemonic),
Button(),
caption(label),
arrow(arrowType, shadowType)
{
setup_button();
@ -71,8 +82,12 @@ void
MenuButton::setup_button()
{
arrow.set(ARROW_DOWN, SHADOW_NONE);
set_image_position(POS_RIGHT);
set_image(arrow);
hBox.pack_start(caption, PACK_EXPAND_WIDGET, CaptionPadding);
hBox.pack_start(arrow);
add(hBox);
show_all();
}
void

View file

@ -104,6 +104,12 @@ private:
private:
Gtk::HBox hBox;
Gtk::Image image;
Gtk::Label caption;
/**
* The internal menu object which is the popup menu of this widget.
**/

View file

@ -0,0 +1,74 @@
/*
panel-bar.hpp - Declaration of the panel bar widget
Copyright (C) Lumiera.org
2009, Joel Holdsworth <joel@airwebreathe.org.uk>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *****************************************************/
#include "panel-bar.hpp"
#include <nobug.h>
using namespace Gtk;
using namespace sigc;
namespace gui {
namespace widgets {
PanelBar::PanelBar(const gchar *name) :
HBox(),
panelButton(Glib::ustring("Hello"/*name*/)),
test(name)
{
internal_setup();
// Make the widget sensitive to mouse events
/*add_events(
Gdk::POINTER_MOTION_MASK |
Gdk::BUTTON_PRESS_MASK |
Gdk::BUTTON_RELEASE_MASK);*/
}
PanelBar::PanelBar(const gchar *name, const gchar *stock_id) :
HBox(),
panelButton(Gtk::StockID(stock_id)),
test(name)
{
internal_setup();
}
void
PanelBar::internal_setup()
{
panelButton.set_relief(RELIEF_NONE);
panelButton.unset_flags(CAN_FOCUS);
panelButton.show();
pack_start(panelButton, PACK_SHRINK);
test.show();
pack_start(test, PACK_EXPAND_WIDGET);
}
/*bool PanelBar::on_button_press_event (GdkEventButton* event)
{
g_message("Hello");
return EventBox::on_button_press_event(event);
}*/
} // widgets
} // gui

View file

@ -0,0 +1,58 @@
/*
panel-bar.hpp - Declaration of the panel bar widget
Copyright (C) Lumiera.org
2009, Joel Holdsworth <joel@airwebreathe.org.uk>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file panel-bar.hpp
** This file contains the definition of timeline widget
*/
#ifndef PANEL_BAR_HPP
#define PANEL_BAR_HPP
#include <gtkmm.h>
#include "menu-button.hpp"
namespace gui {
namespace widgets {
class PanelBar : public Gtk::HBox
{
public:
PanelBar(const gchar *name);
PanelBar(const gchar *name, const gchar *stock_id);
MenuButton panelButton;
Gtk::Label test;
//virtual bool on_button_press_event (GdkEventButton* event);
private:
void internal_setup();
};
} // gui
} // widgets
#endif // PANEL_BAR_HPP