]> git.saurik.com Git - wxWidgets.git/blame - utils/framelayout/src/panedrawpl.h
don't crash when invalid colour is set as fg/bg colour
[wxWidgets.git] / utils / framelayout / src / panedrawpl.h
CommitLineData
bd9396d5
HH
1/////////////////////////////////////////////////////////////////////////////
2// Name: No names yet.
3// Purpose: Central header file for control-bar related classes
4//
5// Author: Aleksandras Gluchovas <mailto:alex@soften.ktu.lt>
6// Modified by:
7// Created: 06/09/98
8// RCS-ID: $Id$
9// Copyright: (c) Aleksandras Gluchovas
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef __PANEDRAWPL_G__
14#define __PANEDRAWPL_G__
15
16#ifdef __GNUG__
17#pragma interface "panedrawpl.h"
18#endif
19
20#include "controlbar.h"
21
22/*
23 * Simple, but all-in-one plugin implementation. Resembles look & feel of
24 * to MFC control-bars. Handles painting of pane and items in it.
25 * Fires bar/layout customization event, when user right-clicks bar/pane.
26 * Hooking an instance of this and row-layouting plugins per each pane,
27 * would be enough for the frame layout to function properly.
28 * (they are plugged in autimatically by wxFrameLayout class)
29 */
30
31class cbPaneDrawPlugin : public cbPluginBase
32{
33public:
34 DECLARE_DYNAMIC_CLASS( cbPaneDrawPlugin )
35protected:
36
37 // resizing bars/rows state variables
38 bool mResizeStarted;
39 bool mResizeCursorOn;
40 wxPoint mDragOrigin;
41
42 bool mRowHandleHitted;
43 bool mIsUpperHandle;
44 bool mBarHandleHitted;
45 bool mIsLeftHandle;
46 bool mBarContentHitted;
47
48 cbBarInfo* mpDraggedBar; // also used when in bar-drag action
49 cbRowInfo* mpResizedRow;
50
51 // contstraints for dragging the handle
52 wxRect mHandleDragArea;
53 bool mHandleIsVertical;
54 int mHandleOfs;
55 int mDraggedDelta;
56 wxPoint mPrevPos;
57
58 // used for handling, start-draw-in-area events
59 wxClientDC* mpClntDc;
60
61 cbDockPane* mpPane; // is set up temorary short-cut, while handling event
62
63protected:
64 // helpers
65 void DrawDraggedHandle( const wxPoint& pos, cbDockPane& pane );
66
67 virtual void DrawPaneShade( wxDC& dc, int alignment );
68 virtual void DrawPaneShadeForRow( cbRowInfo* pRow, wxDC& dc );
69
70 virtual void DrawUpperRowHandle( cbRowInfo* pRow, wxDC& dc );
71 virtual void DrawLowerRowHandle( cbRowInfo* pRow, wxDC& dc );
72
73 virtual void DrawUpperRowShades( cbRowInfo* pRow, wxDC& dc, int level );
74 virtual void DrawLowerRowShades( cbRowInfo* pRow, wxDC& dc, int level );
75
76 virtual void DrawBarInnerShadeRect( cbBarInfo* pBar, wxDC& dc );
77
78 virtual void DrawShade( int level, wxRect& rect, int alignment, wxDC& dc );
79 virtual void DrawShade1( int level, wxRect& rect, int alignment, wxDC& dc );
80
81 inline void SetLightPixel( int x, int y, wxDC& dc );
82 inline void SetDarkPixel ( int x, int y, wxDC& dc );
83
84public:
85 cbPaneDrawPlugin(void);
86
87 cbPaneDrawPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
88
89 virtual ~cbPaneDrawPlugin();
90
91 virtual cbPluginBase* Clone() { return new cbPaneDrawPlugin(0,0); }
92
93 // handlers for plugin-events
94
95 void OnLButtonDown( cbLeftDownEvent& event );
96 void OnLDblClick ( cbLeftDClickEvent& event );
97 void OnLButtonUp ( cbLeftUpEvent& event );
98 void OnRButtonUp ( cbRightUpEvent& event );
99 void OnMouseMove ( cbMotionEvent& event );
100
101 void OnDrawPaneBackground ( cbDrawPaneBkGroundEvent& event );
102 void OnDrawPaneDecorations( cbDrawPaneDecorEvent& event );
103
104 void OnDrawRowDecorations ( cbDrawRowDecorEvent& event );
105 void OnDrawRowHandles ( cbDrawRowHandlesEvent& event );
106 void OnDrawRowBackground ( cbDrawRowBkGroundEvent& event );
107
108 void OnSizeBarWindow ( cbSizeBarWndEvent& event );
109 void OnDrawBarDecorations ( cbDrawBarDecorEvent& event );
110 void OnDrawBarHandles ( cbDrawBarHandlesEvent& event );
111
112 void OnStartDrawInArea ( cbStartDrawInAreaEvent& event );
113 void OnFinishDrawInArea ( cbFinishDrawInAreaEvent& event );
114
115 DECLARE_EVENT_TABLE()
116};
117
118#endif