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#include <tdeversion.h>
31
32#ifndef NO_KDE2
33#include <netwm_def.h>
34#endif
35
36class TQFrame;
37class KDockContainer;
38class KDockWidget;
39
40
47class KDockSplitter : public TQWidget
48{
49 //TQ_OBJECT
50
51public:
59 KDockSplitter(TQWidget *parent= 0, const char *name= 0, TQt::Orientation orient=TQt::Vertical, int pos= 50);
60 virtual ~KDockSplitter(){};
61
70 void activate(TQWidget *c0, TQWidget *c1 = 0L);
74 void deactivate();
75
81#if KDE_IS_VERSION(3,4,89)
82 ;
83#else
84 {
85// kdDebug() << "^^^^^^^^^^^^^^^^^^^^^ separatorPosInPercent() " << separatorPos() / (factor/100) << " " << separatorPos() / 100 << endl;
86 return separatorPos() / 100;
87 }
88#endif
93 void setSeparatorPosInPercent(int percent)
94#if KDE_IS_VERSION(3,4,89)
95 ;
96#else
97 {
98// kdDebug() << "^^^^^^^^^^^^^^^^^^^^^ setSeparatorPosInPercent() " << percent << " " << separatorPos() / 100 << endl;
99 setSeparatorPos( percent * 100, false );
100 }
101#endif
102
111 int separatorPos() const;
117 void setSeparatorPos(int pos, bool do_resize = true);
126 // ### please come up with a nicer name
127 void setSeparatorPosX(int pos, bool do_resize=false);
128
133 virtual bool eventFilter(TQObject *, TQEvent *);
134 virtual bool event( TQEvent * );
135
139 TQWidget* getFirst() const { return child0; }
143 TQWidget* getLast() const { return child1; }
148 TQWidget* getAnother( TQWidget* w ) const;
149 void updateName();
150
156 void setOpaqueResize(bool b=true);
157 bool opaqueResize() const;
158
163 void setKeepSize(bool b=true);
164 bool keepSize() const;
165
166
167 void setForcedFixedWidth(KDockWidget *dw,int w);
168 void setForcedFixedHeight(KDockWidget *dw,int h);
169 void restoreFromForcedFixedSize(KDockWidget *dw);
170
174 TQt::Orientation orientation(){return m_orientation;}
175
176protected:
177 friend class KDockContainer;
183 int checkValue(int position) const;
191 int checkValueOverlapped(int position, TQWidget* child) const;
192
207 virtual void resizeEvent(TQResizeEvent *ev);
208
209/*
210protected slots:
211 void delayedResize();*/
212
213private:
219 void setupMinMaxSize();
225 TQWidget *child0, *child1;
226 TQt::Orientation m_orientation;
230 bool initialised;
235 TQFrame* divider;
246 int xpos, savedXPos;
247 bool mOpaqueResize, mKeepSize;
248 int fixedWidth0,fixedWidth1;
249 int fixedHeight0,fixedHeight1;
250 bool m_dontRecalc;
254 static const int factor = 100000;
255};
256
257#endif
Like TQSplitter but specially designed for dockwidgets stuff.
Definition ksplitter.h:48
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:139
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:174
void setSeparatorPosInPercent(int percent)
Set the separator position in percent (%), so the range must be [0..100].
Definition ksplitter.h:93
TQWidget * getLast() const
Definition ksplitter.h:143
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].
Definition ksplitter.h:80
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.