xref: /AOO41X/main/vcl/source/window/split.cxx (revision ca62e2c2083b5d0995f1245bad6c2edfb455fbec)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 // MARKER(update_precomp.py): autogen include statement, do not remove
23 #include "precompiled_vcl.hxx"
24 
25 #include <tools/rc.h>
26 #include <tools/poly.hxx>
27 
28 #include <vcl/event.hxx>
29 #include <vcl/split.hxx>
30 #include <vcl/svapp.hxx>
31 #include <vcl/syswin.hxx>
32 #include <vcl/taskpanelist.hxx>
33 #include <vcl/gradient.hxx>
34 #include <vcl/lineinfo.hxx>
35 
36 #include <rtl/instance.hxx>
37 
38 #include <window.h>
39 
40 namespace
41 {
42     struct ImplBlackWall
43         : public rtl::StaticWithInit<Wallpaper, ImplBlackWall> {
operator ()__anona5ad09260111::ImplBlackWall44         Wallpaper operator () () {
45             return Wallpaper(COL_BLACK);
46         }
47     };
48     struct ImplWhiteWall
49         : public rtl::StaticWithInit<Wallpaper, ImplWhiteWall> {
operator ()__anona5ad09260111::ImplWhiteWall50         Wallpaper operator () () {
51             return Wallpaper(COL_LIGHTGRAY);
52         }
53     };
54 }
55 
56 // =======================================================================
57 
ImplInitSplitterData()58 void Splitter::ImplInitSplitterData()
59 {
60     ImplGetWindowImpl()->mbSplitter        = sal_True;
61     mpRefWin          = NULL;
62     mnSplitPos        = 0;
63     mnLastSplitPos    = 0;
64     mnStartSplitPos   = 0;
65     mbDragFull        = sal_False;
66     mbKbdSplitting    = sal_False;
67     mbInKeyEvent      = 0;
68     mnKeyboardStepSize = SPLITTER_DEFAULTSTEPSIZE;
69 }
70 
71 // -----------------------------------------------------------------------
72 
ImplInitHorVer(bool bNew)73 void Splitter::ImplInitHorVer(bool bNew)
74 {
75     if(bNew != (bool)mbHorzSplit)
76     {
77         mbHorzSplit = bNew;
78 
79         PointerStyle ePointerStyle;
80         const StyleSettings& rSettings = GetSettings().GetStyleSettings();
81 
82         if ( mbHorzSplit )
83         {
84             ePointerStyle = POINTER_HSPLIT;
85             SetSizePixel( Size( rSettings.GetSplitSize(), rSettings.GetScrollBarSize() ) );
86         }
87         else
88         {
89             ePointerStyle = POINTER_VSPLIT;
90             SetSizePixel( Size( rSettings.GetScrollBarSize(), rSettings.GetSplitSize() ) );
91         }
92 
93         SetPointer( Pointer( ePointerStyle ) );
94     }
95 }
96 
97 // -----------------------------------------------------------------------
98 
ImplInit(Window * pParent,WinBits nWinStyle)99 void Splitter::ImplInit( Window* pParent, WinBits nWinStyle )
100 {
101     Window::ImplInit( pParent, nWinStyle, NULL );
102 
103     mpRefWin = pParent;
104 
105     ImplInitHorVer(nWinStyle & WB_HSCROLL);
106 
107     if( GetSettings().GetStyleSettings().GetFaceColor().IsDark() )
108         SetBackground( ImplWhiteWall::get() );
109     else
110         SetBackground( ImplBlackWall::get() );
111 
112     TaskPaneList *pTList = GetSystemWindow()->GetTaskPaneList();
113     pTList->AddWindow( this );
114 }
115 
116 // -----------------------------------------------------------------------
117 
ImplSplitMousePos(Point & rPos)118 void Splitter::ImplSplitMousePos( Point& rPos )
119 {
120     if ( mbHorzSplit )
121     {
122         if ( rPos.X() > maDragRect.Right()-1 )
123             rPos.X() = maDragRect.Right()-1;
124         if ( rPos.X() < maDragRect.Left()+1 )
125             rPos.X() = maDragRect.Left()+1;
126     }
127     else
128     {
129         if ( rPos.Y() > maDragRect.Bottom()-1 )
130             rPos.Y() = maDragRect.Bottom()-1;
131         if ( rPos.Y() < maDragRect.Top()+1 )
132             rPos.Y() = maDragRect.Top()+1;
133     }
134 }
135 
136 // -----------------------------------------------------------------------
137 
ImplDrawSplitter()138 void Splitter::ImplDrawSplitter()
139 {
140     Rectangle aInvRect( maDragRect );
141 
142     if ( mbHorzSplit )
143     {
144         aInvRect.Left()     = maDragPos.X() - 1;
145         aInvRect.Right()    = maDragPos.X() + 1;
146     }
147     else
148     {
149         aInvRect.Top()      = maDragPos.Y() - 1;
150         aInvRect.Bottom()   = maDragPos.Y() + 1;
151     }
152 
153     mpRefWin->InvertTracking( mpRefWin->PixelToLogic(aInvRect), SHOWTRACK_SPLIT );
154 }
155 
156 // -----------------------------------------------------------------------
157 
Splitter(Window * pParent,WinBits nStyle)158 Splitter::Splitter( Window* pParent, WinBits nStyle ) :
159     Window( WINDOW_SPLITTER )
160 {
161     ImplInitSplitterData();
162     ImplInit( pParent, nStyle );
163 }
164 
165 // -----------------------------------------------------------------------
166 
Splitter(Window * pParent,const ResId & rResId)167 Splitter::Splitter( Window* pParent, const ResId& rResId ) :
168     Window( WINDOW_SPLITTER )
169 {
170     ImplInitSplitterData();
171     rResId.SetRT( RSC_SPLITTER );
172     WinBits nStyle = ImplInitRes( rResId );
173     ImplInit( pParent, nStyle );
174     ImplLoadRes( rResId );
175 
176     if ( !(nStyle & WB_HIDE) )
177         Show();
178 }
179 
180 // -----------------------------------------------------------------------
181 
~Splitter()182 Splitter::~Splitter()
183 {
184     TaskPaneList *pTList = GetSystemWindow()->GetTaskPaneList();
185     pTList->RemoveWindow( this );
186 }
187 
188 // -----------------------------------------------------------------------
189 
SetHorizontal(bool bNew)190 void Splitter::SetHorizontal(bool bNew)
191 {
192     if(bNew != (bool)mbHorzSplit)
193     {
194         ImplInitHorVer(bNew);
195     }
196 }
197 
198 // -----------------------------------------------------------------------
199 
SetKeyboardStepSize(long nStepSize)200 void Splitter::SetKeyboardStepSize( long nStepSize )
201 {
202     mnKeyboardStepSize = nStepSize;
203 }
204 
205 // -----------------------------------------------------------------------
206 
GetKeyboardStepSize() const207 long Splitter::GetKeyboardStepSize() const
208 {
209     return mnKeyboardStepSize;
210 }
211 
212 // -----------------------------------------------------------------------
213 
ImplFindSibling()214 Splitter* Splitter::ImplFindSibling()
215 {
216     // look for another splitter with the same parent but different orientation
217     Window *pWin = GetParent()->GetWindow( WINDOW_FIRSTCHILD );
218     Splitter *pSplitter = NULL;
219     while( pWin )
220     {
221         if( pWin->ImplIsSplitter() )
222         {
223             pSplitter = (Splitter*) pWin;
224             if( pSplitter != this && IsHorizontal() != pSplitter->IsHorizontal() )
225                 return pSplitter;
226         }
227         pWin = pWin->GetWindow( WINDOW_NEXT );
228     }
229     return NULL;
230 }
231 
232 // -----------------------------------------------------------------------
233 
ImplSplitterActive()234 sal_Bool Splitter::ImplSplitterActive()
235 {
236     // is splitter in document or at scrollbar handle ?
237 
238     sal_Bool bActive = sal_True;
239     const StyleSettings& rSettings = GetSettings().GetStyleSettings();
240     long nA = rSettings.GetScrollBarSize();
241     long nB = rSettings.GetSplitSize();
242 
243     Size aSize = GetOutputSize();
244     if ( mbHorzSplit )
245     {
246         if( aSize.Width() == nB && aSize.Height() == nA )
247             bActive = sal_False;
248     }
249     else
250     {
251         if( aSize.Width() == nA && aSize.Height() == nB )
252             bActive = sal_False;
253     }
254     return bActive;
255 }
256 
257 // -----------------------------------------------------------------------
258 
MouseButtonDown(const MouseEvent & rMEvt)259 void Splitter::MouseButtonDown( const MouseEvent& rMEvt )
260 {
261     if ( rMEvt.GetClicks() == 2 )
262     {
263         if ( mnLastSplitPos != mnSplitPos )
264         {
265             StartSplit();
266             Point aPos = rMEvt.GetPosPixel();
267             if ( mbHorzSplit )
268                 aPos.X() = mnLastSplitPos;
269             else
270                 aPos.Y() = mnLastSplitPos;
271             ImplSplitMousePos( aPos );
272             Splitting( aPos );
273             ImplSplitMousePos( aPos );
274             long nTemp = mnSplitPos;
275             if ( mbHorzSplit )
276                 SetSplitPosPixel( aPos.X() );
277             else
278                 SetSplitPosPixel( aPos.Y() );
279             mnLastSplitPos = nTemp;
280             Split();
281             EndSplit();
282         }
283     }
284     else
285         StartDrag();
286 }
287 
288 // -----------------------------------------------------------------------
289 
Tracking(const TrackingEvent & rTEvt)290 void Splitter::Tracking( const TrackingEvent& rTEvt )
291 {
292     if ( rTEvt.IsTrackingEnded() )
293     {
294         if ( !mbDragFull )
295             ImplDrawSplitter();
296 
297         if ( !rTEvt.IsTrackingCanceled() )
298         {
299             long nNewPos;
300             if ( mbHorzSplit )
301                 nNewPos = maDragPos.X();
302             else
303                 nNewPos = maDragPos.Y();
304             if ( nNewPos != mnStartSplitPos )
305             {
306                 SetSplitPosPixel( nNewPos );
307                 mnLastSplitPos = 0;
308                 Split();
309             }
310             EndSplit();
311         }
312         else if ( mbDragFull )
313         {
314             SetSplitPosPixel( mnStartSplitPos );
315             Split();
316         }
317         mnStartSplitPos = 0;
318     }
319     else
320     {
321         //Point aNewPos = mpRefWin->ScreenToOutputPixel( OutputToScreenPixel( rTEvt.GetMouseEvent().GetPosPixel() ) );
322         Point aNewPos = mpRefWin->NormalizedScreenToOutputPixel( OutputToNormalizedScreenPixel( rTEvt.GetMouseEvent().GetPosPixel() ) );
323         ImplSplitMousePos( aNewPos );
324         Splitting( aNewPos );
325         ImplSplitMousePos( aNewPos );
326 
327         if ( mbHorzSplit )
328         {
329             if ( aNewPos.X() == maDragPos.X() )
330                 return;
331         }
332         else
333         {
334             if ( aNewPos.Y() == maDragPos.Y() )
335                 return;
336         }
337 
338         if ( mbDragFull )
339         {
340             maDragPos = aNewPos;
341             long nNewPos;
342             if ( mbHorzSplit )
343                 nNewPos = maDragPos.X();
344             else
345                 nNewPos = maDragPos.Y();
346             if ( nNewPos != mnSplitPos )
347             {
348                 SetSplitPosPixel( nNewPos );
349                 mnLastSplitPos = 0;
350                 Split();
351             }
352 
353             GetParent()->Update();
354         }
355         else
356         {
357             ImplDrawSplitter();
358             maDragPos = aNewPos;
359             ImplDrawSplitter();
360         }
361     }
362 }
363 
364 // -----------------------------------------------------------------------
365 
ImplKbdTracking(KeyCode aKeyCode)366 void Splitter::ImplKbdTracking( KeyCode aKeyCode )
367 {
368     sal_uInt16 nCode = aKeyCode.GetCode();
369     if ( nCode == KEY_ESCAPE || nCode == KEY_RETURN )
370     {
371         if( !mbKbdSplitting )
372             return;
373         else
374             mbKbdSplitting = sal_False;
375 
376         if ( nCode != KEY_ESCAPE )
377         {
378             long nNewPos;
379             if ( mbHorzSplit )
380                 nNewPos = maDragPos.X();
381             else
382                 nNewPos = maDragPos.Y();
383             if ( nNewPos != mnStartSplitPos )
384             {
385                 SetSplitPosPixel( nNewPos );
386                 mnLastSplitPos = 0;
387                 Split();
388             }
389         }
390         else
391         {
392             SetSplitPosPixel( mnStartSplitPos );
393             Split();
394             EndSplit();
395         }
396         mnStartSplitPos = 0;
397     }
398     else
399     {
400         Point aNewPos;
401         Size aSize = mpRefWin->GetOutputSize();
402         Point aPos = GetPosPixel();
403         // depending on the position calc allows continous moves or snaps to row/columns
404         // continous mode is active when position is at the origin or end of the splitter
405         // otherwise snap mode is active
406         // default here is snap, holding shift sets continous mode
407         if( mbHorzSplit )
408             aNewPos = Point( ImplSplitterActive() ? aPos.X() : mnSplitPos, aKeyCode.IsShift() ? 0 : aSize.Height()/2);
409         else
410             aNewPos = Point( aKeyCode.IsShift() ? 0 : aSize.Width()/2, ImplSplitterActive() ? aPos.Y() : mnSplitPos );
411 
412         Point aOldWindowPos = GetPosPixel();
413 
414         int maxiter = 500;  // avoid endless loop
415         int delta=0;
416         int delta_step = mbHorzSplit  ? aSize.Width()/10 : aSize.Height()/10;
417 
418         // use the specified step size if it was set
419         if( mnKeyboardStepSize != SPLITTER_DEFAULTSTEPSIZE )
420             delta_step = mnKeyboardStepSize;
421 
422         while( maxiter-- && aOldWindowPos == GetPosPixel() )
423         {
424             // inc/dec position until application performs changes
425             // thus a single key press really moves the splitter
426             if( aKeyCode.IsShift() )
427                 delta++;
428             else
429                 delta += delta_step;
430 
431             switch( nCode )
432             {
433             case KEY_LEFT:
434                 aNewPos.X()-=delta;
435                 break;
436             case KEY_RIGHT:
437                 aNewPos.X()+=delta;
438                 break;
439             case KEY_UP:
440                 aNewPos.Y()-=delta;
441                 break;
442             case KEY_DOWN:
443                 aNewPos.Y()+=delta;
444                 break;
445             default:
446                 maxiter = 0;    // leave loop
447                 break;
448             }
449             ImplSplitMousePos( aNewPos );
450             Splitting( aNewPos );
451             ImplSplitMousePos( aNewPos );
452 
453             if ( mbHorzSplit )
454             {
455                 if ( aNewPos.X() == maDragPos.X() )
456                     continue;
457             }
458             else
459             {
460                 if ( aNewPos.Y() == maDragPos.Y() )
461                     continue;
462             }
463 
464             maDragPos = aNewPos;
465             long nNewPos;
466             if ( mbHorzSplit )
467                 nNewPos = maDragPos.X();
468             else
469                 nNewPos = maDragPos.Y();
470             if ( nNewPos != mnSplitPos )
471             {
472                 SetSplitPosPixel( nNewPos );
473                 mnLastSplitPos = 0;
474                 Split();
475             }
476             GetParent()->Update();
477         }
478     }
479 }
480 
481 // -----------------------------------------------------------------------
482 
StartSplit()483 void Splitter::StartSplit()
484 {
485     maStartSplitHdl.Call( this );
486 }
487 
488 // -----------------------------------------------------------------------
489 
Split()490 void Splitter::Split()
491 {
492     maSplitHdl.Call( this );
493 }
494 
495 // -----------------------------------------------------------------------
496 
EndSplit()497 void Splitter::EndSplit()
498 {
499     if ( maEndSplitHdl.IsSet() )
500         maEndSplitHdl.Call( this );
501 }
502 
503 // -----------------------------------------------------------------------
504 
Splitting(Point &)505 void Splitter::Splitting( Point& /* rSplitPos */ )
506 {
507 }
508 
509 // -----------------------------------------------------------------------
510 
SetDragRectPixel(const Rectangle & rDragRect,Window * _pRefWin)511 void Splitter::SetDragRectPixel( const Rectangle& rDragRect, Window* _pRefWin )
512 {
513     maDragRect = rDragRect;
514     if ( !_pRefWin )
515         mpRefWin = GetParent();
516     else
517         mpRefWin = _pRefWin;
518 }
519 
520 // -----------------------------------------------------------------------
521 
SetSplitPosPixel(long nNewPos)522 void Splitter::SetSplitPosPixel( long nNewPos )
523 {
524     mnSplitPos = nNewPos;
525 }
526 
527 // -----------------------------------------------------------------------
528 
SetLastSplitPosPixel(long nNewPos)529 void Splitter::SetLastSplitPosPixel( long nNewPos )
530 {
531     mnLastSplitPos = nNewPos;
532 }
533 
534 // -----------------------------------------------------------------------
535 
StartDrag()536 void Splitter::StartDrag()
537 {
538     if ( IsTracking() )
539         return;
540 
541     StartSplit();
542 
543     // Tracking starten
544     StartTracking();
545 
546     // Start-Positon ermitteln
547     maDragPos = mpRefWin->GetPointerPosPixel();
548     ImplSplitMousePos( maDragPos );
549     Splitting( maDragPos );
550     ImplSplitMousePos( maDragPos );
551     if ( mbHorzSplit )
552         mnStartSplitPos = maDragPos.X();
553     else
554         mnStartSplitPos = maDragPos.Y();
555 
556     mbDragFull = (Application::GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SPLIT) != 0;
557     if ( !mbDragFull )
558         ImplDrawSplitter();
559 }
560 
561 
562 // -----------------------------------------------------------------------
563 
ImplStartKbdSplitting()564 void Splitter::ImplStartKbdSplitting()
565 {
566     if( mbKbdSplitting )
567         return;
568 
569     mbKbdSplitting = sal_True;
570 
571     StartSplit();
572 
573     // determine start position
574     // because we have no mouse position we take either the position
575     // of the splitter window or the last split position
576     // the other coordinate is just the center of the reference window
577     Size aSize = mpRefWin->GetOutputSize();
578     Point aPos = GetPosPixel();
579     if( mbHorzSplit )
580         maDragPos = Point( ImplSplitterActive() ? aPos.X() : mnSplitPos, aSize.Height()/2 );
581     else
582         maDragPos = Point( aSize.Width()/2, ImplSplitterActive() ? aPos.Y() : mnSplitPos );
583     ImplSplitMousePos( maDragPos );
584     Splitting( maDragPos );
585     ImplSplitMousePos( maDragPos );
586     if ( mbHorzSplit )
587         mnStartSplitPos = maDragPos.X();
588     else
589         mnStartSplitPos = maDragPos.Y();
590 }
591 
592 // -----------------------------------------------------------------------
593 
ImplRestoreSplitter()594 void Splitter::ImplRestoreSplitter()
595 {
596     // set splitter in the center of the ref window
597     StartSplit();
598     Size aSize = mpRefWin->GetOutputSize();
599     Point aPos = Point( aSize.Width()/2 , aSize.Height()/2);
600     if ( mnLastSplitPos != mnSplitPos && mnLastSplitPos > 5 )
601     {
602         // restore last pos if it was a useful position (>5)
603         if ( mbHorzSplit )
604             aPos.X() = mnLastSplitPos;
605         else
606             aPos.Y() = mnLastSplitPos;
607     }
608 
609     ImplSplitMousePos( aPos );
610     Splitting( aPos );
611     ImplSplitMousePos( aPos );
612     long nTemp = mnSplitPos;
613     if ( mbHorzSplit )
614         SetSplitPosPixel( aPos.X() );
615     else
616         SetSplitPosPixel( aPos.Y() );
617     mnLastSplitPos = nTemp;
618     Split();
619     EndSplit();
620 }
621 
622 
623 // -----------------------------------------------------------------------
624 
GetFocus()625 void Splitter::GetFocus()
626 {
627     if( !ImplSplitterActive() )
628         ImplRestoreSplitter();
629 
630     Invalidate();
631 }
632 
633 // -----------------------------------------------------------------------
634 
LoseFocus()635 void Splitter::LoseFocus()
636 {
637     if( mbKbdSplitting )
638     {
639         KeyCode aReturnKey( KEY_RETURN );
640         ImplKbdTracking( aReturnKey );
641         mbKbdSplitting = sal_False;
642     }
643     Invalidate();
644 }
645 
646 // -----------------------------------------------------------------------
647 
KeyInput(const KeyEvent & rKEvt)648 void Splitter::KeyInput( const KeyEvent& rKEvt )
649 {
650     if( mbInKeyEvent )
651         return;
652 
653     mbInKeyEvent = 1;
654 
655     Splitter *pSibling = ImplFindSibling();
656     KeyCode aKeyCode = rKEvt.GetKeyCode();
657     sal_uInt16 nCode = aKeyCode.GetCode();
658     switch ( nCode )
659     {
660         case KEY_UP:
661         case KEY_DOWN:
662             if( !mbHorzSplit )
663             {
664                 ImplStartKbdSplitting();
665                 ImplKbdTracking( aKeyCode );
666             }
667             else
668             {
669                 if( pSibling )
670                 {
671                     pSibling->GrabFocus();
672                     pSibling->KeyInput( rKEvt );
673                 }
674             }
675             break;
676         case KEY_RIGHT:
677         case KEY_LEFT:
678             if( mbHorzSplit )
679             {
680                 ImplStartKbdSplitting();
681                 ImplKbdTracking( aKeyCode );
682             }
683             else
684             {
685                 if( pSibling )
686                 {
687                     pSibling->GrabFocus();
688                     pSibling->KeyInput( rKEvt );
689                 }
690             }
691             break;
692 
693         case KEY_DELETE:
694             if( ImplSplitterActive() )
695             {
696                 if( mbKbdSplitting )
697                 {
698                     KeyCode aKey( KEY_ESCAPE );
699                     ImplKbdTracking( aKey );
700                 }
701 
702                 StartSplit();
703                 Point aPos;
704                 if ( mbHorzSplit )
705                     aPos.X() = 0;
706                 else
707                     aPos.Y() = 0;
708                 ImplSplitMousePos( aPos );
709                 Splitting( aPos );
710                 ImplSplitMousePos( aPos );
711                 long nTemp = mnSplitPos;
712                 if ( mbHorzSplit )
713                     SetSplitPosPixel( aPos.X() );
714                 else
715                     SetSplitPosPixel( aPos.Y() );
716                 mnLastSplitPos = nTemp;
717                 Split();
718                 EndSplit();
719 
720                 // Shift-Del deletes both splitters
721                 if( aKeyCode.IsShift() && pSibling )
722                     pSibling->KeyInput( rKEvt );
723 
724                 GrabFocusToDocument();
725             }
726             break;
727 
728         case KEY_ESCAPE:
729             if( mbKbdSplitting )
730                 ImplKbdTracking( aKeyCode );
731             else
732                 GrabFocusToDocument();
733             break;
734 
735         case KEY_RETURN:
736             ImplKbdTracking( aKeyCode );
737             GrabFocusToDocument();
738             break;
739         default:    // let any key input fix the splitter
740             Window::KeyInput( rKEvt );
741             GrabFocusToDocument();
742             break;
743     }
744     mbInKeyEvent = 0;
745 }
746 
747 // -----------------------------------------------------------------------
748 
Notify(NotifyEvent & rNEvt)749 long Splitter::Notify( NotifyEvent& rNEvt )
750 {
751     return Window::Notify( rNEvt );
752 }
753 
754 // -----------------------------------------------------------------------
755 
DataChanged(const DataChangedEvent & rDCEvt)756 void Splitter::DataChanged( const DataChangedEvent& rDCEvt )
757 {
758     Window::DataChanged( rDCEvt );
759     if( rDCEvt.GetType() == DATACHANGED_SETTINGS )
760     {
761         Color oldFaceColor = ((AllSettings *) rDCEvt.GetData())->GetStyleSettings().GetFaceColor();
762         Color newFaceColor = Application::GetSettings().GetStyleSettings().GetFaceColor();
763         if( oldFaceColor.IsDark() != newFaceColor.IsDark() )
764         {
765             if( newFaceColor.IsDark() )
766                 SetBackground( ImplWhiteWall::get() );
767             else
768                 SetBackground( ImplBlackWall::get() );
769         }
770     }
771 }
772 
773 // -----------------------------------------------------------------------
774 
Paint(const Rectangle & rPaintRect)775 void Splitter::Paint( const Rectangle& rPaintRect )
776 {
777     if( HasFocus() || mbKbdSplitting )
778     {
779         Color oldFillCol = GetFillColor();
780         Color oldLineCol = GetLineColor();
781 
782         SetLineColor();
783         SetFillColor( GetSettings().GetStyleSettings().GetFaceColor() );
784         DrawRect( rPaintRect );
785 
786         Color aSelectionBorderCol( GetSettings().GetStyleSettings().GetActiveColor() );
787         SetFillColor( aSelectionBorderCol );
788         SetLineColor();
789 
790         Polygon aPoly( rPaintRect );
791         PolyPolygon aPolyPoly( aPoly );
792         DrawTransparent( aPolyPoly, 85 );
793 
794         SetLineColor( aSelectionBorderCol );
795         SetFillColor();
796 
797         if( mbKbdSplitting )
798         {
799             LineInfo aInfo( LINE_DASH );
800             //aInfo.SetDashLen( 2 );
801             //aInfo.SetDashCount( 1 );
802             aInfo.SetDistance( 1 );
803             aInfo.SetDotLen( 2 );
804             aInfo.SetDotCount( 1 );
805 
806             DrawPolyLine( aPoly, aInfo );
807         }
808         else
809             DrawRect( rPaintRect );
810 
811         SetFillColor( oldFillCol);
812         SetLineColor( oldLineCol);
813     }
814     else
815     {
816         Window::Paint( rPaintRect );
817     }
818 }
819