kexi

ksplitter.h
1/* This file is part of the KDE libraries
2 Copyright (C) 2000 Max Judin <novaprint@mtu-net.ru>
3 Copyright (C) 2005 Dominik Haumann <dhdev@gmx.de>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20/*
21 IMPORTANT Note: This file compiles also in TQt-only mode by using the NO_KDE2 precompiler definition
22*/
23
24#ifndef KDOCKWIDGET_PRIVATE_H
25#define KDOCKWIDGET_PRIVATE_H
26
27#include <tqwidget.h>
28#include <tqpushbutton.h>
29
30
31#ifndef NO_KDE2
32#include <netwm_def.h>
33#endif
34
35class TQFrame;
36class KDockContainer;
37class KDockWidget;
38
39
46class KDockSplitter : public TQWidget
47{
48 //TQ_OBJECT
49
50public:
58 KDockSplitter(TQWidget *parent= 0, const char *name= 0, TQt::Orientation orient=TQt::Vertical, int pos= 50);
59 virtual ~KDockSplitter(){};
60
69 void activate(TQWidget *c0, TQWidget *c1 = 0L);
73 void deactivate();
74
84 void setSeparatorPosInPercent(int percent);
85
94 int separatorPos() const;
100 void setSeparatorPos(int pos, bool do_resize = true);
109 // ### please come up with a nicer name
110 void setSeparatorPosX(int pos, bool do_resize=false);
111
116 virtual bool eventFilter(TQObject *, TQEvent *);
117 virtual bool event( TQEvent * );
118
122 TQWidget* getFirst() const { return child0; }
126 TQWidget* getLast() const { return child1; }
131 TQWidget* getAnother( TQWidget* w ) const;
132 void updateName();
133
139 void setOpaqueResize(bool b=true);
140 bool opaqueResize() const;
141
146 void setKeepSize(bool b=true);
147 bool keepSize() const;
148
149
150 void setForcedFixedWidth(KDockWidget *dw,int w);
151 void setForcedFixedHeight(KDockWidget *dw,int h);
152 void restoreFromForcedFixedSize(KDockWidget *dw);
153
157 TQt::Orientation orientation(){return m_orientation;}
158
159protected:
160 friend class KDockContainer;
166 int checkValue(int position) const;
174 int checkValueOverlapped(int position, TQWidget* child) const;
175
190 virtual void resizeEvent(TQResizeEvent *ev);
191
192/*
193protected slots:
194 void delayedResize();*/
195
196private:
202 void setupMinMaxSize();
208 TQWidget *child0, *child1;
209 TQt::Orientation m_orientation;
213 bool initialised;
218 TQFrame* divider;
229 int xpos, savedXPos;
230 bool mOpaqueResize, mKeepSize;
231 int fixedWidth0,fixedWidth1;
232 int fixedHeight0,fixedHeight1;
233 bool m_dontRecalc;
237 static const int factor = 100000;
238};
239
240#endif
void deactivate()
Disables the splitter.
TQWidget * getAnother(TQWidget *w) const
If w is child0, return child1, otherwise child0.
void setSeparatorPos(int pos, bool do_resize=true)
set separator position.
TQWidget * getFirst() const
Definition ksplitter.h:122
int separatorPos() const
Return the separator position in the range [0..100000] To get the separator position in procent (%),...
void setOpaqueResize(bool b=true)
Set opaque flag.
int checkValueOverlapped(int position, TQWidget *child) const
Make sure the splitter position is not out of bounds.
TQt::Orientation orientation()
The orientation is either TQt::Horizontal or TQt::Vertical.
Definition ksplitter.h:157
void setSeparatorPosInPercent(int percent)
Set the separator position in percent (%), so the range must be [0..100].
TQWidget * getLast() const
Definition ksplitter.h:126
void activate(TQWidget *c0, TQWidget *c1=0L)
Initialize the splitter.
virtual bool eventFilter(TQObject *, TQEvent *)
The eventfilter installed on the divider processes all splitter resizing events.
int checkValue(int position) const
Make sure the splitter position is not out of bounds.
int separatorPosInPercent()
Return the separator position in percent (%), so the range is [0..100].
virtual void resizeEvent(TQResizeEvent *ev)
The resize event resizes child0, child1 and the divider.
void setKeepSize(bool b=true)
If b is true, the splitter will keep its size on resize events.
KDockSplitter(TQWidget *parent=0, const char *name=0, TQt::Orientation orient=TQt::Vertical, int pos=50)
Constructor.
void setSeparatorPosX(int pos, bool do_resize=false)
For usage from outside.