Added panel grip handles
This commit is contained in:
parent
46d30306cb
commit
457a930f47
2 changed files with 58 additions and 0 deletions
|
|
@ -21,12 +21,16 @@
|
|||
* *****************************************************/
|
||||
|
||||
#include "panel-bar.hpp"
|
||||
#include "../util/rectangle.hpp"
|
||||
|
||||
#include <nobug.h>
|
||||
|
||||
using namespace Gtk;
|
||||
using namespace Glib;
|
||||
using namespace sigc;
|
||||
|
||||
const int DragHandleSize = 10;
|
||||
|
||||
namespace gui {
|
||||
namespace widgets {
|
||||
|
||||
|
|
@ -40,5 +44,42 @@ PanelBar::PanelBar(const gchar *stock_id) :
|
|||
pack_start(panelButton, PACK_SHRINK);
|
||||
}
|
||||
|
||||
bool
|
||||
PanelBar::on_expose_event(GdkEventExpose* event)
|
||||
{
|
||||
HBox::on_expose_event(event);
|
||||
|
||||
RefPtr<const Style> style = get_style();
|
||||
REQUIRE(style);
|
||||
|
||||
const Allocation allocation(get_allocation());
|
||||
const Gdk::Rectangle rect(
|
||||
allocation.get_x() - DragHandleSize, allocation.get_y(),
|
||||
DragHandleSize, allocation.get_height());
|
||||
|
||||
style->paint_handle(get_window(), STATE_NORMAL, SHADOW_NONE,
|
||||
rect, *this, "handlebox", rect.get_x(), rect.get_y(),
|
||||
rect.get_width(), rect.get_height(), ORIENTATION_VERTICAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
PanelBar::on_size_allocate(Gtk::Allocation& allocation)
|
||||
{
|
||||
allocation.set_x(allocation.get_x() + DragHandleSize);
|
||||
HBox::on_size_allocate(allocation);
|
||||
}
|
||||
|
||||
void
|
||||
PanelBar::on_size_request(Gtk::Requisition* requisition)
|
||||
{
|
||||
REQUIRE(requisition);
|
||||
|
||||
HBox::on_size_request(requisition);
|
||||
|
||||
requisition->width += DragHandleSize;
|
||||
}
|
||||
|
||||
} // widgets
|
||||
} // gui
|
||||
|
|
|
|||
|
|
@ -45,6 +45,23 @@ public:
|
|||
* panel.
|
||||
**/
|
||||
PanelBar(const gchar *stock_id);
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* An override to intercept expose events.
|
||||
**/
|
||||
bool on_expose_event(GdkEventExpose* event);
|
||||
|
||||
/**
|
||||
* An override to intercept size allocate events.
|
||||
**/
|
||||
void on_size_allocate(Gtk::Allocation& allocation);
|
||||
|
||||
/**
|
||||
* An override to intercept size request events.
|
||||
**/
|
||||
void on_size_request(Gtk::Requisition* requisition);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue