1 /*
2 * ===========================
3 * VDK Visual Development Kit
4 * Version 2.0.2
5 * April 2002
6 * ===========================
7 *
8 * Copyright (C) 1998, Mario Motta
9 * Developed by Mario Motta <mmotta@guest.net>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 * 02111-1307, USA.
25 */
26 #include <vdk/vdkdockable.h>
27 /*
28 */
VDKDockerBox(VDKForm * owner,int mode)29 VDKDockerBox:: VDKDockerBox (VDKForm* owner, int mode):
30 VDKBox (owner, mode),
31 justify(l_justify),
32 fill(1),
33 expand(1),
34 padding(0),
35 Docked ("Docked", this, false,
36 &VDKDockerBox::SetDocked,
37 &VDKDockerBox::GetDocked)
38 {
39 dock_form = NULL;
40 }
41 /*
42 */
~VDKDockerBox()43 VDKDockerBox::~VDKDockerBox ()
44 {
45 }
46 /*
47 */
48 void
Dock()49 VDKDockerBox::Dock ()
50 {
51
52 VDKObjectContainer *container =
53 dynamic_cast <VDKObjectContainer*>(parent);
54 g_return_if_fail (container != NULL);
55 if (container && !dock_form)
56 {
57 dock_form = new VDKDockerBoxForm (Owner (), NULL);
58 container->RemoveObjectFromContainer (this);
59 dock_form->box_from = container;
60 dock_form->docker = this;
61 dock_form->Add (this);
62 dock_form->Objects ().remove (this);
63 gtk_widget_unref (widget);
64 dock_form->Show ();
65 }
66 }
67 /*
68 */
69 void
Undock()70 VDKDockerBox::Undock ()
71 {
72 if (dock_form)
73 dock_form->Close ();
74 }
75
76 /*
77 */
78 void
SetDocked(bool flag)79 VDKDockerBox::SetDocked (bool flag)
80 {
81 if (flag)
82 {
83 Dock ();
84 SignalEmit(docked_signal);
85 SignalEmit("docked");
86 }
87 else
88 {
89 Undock ();
90 }
91 }
92
93 /*
94 */
95 bool
GetDocked()96 VDKDockerBox::GetDocked ()
97 {
98 return dock_form != NULL;
99 }
100 /*
101 DOCKABLE FORM
102 */
VDKDockerBoxForm(VDKForm * owner,char * title)103 VDKDockerBoxForm::VDKDockerBoxForm (VDKForm* owner, char* title):
104 VDKForm (owner, title), box_from (NULL), docker (NULL)
105 {
106 }
107 /*
108 */
~VDKDockerBoxForm()109 VDKDockerBoxForm::~VDKDockerBoxForm ()
110 {
111 }
112 /*
113 */
114 void
Setup()115 VDKDockerBoxForm::Setup ()
116 {
117 }
118 /*
119 */
120 bool
CanClose()121 VDKDockerBoxForm::CanClose ()
122 {
123 Box ()->RemoveObjectFromContainer (docker);
124 box_from->Add (docker,docker->justify,docker->fill,docker->expand,docker->padding);
125 gtk_widget_unref (docker->WrappedWidget ());
126 docker->dock_form = NULL;
127 docker->SignalEmit(undocked_signal);
128 docker->SignalEmit("undocked");
129 return true;
130 }
131