Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org 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
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_SPLIT_HXX
30 : : #define _SV_SPLIT_HXX
31 : :
32 : : #include <tools/solar.h>
33 : : #include <vcl/dllapi.h>
34 : : #include <vcl/window.hxx>
35 : :
36 : : #define SPLITTER_DEFAULTSTEPSIZE 0xFFFF
37 : :
38 : : // ------------
39 : : // - Splitter -
40 : : // ------------
41 : :
42 : : class VCL_DLLPUBLIC Splitter : public Window
43 : : {
44 : : private:
45 : : Window* mpRefWin;
46 : : long mnSplitPos;
47 : : long mnLastSplitPos;
48 : : long mnStartSplitPos;
49 : : Point maDragPos;
50 : : Rectangle maDragRect;
51 : : sal_Bool mbHorzSplit;
52 : : sal_Bool mbDragFull;
53 : : sal_Bool mbKbdSplitting;
54 : : long mbInKeyEvent;
55 : : long mnKeyboardStepSize;
56 : : Link maStartSplitHdl;
57 : : Link maSplitHdl;
58 : : Link maEndSplitHdl;
59 : :
60 : : SAL_DLLPRIVATE void ImplInitSplitterData();
61 : : SAL_DLLPRIVATE void ImplDrawSplitter();
62 : : SAL_DLLPRIVATE void ImplSplitMousePos( Point& rPos );
63 : : SAL_DLLPRIVATE void ImplStartKbdSplitting();
64 : : SAL_DLLPRIVATE void ImplKbdTracking( KeyCode aKeyCode );
65 : : SAL_DLLPRIVATE sal_Bool ImplSplitterActive();
66 : : SAL_DLLPRIVATE Splitter* ImplFindSibling();
67 : : SAL_DLLPRIVATE void ImplRestoreSplitter();
68 : :
69 : : // Copy assignment is forbidden and not implemented.
70 : : SAL_DLLPRIVATE Splitter (const Splitter &);
71 : : SAL_DLLPRIVATE Splitter& operator= (const Splitter &);
72 : :
73 : : protected:
74 : : using Window::ImplInit;
75 : : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nWinStyle );
76 : :
77 : : public:
78 : : Splitter( Window* pParent, WinBits nStyle = WB_VSCROLL );
79 : : Splitter( Window* pParent, const ResId& rResId );
80 : : ~Splitter();
81 : :
82 : : virtual void StartSplit();
83 : : virtual void EndSplit();
84 : : virtual void Split();
85 : : virtual void Splitting( Point& rSplitPos );
86 : :
87 : : virtual void MouseButtonDown( const MouseEvent& rMEvt );
88 : : virtual void Tracking( const TrackingEvent& rTEvt );
89 : :
90 : : virtual long Notify( NotifyEvent& rNEvt );
91 : :
92 : : virtual void GetFocus();
93 : : virtual void LoseFocus();
94 : : virtual void KeyInput( const KeyEvent& rKEvt );
95 : : virtual void Paint( const Rectangle& rPaintRect );
96 : :
97 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
98 : :
99 : : void StartDrag();
100 : :
101 : : void SetDragRectPixel( const Rectangle& rDragRect,
102 : : Window* pRefWin = NULL );
103 : : const Rectangle& GetDragRectPixel() const { return maDragRect; }
104 : : Window* GetDragWindow() const { return mpRefWin; }
105 : :
106 : : virtual void SetSplitPosPixel( long nPos );
107 : 2 : long GetSplitPosPixel() const { return mnSplitPos; }
108 : :
109 : 1486 : sal_Bool IsHorizontal() const { return mbHorzSplit; }
110 : :
111 : : // set the stepsize of the splitter for cursor movement
112 : : // the default is 10% of the reference window's width/height
113 : : void SetKeyboardStepSize( long nStepSize );
114 : :
115 : 0 : void SetStartSplitHdl( const Link& rLink ) { maStartSplitHdl = rLink; }
116 : : const Link& GetStartSplitHdl() const { return maStartSplitHdl; }
117 : 460 : void SetSplitHdl( const Link& rLink ) { maSplitHdl = rLink; }
118 : 0 : void SetEndSplitHdl( const Link& rLink ) { maEndSplitHdl = rLink; }
119 : : const Link& GetEndSplitHdl() const { return maEndSplitHdl; }
120 : : const Link& GetSplitHdl() const { return maSplitHdl; }
121 : : };
122 : :
123 : : #endif // _SV_SPLIT_HXX
124 : :
125 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|