Lumiera  0.pre.03
»edit your freedom«
panel.cpp
Go to the documentation of this file.
1 /*
2  Panel - common base class for all docking panels
3 
4  Copyright (C)
5  2008, Joel Holdsworth <joel@airwebreathe.org.uk>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
14 
20 #include "stage/gtk-base.hpp"
21 #include "stage/panel/panel.hpp"
24 
25 #include <gdl/gdl-dock-item-grip.h>
26 
27 using namespace Gtk;
28 
29 namespace stage {
30 namespace panel{
31 
32  Panel::Panel (workspace::PanelManager& panelManager
33  ,Gdl::DockItem& dockItem
34  ,const gchar* longName
35  ,const gchar* stockID)
36  : Gtk::Box{Gtk::ORIENTATION_VERTICAL}
37  , panelManager_(panelManager)
38  , dockItem_(dockItem)
39  , panelBar_(*this, stockID)
40  {
41  // Set dockItems long-name property
42  Glib::Value<std::string> val;
43  val.init(val.value_type());
44  val.set(longName);
45  g_object_set_property (G_OBJECT (dockItem.gobj()), "long-name", val.gobj());
46 
47  /* Set the grip handle */
49  GdlDockItemGrip *grip = GDL_DOCK_ITEM_GRIP(
50  gdl_dock_item_get_grip(dockItem.gobj()));
51  gdl_dock_item_grip_show_handle(grip);
52  gdl_dock_item_grip_set_label(grip, ((Widget&)panelBar_).gobj());
53  //gdl_dock_item_grip_set_cursor_type(grip, GDK_LEFT_PTR);
54 
55  /* Set up the panel body */
56  // Add this panel's container to the DockItem
57  dockItem.add((Gtk::Widget&)*this);
58 
59  /* Connect the signals */
60  dockItem.signal_hide().connect(
61  sigc::mem_fun(*this, &Panel::on_item_hidden));
62 
63  dockItem.show();
64  }
65 
66 
67  Panel::~Panel()
68  {
71 
72  #if false
73  /* Detach the panel bar */
74  GdlDockItemGrip *grip = GDL_DOCK_ITEM_GRIP(
76  gdl_dock_item_get_grip(dockItem_.gobj()));
77  gtk_container_remove (GTK_CONTAINER(grip),
78  ((Widget&)panelBar_).gobj());
79 
80  /* Remove this panel's container from the DockItem */
81  dockItem_.remove((Gtk::Widget&)*this);
82  #endif
83  }
84 
85  Gdl::DockItem&
87  {
88  return dockItem_;
89  }
90 
91  void
93  {
94  //REQUIRE(dockItem != NULL);
95  if(show) dockItem_.show_item();
96  else dockItem_.hide_item();
97  }
98 
99  bool
100  Panel::is_shown() const
101  {
102  //REQUIRE(dockItem != NULL);
103  return dockItem_.get_visible();
104  }
105 
106  void
107  Panel::iconify()
108  {
109  dockItem_.iconify_item();
110  }
111 
112  bool
114  {
119  GdlDockItem *item = dockItem_.gobj();
120  REQUIRE(item != NULL);
121  return GDL_DOCK_ITEM_ICONIFIED (item);
122  }
123 
124  void
126  {
127  if(lock) dockItem_.lock();
128  else dockItem_.unlock();
129  }
130 
131  bool
132  Panel::is_locked() const
133  {
134  REQUIRE(dockItem_.gobj() != NULL);
135  return not GDL_DOCK_ITEM_NOT_LOCKED(dockItem_.gobj());
136  }
137 
140  {
141  return panelManager_;
142  }
143 
145  Panel::getWorkspaceWindow()
146  {
148  }
149 
150  sigc::signal<void>&
152  {
153  return hidePanelSignal_;
154  }
155 
156  void
158  {
159  hidePanelSignal_.emit();
160  }
161 
162 
163 }}// namespace stage::panel
Management of dockable panels.
bool is_iconified() const
Definition: panel.cpp:113
void on_item_hidden()
event handler when dockItem is hidden.
Definition: panel.cpp:157
void show(bool show=true)
Shows or hides the panel.
Definition: panel.cpp:92
void lock(bool show=true)
Locks or unlocks the panel against modifications.
Definition: panel.cpp:125
A class to manage DockItem objects for WorkspaceWindow.
Base class and interface for all dockable panels.
workspace::PanelManager & panelManager_
The owner panel manager object.
Definition: panel.hpp:94
sigc::signal< void > hidePanelSignal_
signal that fires when the dock item is hidden.
Definition: panel.hpp:100
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
widget::PanelBar panelBar_
panel bar to attach to the panel grip.
Definition: panel.hpp:103
Gdl::DockItem & dockItem_
owner dock item widget that will host the widgets in this panel.
Definition: panel.hpp:97
WorkspaceWindow & getWorkspaceWindow()
Returns a reference to the owner workspace window.
The main Lumiera workspace window.
workspace::PanelManager & getPanelManager()
Definition: panel.cpp:139
This file contains the definition of the main workspace window parent, which is the toplevel parent o...
sigc::signal< void > & signal_hidePanel()
fires when the dock item gets hidden.
Definition: panel.cpp:151
Gdl::DockItem & getDockItem()
Definition: panel.cpp:86
A set of basic GTK includes for the UI.