// Created: 06/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __CONTROLBAR_G__
wxFrameLayout( wxWindow* pParentFrame,
wxWindow* pFrameClient = NULL,
- bool activateNow = TRUE );
+ bool activateNow = true );
// Destructor. It does not destroy the bar windows.
// Enables floating behaviour. By default floating of control bars is on.
- virtual void EnableFloating( bool enable = TRUE );
+ virtual void EnableFloating( bool enable = true );
// Activate can be called after some other layout has been deactivated,
// and this one must take over the current contents of the frame window.
// name is a name by which the bar can be referred in layout customization dialogs.
- // If spyEvents is TRUE, input events for the bar should be "spyed" in order
+ // If spyEvents is true, input events for the bar should be "spyed" in order
// to forward unhandled mouse clicks to the frame layout, for example to enable
// easy draggablity of toolbars just by clicking on their interior regions.
- // For widgets like text/tree control this value should be FALSE,
+ // For widgets like text/tree control this value should be false,
// since there's no certain way to detect whether the event was actually handled.
// state is the initial state, such as wxCBAR_DOCKED_HORIZONTALLY,
int rowNo = 0,
int columnPos = 0,
const wxString& name = wxT("bar"),
- bool spyEvents = FALSE,
+ bool spyEvents = false,
int state = wxCBAR_DOCKED_HORIZONTALLY
);
// To dock a bar which is floating, use the wxFrameLayout::DockBar method.
virtual bool RedockBar( cbBarInfo* pBar, const wxRect& shapeInParent,
- cbDockPane* pToPane = NULL, bool updateNow = TRUE );
+ cbDockPane* pToPane = NULL, bool updateNow = true );
// Finds the bar in the framelayout, by name.
// Recalculates the layout of panes, and all bars/rows in each pane.
- virtual void RecalcLayout( bool repositionBarsNow = FALSE );
+ virtual void RecalcLayout( bool repositionBarsNow = false );
// Returns the client height.
// Recalculates layout and performs on-screen update of all panes.
- void RefreshNow( bool recalcLayout = TRUE );
+ void RefreshNow( bool recalcLayout = true );
// Event handler for a size event.
cbDockPane** ppPane );
- // Returns TRUE if the position is within the given pane.
+ // Returns true if the position is within the given pane.
bool HitTestPane( cbDockPane* pPane, int x, int y );
void HookUpToFrame();
- // Returns TRUE if the platform allows reparenting. This may not return TRUE
+ // Returns true if the platform allows reparenting. This may not return true
// for all platforms. Reparenting allows control bars to be floated.
bool CanReparent();
wxObject* mpCustomData; // any custom data stored by specific updates mgr.
- // Default constructor. Is-dirty flag is set TRUE initially.
+ // Default constructor. Is-dirty flag is set true initially.
cbUpdateMgrData();
// Set the dirty flag.
- void SetDirty( bool isDirty = TRUE );
+ void SetDirty( bool isDirty = true );
// Set custom data.
int mHorizGap; // NOTE:: gaps are given in frame's coord. orientation
- // TRUE, if vertical/horizontal dimensions cannot be mannualy adjusted
- // by user using resizing handles. If FALSE, the frame-layout
+ // true, if vertical/horizontal dimensions cannot be mannualy adjusted
+ // by user using resizing handles. If false, the frame-layout
// *automatically* places resizing handles among not-fixed bars
bool mIsFixed;
cbDimInfo(void);
// Constructor.
- // isFixed is TRUE if vertical/horizontal dimensions cannot be manually adjusted
- // by the user using resizing handles. If FALSE, the frame-layout
+ // isFixed is true if vertical/horizontal dimensions cannot be manually adjusted
+ // by the user using resizing handles. If false, the frame-layout
// automatically places resizing handles among bars that do are not fixed.
cbDimInfo( cbBarDimHandlerBase* pDimHandler,
int dv_x, int dv_y,
int f_x, int f_y,
- bool isFixed = TRUE,
+ bool isFixed = true,
int horizGap = 6,
int vertGap = 6,
// Constructor.
cbDimInfo( int x, int y,
- bool isFixed = TRUE,
+ bool isFixed = true,
int gap = 6,
cbBarDimHandlerBase* pDimHandler = NULL
);
~cbBarInfo();
- // Returns TRUE if this bar is fixed.
+ // Returns true if this bar is fixed.
inline bool IsFixed() const { return mDimInfo.mIsFixed; }
- // Returns TRUE if this bar is expanded.
+ // Returns true if this bar is expanded.
inline bool IsExpanded() const { return this == mpRow->mpExpandedBar; }
};
void Reset();
- // Advances the iterator and returns TRUE if a bar is available.
+ // Advances the iterator and returns true if a bar is available.
bool Next();
void SyncRowFlags( cbRowInfo* pRow );
- // Returns TRUE if the bar's dimension information indicates a fixed size.
+ // Returns true if the bar's dimension information indicates a fixed size.
// Internal function called by plugins.
bool IsFixedSize( cbBarInfo* pInfo );
int GetRowY( cbRowInfo* pRow );
- // Returns TRUE if there are any variable-sized rows above this one.
+ // Returns true if there are any variable-sized rows above this one.
// Internal function called by plugins.
bool HasNotFixedRowsAbove( cbRowInfo* pRow );
- // Returns TRUE if there are any variable-sized rows below this one.
+ // Returns true if there are any variable-sized rows below this one.
// Internal function called by plugins.
bool HasNotFixedRowsBelow( cbRowInfo* pRow );
- // Returns TRUE if there are any variable-sized rows to the left of this one.
+ // Returns true if there are any variable-sized rows to the left of this one.
// Internal function called by plugins.
bool HasNotFixedBarsLeft ( cbBarInfo* pBar );
- // Returns TRUE if there are any variable-sized rows to the right of this one.
+ // Returns true if there are any variable-sized rows to the right of this one.
// Internal function called by plugins.
bool HasNotFixedBarsRight( cbBarInfo* pBar );
void PaneToFrame( wxRect* pRect );
- // Returns TRUE if pos is within the given rectangle.
+ // Returns true if pos is within the given rectangle.
// Internal function called by plugins.
inline bool HasPoint( const wxPoint& pos, int x, int y, int width, int height );
{ return mRows.GetCount() ? mRows[0] : NULL; }
- // Returns TRUE if the given bar is present in this pane.
+ // Returns true if the given bar is present in this pane.
bool BarPresent( cbBarInfo* pBar );
int GetAlignment();
- // Returns TRUE if the given mask matches the pane's mask.
+ // Returns true if the given mask matches the pane's mask.
bool MatchesMask( int paneMask );
- // Returns TRUE if the pane is aligned to the top or bottom.
+ // Returns true if the pane is aligned to the top or bottom.
inline bool IsHorizontal()
{
// Macros for creating event table entries for plugin-events.
-#define EVT_PL_LEFT_DOWN(func) wxEventTableEntry( cbEVT_PL_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDownHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_LEFT_UP(func) wxEventTableEntry( cbEVT_PL_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftUpHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_RIGHT_DOWN(func) wxEventTableEntry( cbEVT_PL_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightDownHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_RIGHT_UP(func) wxEventTableEntry( cbEVT_PL_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightUpHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_MOTION(func) wxEventTableEntry( cbEVT_PL_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbMotionHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_LEFT_DCLICK(func) wxEventTableEntry( cbEVT_PL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDClickHandler ) & func, (wxObject *) NULL ),
-
-#define EVT_PL_LAYOUT_ROW(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_RESIZE_ROW(func) wxEventTableEntry( cbEVT_PL_RESIZE_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeRowHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_LAYOUT_ROWS(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROWS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowsHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_INSERT_BAR(func) wxEventTableEntry( cbEVT_PL_INSERT_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbInsertBarHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_RESIZE_BAR(func) wxEventTableEntry( cbEVT_PL_RESIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeBarHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_REMOVE_BAR(func) wxEventTableEntry( cbEVT_PL_REMOVE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRemoveBarHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_SIZE_BAR_WND(func) wxEventTableEntry( cbEVT_PL_SIZE_BAR_WND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbSizeBarWndHandler ) & func, (wxObject *) NULL ),
-
-#define EVT_PL_DRAW_BAR_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarDecorHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_DRAW_ROW_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowDecorHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_DRAW_PANE_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneDecorHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_DRAW_BAR_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarHandlesHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_DRAW_ROW_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowHandlesHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_DRAW_ROW_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowBkGroundHandler ) & func, (wxObject *) NULL ),
-#define EVT_PL_DRAW_PANE_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneBkGroundHandler) & func, (wxObject *) NULL ),
-
-#define EVT_PL_START_BAR_DRAGGING(func) wxEventTableEntry( cbEVT_PL_START_BAR_DRAGGING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartBarDraggingHandler) & func, (wxObject *) NULL ),
-#define EVT_PL_DRAW_HINT_RECT(func) wxEventTableEntry( cbEVT_PL_DRAW_HINT_RECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawHintRectHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_LEFT_DOWN(func) wxEventTableEntry( cbEVT_PL_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDownHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_LEFT_UP(func) wxEventTableEntry( cbEVT_PL_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftUpHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_RIGHT_DOWN(func) wxEventTableEntry( cbEVT_PL_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightDownHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_RIGHT_UP(func) wxEventTableEntry( cbEVT_PL_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightUpHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_MOTION(func) wxEventTableEntry( cbEVT_PL_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbMotionHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_LEFT_DCLICK(func) wxEventTableEntry( cbEVT_PL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDClickHandler ) & func, (wxObject *) NULL ),
+
+#define EVT_PL_LAYOUT_ROW(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_RESIZE_ROW(func) wxEventTableEntry( cbEVT_PL_RESIZE_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeRowHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_LAYOUT_ROWS(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROWS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowsHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_INSERT_BAR(func) wxEventTableEntry( cbEVT_PL_INSERT_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbInsertBarHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_RESIZE_BAR(func) wxEventTableEntry( cbEVT_PL_RESIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeBarHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_REMOVE_BAR(func) wxEventTableEntry( cbEVT_PL_REMOVE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRemoveBarHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_SIZE_BAR_WND(func) wxEventTableEntry( cbEVT_PL_SIZE_BAR_WND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbSizeBarWndHandler ) & func, (wxObject *) NULL ),
+
+#define EVT_PL_DRAW_BAR_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarDecorHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_DRAW_ROW_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowDecorHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_DRAW_PANE_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneDecorHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_DRAW_BAR_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarHandlesHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_DRAW_ROW_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowHandlesHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_DRAW_ROW_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowBkGroundHandler ) & func, (wxObject *) NULL ),
+#define EVT_PL_DRAW_PANE_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneBkGroundHandler) & func, (wxObject *) NULL ),
+
+#define EVT_PL_START_BAR_DRAGGING(func) wxEventTableEntry( cbEVT_PL_START_BAR_DRAGGING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartBarDraggingHandler) & func, (wxObject *) NULL ),
+#define EVT_PL_DRAW_HINT_RECT(func) wxEventTableEntry( cbEVT_PL_DRAW_HINT_RECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawHintRectHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_START_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_START_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartDrawInAreaHandler) & func, (wxObject *) NULL ),
int mPaneMask;
- // Is TRUE when plugin is ready to handle events.
+ // Is true when plugin is ready to handle events.
bool mIsReady;
: mpLayout ( 0 ),
mPaneMask( wxALL_PANES ),
- mIsReady ( FALSE )
+ mIsReady ( false )
{}
// Constructor taking layout panel and a mask.
: mpLayout ( pPanel ),
mPaneMask( paneMask ),
- mIsReady ( FALSE )
+ mIsReady ( false )
{}
// Returns the pane mask.
// At this point plugin is already attached to the frame layout,
// and pane masks are set.
- virtual void OnInitPlugin() { mIsReady = TRUE; }
+ virtual void OnInitPlugin() { mIsReady = true; }
- // Returns TRUE if the plugin is ready to receive events.
+ // Returns true if the plugin is ready to receive events.
bool IsReady() { return mIsReady; }
virtual void AddTool( int toolIndex,
const wxString& imageFileName,
wxBitmapType imageFileType = wxBITMAP_TYPE_BMP,
- const wxString& labelText = wxT(""), bool alignTextRight = FALSE,
- bool isFlat = TRUE );
+ const wxString& labelText = wxT(""), bool alignTextRight = false,
+ bool isFlat = true );
// Adds a tool. See the documentation for wxToolBar for details.
virtual void AddTool( int toolIndex, wxBitmap labelBmp,
- const wxString& labelText = wxT(""), bool alignTextRight = FALSE,
- bool isFlat = TRUE );
+ const wxString& labelText = wxT(""), bool alignTextRight = false,
+ bool isFlat = true );
// Unhide method from parent.
// See the documentation for wxToolBar for details.
virtual wxToolBarToolBase *AddTool(const int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap,
- const bool toggle = FALSE, const long xPos = -1, const long yPos = -1, wxObject *clientData = NULL,
+ const bool toggle = false, const long xPos = wxDefaultPosition.x, const long yPos = wxDefaultPosition.y, wxObject *clientData = NULL,
const wxString& helpString1 = wxT(""), const wxString& helpString2 = wxT(""));
// Adds a separator. See the documentation for wxToolBar for details.
// Enables or disables the given tool.
- virtual void EnableTool(int toolIndex, bool enable = TRUE);
+ virtual void EnableTool(int toolIndex, bool enable = true);
// Responds to size events, calling Layout.
void CreateLayout();
wxFrameLayout* GetLayout();
void SetLayout( wxFrameLayout* pLayout );
- void SetToolUpdates( bool doToolUpdates = TRUE );
+ void SetToolUpdates( bool doToolUpdates = true );
// hooks for specific frame-views
int mInClientHintBorder; // default: 4 pixels
- bool mAccelerationOn; // TRUE, if morph accelerates, otherwise morph
- // speed is constant. Default: TRUE
+ bool mAccelerationOn; // true, if morph accelerates, otherwise morph
+ // speed is constant. Default: true
// TBD:: get/set methods for above members
// labels for particular state
wxBitmap mFocusedBmp; // may not be always present -
- // only if mHasFocusedBmp is TRUE
+ // only if mHasFocusedBmp is true
wxBitmap* mpDepressedImg;
wxBitmap* mpPressedImg;
wxPen& upperLeftSidePen,
wxPen& lowerRightSidePen );
- // Returns TRUE if the given point is in the window.
+ // Returns true if the given point is in the window.
bool IsInWindow( int x, int y );
virtual void OnIdle(wxIdleEvent& event);
wxNewBitmapButton( const wxBitmap& labelBitmap = wxNullBitmap,
const wxString& labelText = wxT(""),
int alignText = NB_ALIGN_TEXT_BOTTOM,
- bool isFlat = TRUE,
+ bool isFlat = true,
// this is the default type of fired events
int firedEventType = wxEVT_COMMAND_MENU_SELECTED,
int marginX = NB_DEFAULT_MARGIN,
int marginY = NB_DEFAULT_MARGIN,
int textToLabelGap = 2,
- bool isSticky = FALSE
+ bool isSticky = false
);
// Use this constructor if buttons have to be persistant
const wxBitmapType bitmapFileType = wxBITMAP_TYPE_BMP,
const wxString& labelText = wxT(""),
int alignText = NB_ALIGN_TEXT_BOTTOM,
- bool isFlat = TRUE,
+ bool isFlat = true,
// this is the default type of fired events
int firedEventType = wxEVT_COMMAND_MENU_SELECTED,
int marginX = NB_DEFAULT_MARGIN,
int marginY = NB_DEFAULT_MARGIN,
int textToLabelGap = 2,
- bool isSticky = FALSE
+ bool isSticky = false
);
// Destructor.
// Renders the label image.
virtual void RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
- bool isEnabled = TRUE,
- bool isPressed = FALSE);
+ bool isEnabled = true,
+ bool isPressed = false);
// Renders label images.
virtual void RenderLabelImages();
// Created: 02/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __ROWLAYOUTPL_G__
// Set the position of the button.
void SetPos( const wxPoint& pos );
- // Returns TRUE if the given position was over the button.
+ // Returns true if the given position was over the button.
bool HitTest( const wxPoint& pos );
// Responds to a left down event.
// the desired appearance.
virtual void Draw( wxDC& dc );
- // Returns TRUE if the button was clicked.
+ // Returns true if the button was clicked.
bool WasClicked();
// Reset the button.
// Enable or disable the button.
void Enable( bool enable ) { mEnabled = enable; }
- // Returns TRUE if this button is pressed.
+ // Returns true if this button is pressed.
bool IsPressed() { return mPressed; }
};
// Created: 19/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __UPDATESMGR_G__
char wxDummyChar;
-IMPLEMENT_APP (MyApp)
+IMPLEMENT_APP (MyApp)
bool MyApp::OnInit(void)
{
frame->CreateStatusBar(3);
- frame->Show(TRUE);
+ frame->Show(true);
frame->mpClientWnd->Refresh();
(cbRowDragPlugin & cbBarHintsPlugin)\n\n\
BTW, disabled images and label-text are rendered at run-time") );
- return TRUE;
+ return true;
}
/***** Implementation for class MyFrame *****/
END_EVENT_TABLE()
void MyFrame::OnLoad( wxCommandEvent& WXUNUSED(event) )
-{
+{
wxMessageBox(_T("Hey - you found a BIG question-mark !!"));
}
{
wxTextCtrl* pCtrl =
- new wxTextCtrl( this, -1, value,
+ new wxTextCtrl( this, wxID_ANY, value,
wxDefaultPosition, wxSize(0,0), wxTE_MULTILINE );
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
}
MyFrame::MyFrame(wxFrame *frame)
- : wxFrame( frame, -1, _("wxWidgets 2.0 wxFrameLayout Test Application"), wxDefaultPosition,
+ : wxFrame( frame, wxID_ANY, _("wxWidgets 2.0 wxFrameLayout Test Application"), wxDefaultPosition,
wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
cbCommonPaneProperties props;
mpLayout->GetPaneProperties( props );
- props.mRealTimeUpdatesOn = FALSE; // real-time OFF!!!
+ props.mRealTimeUpdatesOn = false; // real-time OFF!!!
mpLayout->SetPaneProperties( props, wxALL_PANES );
#endif
cbDimInfo sizes0( 200,45, // when docked horizontally
200,85, // when docked vertically
175,35, // when floated
- FALSE, // the bar is not fixed-size
+ false, // the bar is not fixed-size
4, // vertical gap (bar border)
4 // horizontal gap (bar border)
);
cbDimInfo sizes1( 150,35, // when docked horizontally
150,85, // when docked vertically
175,35, // when floated
- TRUE, // the bar is not fixed-size
+ true, // the bar is not fixed-size
4, // vertical gap (bar border)
4 // horizontal gap (bar border)
);
cbDimInfo sizes2( 195,35, // when docked horizontally
185,37, // when docked vertically
195,35, // when floated
- TRUE, // the bar is not fixed-size
+ true, // the bar is not fixed-size
4, // vertical gap (bar border)
4, // horizontal gap (bar border)
new cbDynToolBarDimHandler()
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
_("InfoViewer1"), // name to refer in customization pop-ups
- TRUE
+ true
);
mpLayout->AddBar( CreateTextCtrl(_("Bye")), // bar window
1, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
_("InfoViewer2"), // name to refer in customization pop-ups
- TRUE
+ true
);
mpLayout->AddBar( CreateTextCtrl(_("Fixed0")), // bar window
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
_("ToolBar1"), // name to refer in customization pop-ups
- TRUE
+ true
);
wxDynamicToolBar* pToolBar = new wxDynamicToolBar();
- pToolBar->Create( this, -1 );
+ pToolBar->Create( this, wxID_ANY );
// 1001-1006 ids of command events fired by added tool-buttons
pToolBar->AddSeparator();
pToolBar->AddTool( 1002, wxString(wxT(BMP_DIR)) + wxT("open.bmp") );
pToolBar->AddTool( 1003, wxString(wxT(BMP_DIR)) + wxT("save.bmp") );
- pToolBar->AddSeparator(new wxMySeparatorLine(pToolBar, -1));
+ pToolBar->AddSeparator(new wxMySeparatorLine(pToolBar, wxID_ANY));
pToolBar->AddTool( 1004, wxString(wxT(BMP_DIR)) + wxT("cut.bmp") );
pToolBar->AddTool( 1005, wxString(wxT(BMP_DIR)) + wxT("copy.bmp") );
pToolBar->AddTool( 1006, wxString(wxT(BMP_DIR)) + wxT("paste.bmp") );
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
wxT("ToolBar2"), // name to refer in customization pop-ups
- FALSE
+ false
);
- mpLayout->EnableFloating( TRUE ); // off, thinking about wxGtk...
+ mpLayout->EnableFloating( true ); // off, thinking about wxGtk...
}
MyFrame::~MyFrame()
MyFrame(wxFrame *frame);
virtual ~MyFrame();
- bool OnClose(void) { Show(FALSE); return TRUE; }
+ bool OnClose(void) { Show(false); return true; }
void OnLoad( wxCommandEvent& event );
void OnSave( wxCommandEvent& event );
// Create all layouts
for( i = 0; i != MAX_LAYOUTS; ++i )
- {
+ {
CreateLayout( i );
}
// hide others
pClassView->AppendItem( rootId, _("serializer-classes (grabbed at run-time)"), 0 );
// now create "output" window
- wxNotebook* pTabbedArea = new wxNotebook(pParent, wxID_ANY);
+ wxNotebook* pTabbedArea = new wxNotebook(pParent, wxID_ANY);
// SEB: originally here was a wxpp (wxWorkshop) class used
// wxPaggedWindow* pTabbedArea = new wxPaggedWindow();
// pTabbedArea->Create( pParent, wxID_ANY );
// Created: 04/11/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows license
+// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __FLDEMO_G__
// ID for the menu commands
-#define MINIMAL_QUIT 1
+#define MINIMAL_QUIT 1
#define MINIMAL_ABOUT 102
#define ID_LOAD 103
#define ID_REMOVEALL 108
#define ID_RECREATE 109
#define ID_ACTIVATE 110
-#define ID_FIRST 111
+#define ID_FIRST 111
#define ID_SECOND 112
#define ID_THIRD 113
wxBitmap m_DBmp;
public:
- StartButton95(void) : m_bPressed(FALSE) {}
+ StartButton95(void) : m_bPressed(false) {}
StartButton95(wxWindow* parent)
- : m_bPressed(FALSE) { wxPanel::Create(parent,-1); }
+ : m_bPressed(false) { wxPanel::Create(parent,wxID_ANY); }
void OnMouseDown( wxMouseEvent& event );
void OnMouseUp( wxMouseEvent& event );
void OnStore( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
- bool OnClose(void) { return TRUE; }
+ bool OnClose(void) { return true; }
DECLARE_EVENT_TABLE()
};
frame->CreateStatusBar(3);
frame->SetMenuBar(menu_bar);
- frame->Show(TRUE);
+ frame->Show(true);
SetTopWindow(frame);
- return TRUE;
+ return true;
}
/***** Immlementation for class MyFrame *****/
END_EVENT_TABLE()
MyFrame::MyFrame( wxWindow* parent, const wxChar *title )
- : wxFrame( parent, -1, title, wxDefaultPosition,
+ : wxFrame( parent, wxID_ANY, title, wxDefaultPosition,
wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
cbCommonPaneProperties props;
mpLayout->GetPaneProperties( props );
- props.mRealTimeUpdatesOn = FALSE; // off
+ props.mRealTimeUpdatesOn = false; // off
mpLayout->SetPaneProperties( props, wxALL_PANES );
#endif
cbDimInfo sizes( 80,65, // when docked horizontally
80,65, // when docked vertically
80,30, // when floated
- TRUE, // the bar is fixed-size
+ true, // the bar is fixed-size
5, // vertical gap (bar border)
5 // horizontal gap (bar border)
);
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
{
- wxTextCtrl* pCtrl = new wxTextCtrl( mpInternalFrm, -1, value,
+ wxTextCtrl* pCtrl = new wxTextCtrl( mpInternalFrm, wxID_ANY, value,
wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE );
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
{
- Show( FALSE ); // TRICK:: hide it, to avoid flickered destruction
+ Show( false ); // TRICK:: hide it, to avoid flickered destruction
- Close(TRUE);
+ Close(true);
}
void OnStore( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
- bool OnClose(void) { return TRUE; }
+ bool OnClose(void) { return true; }
DECLARE_EVENT_TABLE()
};
frame->CreateStatusBar(3);
frame->SetMenuBar(menu_bar);
- frame->Show(TRUE);
+ frame->Show(true);
SetTopWindow(frame);
frame->populateMyFrame();
- return TRUE;
+ return true;
}
/***** Immlementation for class MyFrame *****/
END_EVENT_TABLE()
MyFrame::MyFrame( wxWindow* parent, const wxChar *title )
- : wxFrame( parent, -1, title, wxDefaultPosition,
+ : wxFrame( parent, wxID_ANY, title, wxDefaultPosition,
wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
cbDimInfo sizes( 80,65, // when docked horizontally
80,165, // when docked vertically
180,30, // when floated
- TRUE, // the bar is fixed-size
+ true, // the bar is fixed-size
5, // vertical gap (bar border)
5 // horizontal gap (bar border)
);
if ( !sizes.mIsFixed ) name += wxT(" (flexible)");
// mpLayout->AddBar( CreateTextCtrl(name),// bar window
- mpLayout->AddBar( new wxTextCtrl(this, -1, name),// bar window
+ mpLayout->AddBar( new wxTextCtrl(this, wxID_ANY, name),// bar window
sizes, i % MAX_PANES,// alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
{
- wxTextCtrl* pCtrl = new wxTextCtrl( this, -1, value,
+ wxTextCtrl* pCtrl = new wxTextCtrl( this, wxID_ANY, value,
wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE );
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
{
- Show( FALSE ); // TRICK:: hide it, to avoid flickered destruction
+ Show( false ); // TRICK:: hide it, to avoid flickered destruction
- Close(TRUE);
+ Close(true);
}
void OnButt( wxCommandEvent& event );
void OnButt2( wxCommandEvent& event );
- bool OnClose(void) { return TRUE; }
+ bool OnClose(void) { return true; }
DECLARE_EVENT_TABLE()
};
frame->CreateStatusBar(3);
frame->SetMenuBar(menu_bar);
- frame->Show(TRUE);
+ frame->Show(true);
SetTopWindow(frame);
- return TRUE;
+ return true;
}
/***** Immlementation for class MyFrame *****/
END_EVENT_TABLE()
MyFrame::MyFrame( wxWindow* parent, const wxChar *title )
- : wxFrame( parent, -1, title, wxDefaultPosition,
+ : wxFrame( parent, wxID_ANY, title, wxDefaultPosition,
wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
wxT("freimas") )
{
- mpClientWnd = new wxWindow(this, -1);
+ mpClientWnd = new wxWindow(this, wxID_ANY);
mpLayout = new wxFrameLayout( this, mpClientWnd );
/// mpLayout->PushDefaultPlugins();
cbDimInfo sizes( 80,65, // when docked horizontally
80,165, // when docked vertically
180,30, // when floated
- TRUE, // the bar is fixed-size
+ true, // the bar is fixed-size
5, // vertical gap (bar border)
5 // horizontal gap (bar border)
);
if ( !sizes.mIsFixed ) name += wxT(" (flexible)");
// mpLayout->AddBar( CreateTextCtrl(name),// bar window
if(i != 4 && i!= 5 && i!=11) {
- mpLayout->AddBar( new wxTextCtrl(this, -1, name),// bar window
+ mpLayout->AddBar( new wxTextCtrl(this, wxID_ANY, name),// bar window
sizes,
i % MAX_PANES,// alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
name // name to refere in customization pop-ups
);
} else if(i==4){
- mpLayout->AddBar( new wxTextCtrl(this, -1, name),// bar window
- cbDimInfo( 100,100, 100,100, 100,100, TRUE, 5, 5),
+ mpLayout->AddBar( new wxTextCtrl(this, wxID_ANY, name),// bar window
+ cbDimInfo( 100,100, 100,100, 100,100, true, 5, 5),
i % MAX_PANES,// alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
} else if(i==5) {
my_butt = new wxButton(this, ID_BUTT, name);
mpLayout->AddBar( my_butt,// bar window
- cbDimInfo( 100,100, 200,200, 400,400, TRUE, 5, 5),
+ cbDimInfo( 100,100, 200,200, 400,400, true, 5, 5),
i % MAX_PANES,// alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
);
} else if(i==11) {
mpLayout->AddBar( new wxButton(this, ID_BUTT2, name+wxT("_2")),
- cbDimInfo( 100,100, 200,200, 400,400, TRUE, 5, 5),
+ cbDimInfo( 100,100, 200,200, 400,400, true, 5, 5),
i % MAX_PANES,// alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
{
- wxTextCtrl* pCtrl = new wxTextCtrl( this, -1, value,
+ wxTextCtrl* pCtrl = new wxTextCtrl( this, wxID_ANY, value,
wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE );
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
{
- Show( FALSE ); // TRICK:: hide it, to avoid flickered destruction
+ Show( false ); // TRICK:: hide it, to avoid flickered destruction
- Close(TRUE);
+ Close(true);
}
void MyFrame::OnButt( wxCommandEvent& WXUNUSED(event) )
{
if(i % 4 == 1)
{
- mpLayout->SetBarState(x, wxCBAR_FLOATING, TRUE);
+ mpLayout->SetBarState(x, wxCBAR_FLOATING, true);
//mpLayout->RecalcLayout(true);
mpLayout->RepositionFloatedBar(x);
}
else
{
- mpLayout->SetBarState(x, 0, TRUE);
+ mpLayout->SetBarState(x, 0, true);
//mpLayout->RecalcLayout(true);
//mpLayout->RepositionFloatedBar(x);
}
- // // // x->mState = wxCBAR_FLOATING;
- // // // mpLayout->ApplyBarProperties(x);
+ // // // x->mState = wxCBAR_FLOATING;
+ // // // mpLayout->ApplyBarProperties(x);
}
else
{
x->mDimInfo.mSizes[a].y = 200;
}
x->mpBarWnd->SetSize(200,200);
- mpLayout->SetBarState(x, wxCBAR_FLOATING, TRUE); // HACK !!!
- mpLayout->SetBarState(x, 0, TRUE); // HACK !!!
+ mpLayout->SetBarState(x, wxCBAR_FLOATING, true); // HACK !!!
+ mpLayout->SetBarState(x, 0, true); // HACK !!!
wxYield(); // HACK !!! needed to resize BEFORE redraw
- mpLayout->RefreshNow( TRUE ); // HACK !!! needed to trigger redraw
+ mpLayout->RefreshNow( true ); // HACK !!! needed to trigger redraw
}
else
{
x->mDimInfo.mSizes[a].y = 10 + 2 + 2*x->mDimInfo.mVertGap;
}
x->mpBarWnd->SetSize(10,10);
- mpLayout->SetBarState(x, wxCBAR_FLOATING, TRUE); // HACK !!!
- mpLayout->SetBarState(x, 0, TRUE); // HACK !!!
+ mpLayout->SetBarState(x, wxCBAR_FLOATING, true); // HACK !!!
+ mpLayout->SetBarState(x, 0, true); // HACK !!!
wxYield(); // HACK !!! needed to resize BEFORE redraw
- mpLayout->RefreshNow( TRUE ); // HACK !!! needed to trigger redraw
+ mpLayout->RefreshNow( true ); // HACK !!! needed to trigger redraw
- // // mpLayout->SetBarState(x, wxCBAR_FLOATING, TRUE);
- // // mpLayout->RecalcLayout(true);
- // // // mpLayout->RepositionFloatedBar(x);
- // // mpLayout->RecalcLayout(true);
- // // mpLayout->RepositionFloatedBar(x);
- // // mpLayout->SetBarState(x, 0, TRUE);
- // // wxYield();
- // // mpLayout->RefreshNow( TRUE );
- // // mpLayout->RecalcLayout(true);
+ // // mpLayout->SetBarState(x, wxCBAR_FLOATING, true);
+ // // mpLayout->RecalcLayout(true);
+ // // mpLayout->RepositionFloatedBar(x);
+ // // mpLayout->RecalcLayout(true);
+ // // mpLayout->RepositionFloatedBar(x);
+ // // mpLayout->SetBarState(x, 0, true);
+ // // wxYield();
+ // // mpLayout->RefreshNow( true );
+ // // mpLayout->RecalcLayout(true);
}
else
{
// Created: 23/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
BEGIN_EVENT_TABLE( cbAntiflickerPlugin, cbPluginBase )
- EVT_PL_START_DRAW_IN_AREA ( cbAntiflickerPlugin::OnStartDrawInArea )
- EVT_PL_FINISH_DRAW_IN_AREA ( cbAntiflickerPlugin::OnFinishDrawInArea )
+ EVT_PL_START_DRAW_IN_AREA ( cbAntiflickerPlugin::OnStartDrawInArea )
+ EVT_PL_FINISH_DRAW_IN_AREA ( cbAntiflickerPlugin::OnFinishDrawInArea )
END_EVENT_TABLE()
// constructors
cbAntiflickerPlugin::cbAntiflickerPlugin(void)
- : mpLRUBufDc ( NULL ),
- mLRUArea ( -1,-1, -1,-1 )
+ : mpLRUBufDc ( NULL ),
+ mLRUArea ( -1,-1, -1,-1 )
{
- ++mRefCount;
+ ++mRefCount;
}
cbAntiflickerPlugin::cbAntiflickerPlugin( wxFrameLayout* pPanel, int paneMask )
- : cbPluginBase( pPanel, paneMask ),
- mpLRUBufDc ( NULL ),
- mLRUArea ( -1,-1, -1,-1 )
+ : cbPluginBase( pPanel, paneMask ),
+ mpLRUBufDc ( NULL ),
+ mLRUArea ( -1,-1, -1,-1 )
{
- ++mRefCount;
+ ++mRefCount;
}
cbAntiflickerPlugin::~cbAntiflickerPlugin()
{
- if ( --mRefCount == 0 )
- {
- if ( mpHorizBuf )
- {
- mpHorizBufDc->SelectObject( wxNullBitmap );
- delete mpHorizBuf;
- delete mpHorizBufDc;
- mpHorizBuf = 0;
- mpHorizBufDc = 0;
- }
-
- if ( mpVertBuf )
- {
- mpVertBufDc->SelectObject( wxNullBitmap );
- delete mpVertBuf;
- delete mpVertBufDc;
- mpVertBuf = 0;
- mpVertBufDc = 0;
- }
- }
+ if ( --mRefCount == 0 )
+ {
+ if ( mpHorizBuf )
+ {
+ mpHorizBufDc->SelectObject( wxNullBitmap );
+ delete mpHorizBuf;
+ delete mpHorizBufDc;
+ mpHorizBuf = 0;
+ mpHorizBufDc = 0;
+ }
+
+ if ( mpVertBuf )
+ {
+ mpVertBufDc->SelectObject( wxNullBitmap );
+ delete mpVertBuf;
+ delete mpVertBufDc;
+ mpVertBuf = 0;
+ mpVertBufDc = 0;
+ }
+ }
}
wxDC* cbAntiflickerPlugin::FindSuitableBuffer( const wxRect& forArea )
{
- if ( mpVertBuf )
- {
- if ( mpVertBuf->GetHeight() >= forArea.height &&
- mpVertBuf->GetWidth() >= forArea.width )
-
- return mpVertBufDc;
- }
- else
- if ( mpHorizBuf )
- {
- if ( mpHorizBuf->GetHeight() >= forArea.height &&
- mpHorizBuf->GetWidth() >= forArea.width )
-
- return mpHorizBufDc;
- }
-
- return 0;
+ if ( mpVertBuf )
+ {
+ if ( mpVertBuf->GetHeight() >= forArea.height &&
+ mpVertBuf->GetWidth() >= forArea.width )
+ return mpVertBufDc;
+ }
+ else
+ if ( mpHorizBuf )
+ {
+ if ( mpHorizBuf->GetHeight() >= forArea.height &&
+ mpHorizBuf->GetWidth() >= forArea.width )
+ return mpHorizBufDc;
+ }
+
+ return 0;
}
wxDC* cbAntiflickerPlugin::AllocNewBuffer( const wxRect& forArea )
{
- // TBD:: preallocate bit larger bitmap at once, to avoid
- // excessive realocations later
-
- // check whether the given area is oriented horizontally
- // or vertically and choose corresponding bitmap to create or
- // recreate
-
- if ( forArea.height > forArea.width )
- {
- wxSize prevDim( 0,0 );
-
- if ( mpVertBuf )
- {
- prevDim.x = mpVertBuf->GetWidth();
- prevDim.y = mpVertBuf->GetHeight();
-
- mpVertBufDc->SelectObject( wxNullBitmap );
- delete mpVertBuf;
- }
- else
- mpVertBufDc = new wxMemoryDC();
-
- mpVertBuf = new wxBitmap( int( wxMax(forArea.width, prevDim.x ) ),
- int( wxMax(forArea.height, prevDim.y ) )
- );
-
- mpVertBufDc->SelectObject( *mpVertBuf );
-
- return mpVertBufDc;
- }
- else
- {
- wxSize prevDim( 0,0 );
-
- if ( mpHorizBuf )
- {
- prevDim.x = mpHorizBuf->GetWidth();
- prevDim.y = mpHorizBuf->GetHeight();
-
- mpHorizBufDc->SelectObject( wxNullBitmap );
- delete mpHorizBuf;
- }
- else
- mpHorizBufDc = new wxMemoryDC();
-
- mpHorizBuf = new wxBitmap( int( wxMax(forArea.width, prevDim.x ) ),
- int( wxMax(forArea.height, prevDim.y ) )
- );
-
- mpHorizBufDc->SelectObject( *mpHorizBuf );
-
- return mpHorizBufDc;
- }
+ // TBD:: preallocate bit larger bitmap at once, to avoid
+ // excessive realocations later
+
+ // check whether the given area is oriented horizontally
+ // or vertically and choose corresponding bitmap to create or
+ // recreate
+
+ if ( forArea.height > forArea.width )
+ {
+ wxSize prevDim( 0,0 );
+
+ if ( mpVertBuf )
+ {
+ prevDim.x = mpVertBuf->GetWidth();
+ prevDim.y = mpVertBuf->GetHeight();
+
+ mpVertBufDc->SelectObject( wxNullBitmap );
+ delete mpVertBuf;
+ }
+ else
+ mpVertBufDc = new wxMemoryDC();
+
+ mpVertBuf = new wxBitmap( int( wxMax(forArea.width, prevDim.x ) ),
+ int( wxMax(forArea.height, prevDim.y ) )
+ );
+
+ mpVertBufDc->SelectObject( *mpVertBuf );
+
+ return mpVertBufDc;
+ }
+ else
+ {
+ wxSize prevDim( 0,0 );
+
+ if ( mpHorizBuf )
+ {
+ prevDim.x = mpHorizBuf->GetWidth();
+ prevDim.y = mpHorizBuf->GetHeight();
+
+ mpHorizBufDc->SelectObject( wxNullBitmap );
+ delete mpHorizBuf;
+ }
+ else
+ mpHorizBufDc = new wxMemoryDC();
+
+ mpHorizBuf = new wxBitmap( int( wxMax(forArea.width, prevDim.x ) ),
+ int( wxMax(forArea.height, prevDim.y ) )
+ );
+
+ mpHorizBufDc->SelectObject( *mpHorizBuf );
+
+ return mpHorizBufDc;
+ }
}
void cbAntiflickerPlugin::OnStartDrawInArea( cbStartDrawInAreaEvent& event )
{
- wxASSERT( mpLRUBufDc == NULL ); // DBG:: see comments in OnFinishDrawInArea(..) method
+ wxASSERT( mpLRUBufDc == NULL ); // DBG:: see comments in OnFinishDrawInArea(..) method
- // short-cut
- wxRect& area = event.mArea;
+ // short-cut
+ wxRect& area = event.mArea;
- if ( event.mArea.width < 0 ||
- event.mArea.height < 0 ) return;
+ if ( event.mArea.width < 0 ||
+ event.mArea.height < 0 ) return;
- // memorize given area
- mLRUArea.x = area.x;
- mLRUArea.y = area.y;
- mLRUArea.width = area.width;
- mLRUArea.height = area.height;
+ // memorize given area
+ mLRUArea.x = area.x;
+ mLRUArea.y = area.y;
+ mLRUArea.width = area.width;
+ mLRUArea.height = area.height;
- wxDC* pBufDc = FindSuitableBuffer( area );
+ wxDC* pBufDc = FindSuitableBuffer( area );
- if ( !pBufDc )
-
- pBufDc = AllocNewBuffer( area );
+ if ( !pBufDc )
+ pBufDc = AllocNewBuffer( area );
- pBufDc->SetDeviceOrigin( -area.x, -area.y );
+ pBufDc->SetDeviceOrigin( -area.x, -area.y );
- pBufDc->SetClippingRegion( area.x, area.y,
- area.width, area.height );
+ pBufDc->SetClippingRegion( area.x, area.y,
+ area.width, area.height );
- wxClientDC clntDc( &mpLayout->GetParentFrame() );
+ wxClientDC clntDc( &mpLayout->GetParentFrame() );
- (*event.mppDc) = pBufDc;
+ (*event.mppDc) = pBufDc;
- mpLRUBufDc = pBufDc; // memorize buffer, which will be flushed to screen
- // upon "commiting" the drawing
+ mpLRUBufDc = pBufDc; // memorize buffer, which will be flushed to screen
+ // upon "commiting" the drawing
- /*
- // OLD STUFF::
- mpLRUBufDc->Blit( pos.x, pos.y, size.x, size.y,
- &clntDc, pos.x, pos.y, wxCOPY );
- */
+ /*
+ // OLD STUFF::
+ mpLRUBufDc->Blit( pos.x, pos.y, size.x, size.y,
+ &clntDc, pos.x, pos.y, wxCOPY );
+ */
}
void cbAntiflickerPlugin::OnFinishDrawInArea( cbFinishDrawInAreaEvent& event )
{
- wxRect& area = event.mArea;
+ wxRect& area = event.mArea;
- if ( event.mArea.width < 0 ||
- event.mArea.height < 0 ) return;
+ if ( event.mArea.width < 0 ||
+ event.mArea.height < 0 ) return;
- wxASSERT( mpLRUBufDc ); // DBG:: OnStartDrawInArea should be called first
+ wxASSERT( mpLRUBufDc ); // DBG:: OnStartDrawInArea should be called first
- // FOR NOW:: OnStartDrawInArea(..) should be immediately followed
- // by OnFinishDrawInArea(..) for the same area
+ // FOR NOW:: OnStartDrawInArea(..) should be immediately followed
+ // by OnFinishDrawInArea(..) for the same area
- wxASSERT( mLRUArea.x == area.x );
- wxASSERT( mLRUArea.y == area.y );
- wxASSERT( mLRUArea.width == area.width );
- wxASSERT( mLRUArea.height == area.height );
+ wxASSERT( mLRUArea.x == area.x );
+ wxASSERT( mLRUArea.y == area.y );
+ wxASSERT( mLRUArea.width == area.width );
+ wxASSERT( mLRUArea.height == area.height );
- wxClientDC clntDc( &mpLayout->GetParentFrame() );
+ wxClientDC clntDc( &mpLayout->GetParentFrame() );
- // "commit" drawings in one-shot
- clntDc.Blit( area.x, area.y, area.width, area.height,
- mpLRUBufDc, area.x, area.y, wxCOPY );
+ // "commit" drawings in one-shot
+ clntDc.Blit( area.x, area.y, area.width, area.height,
+ mpLRUBufDc, area.x, area.y, wxCOPY );
- mpLRUBufDc->DestroyClippingRegion();
- mpLRUBufDc = 0;
+ mpLRUBufDc->DestroyClippingRegion();
+ mpLRUBufDc = 0;
}
// Created: 23/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
static inline bool rect_hits_rect( const wxRect& r1, const wxRect& r2 )
{
- if ( ( r2.x >= r1.x && r2.x <= r1.x + r1.width ) ||
- ( r1.x >= r2.x && r1.x <= r2.x + r2.width ) )
-
- if ( ( r2.y >= r1.y && r2.y <= r1.y + r1.height ) ||
- ( r1.y >= r2.y && r1.y <= r2.y + r2.height ) )
-
- return TRUE;
-
- return FALSE;
+ if ( ( r2.x >= r1.x && r2.x <= r1.x + r1.width ) ||
+ ( r1.x >= r2.x && r1.x <= r2.x + r2.width ) )
+ if ( ( r2.y >= r1.y && r2.y <= r1.y + r1.height ) ||
+ ( r1.y >= r2.y && r1.y <= r2.y + r2.height ) )
+ return true;
+ return false;
}
static inline bool rect_contains_point( const wxRect& rect, int x, int y )
{
- return ( x >= rect.x &&
- y >= rect.y &&
- x < rect.x + rect.width &&
- y < rect.y + rect.height );
+ return ( x >= rect.x &&
+ y >= rect.y &&
+ x < rect.x + rect.width &&
+ y < rect.y + rect.height );
}
/***** Implementation for class cbBarDragPlugin *****/
BEGIN_EVENT_TABLE( cbBarDragPlugin, cbPluginBase )
- //EVT_PL_LEFT_DOWN ( cbBarDragPlugin::OnLButtonDown )
- EVT_PL_LEFT_UP ( cbBarDragPlugin::OnLButtonUp )
- EVT_PL_MOTION ( cbBarDragPlugin::OnMouseMove )
- EVT_PL_DRAW_HINT_RECT ( cbBarDragPlugin::OnDrawHintRect )
- EVT_PL_START_BAR_DRAGGING ( cbBarDragPlugin::OnStartBarDragging )
- EVT_PL_LEFT_DCLICK ( cbBarDragPlugin::OnLDblClick )
+ //EVT_PL_LEFT_DOWN ( cbBarDragPlugin::OnLButtonDown )
+ EVT_PL_LEFT_UP ( cbBarDragPlugin::OnLButtonUp )
+ EVT_PL_MOTION ( cbBarDragPlugin::OnMouseMove )
+ EVT_PL_DRAW_HINT_RECT ( cbBarDragPlugin::OnDrawHintRect )
+ EVT_PL_START_BAR_DRAGGING ( cbBarDragPlugin::OnStartBarDragging )
+ EVT_PL_LEFT_DCLICK ( cbBarDragPlugin::OnLDblClick )
END_EVENT_TABLE()
cbBarDragPlugin::cbBarDragPlugin(void)
- : mBarDragStarted ( FALSE ),
- mCanStick ( TRUE ),
- mpScrDc ( NULL ),
- mpCurCursor ( NULL ),
- mpDraggedBar ( NULL ),
- mInClientHintBorder( 4 )
+ : mBarDragStarted ( false ),
+ mCanStick ( true ),
+ mpScrDc ( NULL ),
+ mpCurCursor ( NULL ),
+ mpDraggedBar ( NULL ),
+ mInClientHintBorder( 4 )
{}
cbBarDragPlugin::cbBarDragPlugin( wxFrameLayout* pPanel, int paneMask )
- : cbPluginBase( pPanel, paneMask ),
-
- mBarDragStarted ( FALSE ),
- mCanStick ( TRUE ),
- mpScrDc ( NULL ),
- mpCurCursor ( NULL ),
- mpDraggedBar ( NULL ),
- mInClientHintBorder( 4 )
+ : cbPluginBase( pPanel, paneMask ),
+
+ mBarDragStarted ( false ),
+ mCanStick ( true ),
+ mpScrDc ( NULL ),
+ mpCurCursor ( NULL ),
+ mpDraggedBar ( NULL ),
+ mInClientHintBorder( 4 )
{}
cbBarDragPlugin::~cbBarDragPlugin()
{
- // nothing
+ // nothing
}
// helper methods (protected)
void do_clip_edges( int len, int& rectPos, int& rectLen )
{
- if ( rectPos < 0 )
- {
- rectLen += rectPos;
- rectPos = 0;
- if ( rectLen < 0 )
+ if ( rectPos < 0 )
+ {
+ rectLen += rectPos;
+ rectPos = 0;
+ if ( rectLen < 0 )
rectLen = 1;
- }
- else
- if ( rectPos > len-1 )
- {
- rectPos = len-1;
- rectLen = 1;
- }
- else
- if ( rectPos + rectLen - 1 > len )
-
- rectLen -= (rectPos + rectLen) - len + 1;
+ }
+ else
+ if ( rectPos > len-1 )
+ {
+ rectPos = len-1;
+ rectLen = 1;
+ }
+ else
+ if ( rectPos + rectLen - 1 > len )
+ rectLen -= (rectPos + rectLen) - len + 1;
}
void cbBarDragPlugin::ClipRectInFrame( wxRect& rect )
{
- int w, h;
- mpLayout->GetParentFrame().GetClientSize( &w, &h );
+ int w, h;
+ mpLayout->GetParentFrame().GetClientSize( &w, &h );
- do_clip_edges( w, rect.x, rect.width );
- do_clip_edges( h, rect.y, rect.height );
+ do_clip_edges( w, rect.x, rect.width );
+ do_clip_edges( h, rect.y, rect.height );
}
void cbBarDragPlugin::ClipPosInFrame( wxPoint& pos )
{
- int w, h;
- mpLayout->GetParentFrame().GetClientSize( &w, &h );
+ int w, h;
+ mpLayout->GetParentFrame().GetClientSize( &w, &h );
- if ( pos.x < 0 )
+ if ( pos.x < 0 )
pos.x = 0;
- if ( pos.y < 0 )
+ if ( pos.y < 0 )
pos.y = 0;
- if ( pos.x > w )
+ if ( pos.x > w )
pos.x = w-1;
- if ( pos.y > h )
+ if ( pos.y > h )
pos.y = h-1;
}
void cbBarDragPlugin::AdjustHintRect( wxPoint& mousePos )
{
- mHintRect.x = mousePos.x - mMouseInRectX;
- mHintRect.y = mousePos.y - mMouseInRectY;
+ mHintRect.x = mousePos.x - mMouseInRectX;
+ mHintRect.y = mousePos.y - mMouseInRectY;
}
cbDockPane* cbBarDragPlugin::HitTestPanes( wxRect& rect )
{
- //wxRect clipped = rect;
-
- //ClipRectInFrame( clipped );
+ //wxRect clipped = rect;
- cbDockPane** pPanes = mpLayout->GetPanesArray();
+ //ClipRectInFrame( clipped );
- for( int i = 0; i != MAX_PANES; ++i )
-
- if ( rect_hits_rect( pPanes[i]->mBoundsInParent, rect ) )
+ cbDockPane** pPanes = mpLayout->GetPanesArray();
- return pPanes[i];
+ for( int i = 0; i != MAX_PANES; ++i )
+ if ( rect_hits_rect( pPanes[i]->mBoundsInParent, rect ) )
+ return pPanes[i];
- return NULL;
+ return NULL;
}
cbDockPane* cbBarDragPlugin::HitTestPanes( wxPoint& pos )
{
- wxPoint clipped = pos;
+ wxPoint clipped = pos;
- //ClipPosInFrame( pos );
+ //ClipPosInFrame( pos );
- cbDockPane** pPanes = mpLayout->GetPanesArray();
+ cbDockPane** pPanes = mpLayout->GetPanesArray();
- for( int i = 0; i != MAX_PANES; ++i )
-
- if ( rect_contains_point( pPanes[i]->mBoundsInParent, clipped.x, clipped.y ) )
+ for( int i = 0; i != MAX_PANES; ++i )
+ if ( rect_contains_point( pPanes[i]->mBoundsInParent, clipped.x, clipped.y ) )
+ return pPanes[i];
- return pPanes[i];
-
- return NULL;
+ return NULL;
}
bool cbBarDragPlugin::HitsPane( cbDockPane* pPane, wxRect& rect )
{
- return rect_hits_rect( pPane->mBoundsInParent, rect );
+ return rect_hits_rect( pPane->mBoundsInParent, rect );
}
int cbBarDragPlugin::GetDistanceToPane( cbDockPane* pPane, wxPoint& mousePos )
{
- wxRect& bounds = pPane->mBoundsInParent;
-
- switch( pPane->mAlignment )
- {
- case FL_ALIGN_TOP : return mousePos.y - ( bounds.y + bounds.height );
-
- case FL_ALIGN_BOTTOM : return bounds.y - mousePos.y;
-
- case FL_ALIGN_LEFT : return mousePos.x - ( bounds.x + bounds.width );
+ wxRect& bounds = pPane->mBoundsInParent;
- case FL_ALIGN_RIGHT : return bounds.x - mousePos.x;
-
- default : return 0; // never reached
- }
+ switch( pPane->mAlignment )
+ {
+ case FL_ALIGN_TOP : return mousePos.y - ( bounds.y + bounds.height );
+ case FL_ALIGN_BOTTOM : return bounds.y - mousePos.y;
+ case FL_ALIGN_LEFT : return mousePos.x - ( bounds.x + bounds.width );
+ case FL_ALIGN_RIGHT : return bounds.x - mousePos.x;
+ default : return 0; // never reached
+ }
-// return 0;
+// return 0;
}
bool cbBarDragPlugin::IsInOtherPane( wxPoint& mousePos )
{
- cbDockPane* pPane = HitTestPanes( mousePos );
+ cbDockPane* pPane = HitTestPanes( mousePos );
- if ( pPane && pPane != mpCurPane ) return TRUE;
- else return FALSE;
+ if ( pPane && pPane != mpCurPane ) return true;
+ else return false;
}
bool cbBarDragPlugin::IsInClientArea( wxPoint& mousePos )
{
- return ( HitTestPanes( mousePos ) == NULL );
+ return ( HitTestPanes( mousePos ) == NULL );
}
bool cbBarDragPlugin::IsInClientArea( wxRect& rect )
{
- return ( HitTestPanes( rect ) == NULL );
+ return ( HitTestPanes( rect ) == NULL );
}
void cbBarDragPlugin::CalcOnScreenDims( wxRect& rect )
{
- if ( !mpCurPane || mpDraggedBar->IsFixed() ) return;
+ if ( !mpCurPane || mpDraggedBar->IsFixed() ) return;
- wxRect inPane = rect;
+ wxRect inPane = rect;
- mpCurPane->FrameToPane( &inPane );
+ mpCurPane->FrameToPane( &inPane );
- int rowNo = mpCurPane->GetRowAt( inPane.y, inPane.y + inPane.height );
+ int rowNo = mpCurPane->GetRowAt( inPane.y, inPane.y + inPane.height );
- bool isMaximized = ( rowNo >= (int)mpCurPane->GetRowList().Count() || rowNo < 0 );
+ bool isMaximized = ( rowNo >= (int)mpCurPane->GetRowList().Count() || rowNo < 0 );
- if ( isMaximized )
- {
- inPane.x = 0;
- inPane.width = mpCurPane->mPaneWidth;
+ if ( isMaximized )
+ {
+ inPane.x = 0;
+ inPane.width = mpCurPane->mPaneWidth;
- mpCurPane->PaneToFrame( &inPane );
+ mpCurPane->PaneToFrame( &inPane );
- rect = inPane;
- }
+ rect = inPane;
+ }
}
// helpers
static inline void check_upper_overrun( int& pos, int width, int mousePos )
{
- if ( mousePos >= pos + width )
-
- pos = mousePos - width/2;
+ if ( mousePos >= pos + width )
+ pos = mousePos - width/2;
}
static inline void check_lower_overrun( int& pos, int width, int mousePos )
{
- if ( mousePos <= pos )
-
- pos = mousePos - width/2;
+ if ( mousePos <= pos )
+ pos = mousePos - width/2;
}
void cbBarDragPlugin::StickToPane( cbDockPane* pPane, wxPoint& mousePos )
{
- int wInPane = GetBarWidthInPane ( pPane );
- int hInPane = GetBarHeightInPane( pPane );
+ int wInPane = GetBarWidthInPane ( pPane );
+ int hInPane = GetBarHeightInPane( pPane );
+
+ // adjsut hint-rect horizontally (in pane's orientation)
- // adjsut hint-rect horizontally (in pane's orientation)
-
- if ( pPane->IsHorizontal() )
- {
- mHintRect.width = wInPane;
- mHintRect.height = hInPane;
- }
- else
- {
- mHintRect.height = wInPane;
- mHintRect.width = hInPane;
- }
+ if ( pPane->IsHorizontal() )
+ {
+ mHintRect.width = wInPane;
+ mHintRect.height = hInPane;
+ }
+ else
+ {
+ mHintRect.height = wInPane;
+ mHintRect.width = hInPane;
+ }
- // adjsut hint-rect vertically (in pane's orientation)
+ // adjsut hint-rect vertically (in pane's orientation)
- wxRect& bounds = pPane->mBoundsInParent;
+ wxRect& bounds = pPane->mBoundsInParent;
- // TRUE, if hint enters the pane through it's lower edge
+ // true, if hint enters the pane through it's lower edge
- bool fromLowerEdge = ( pPane->IsHorizontal() )
- ? mousePos.y > bounds.y
- : mousePos.x > bounds.x;
+ bool fromLowerEdge = ( pPane->IsHorizontal() )
+ ? mousePos.y > bounds.y
+ : mousePos.x > bounds.x;
- // NOTE:: about all the below min/max things: they are meant to ensure
- // that the mouse pointer doesn't overrun (leave) the hint-rectangle
- // when its dimensions are recalculated upon sticking it to the pane
+ // NOTE:: about all the below min/max things: they are meant to ensure
+ // that the mouse pointer doesn't overrun (leave) the hint-rectangle
+ // when its dimensions are recalculated upon sticking it to the pane
- if ( pPane->IsHorizontal() && fromLowerEdge )
- {
- int paneBottomEdgeY = bounds.y + bounds.height;
+ if ( pPane->IsHorizontal() && fromLowerEdge )
+ {
+ int paneBottomEdgeY = bounds.y + bounds.height;
- mHintRect.y = wxMin( paneBottomEdgeY, mousePos.y );
+ mHintRect.y = wxMin( paneBottomEdgeY, mousePos.y );
- check_lower_overrun( mHintRect.y, hInPane, mousePos.y );
+ check_lower_overrun( mHintRect.y, hInPane, mousePos.y );
- }
- else
- if ( pPane->IsHorizontal() && !fromLowerEdge )
- {
- int paneTopEdgeY = bounds.y;
+ }
+ else
+ if ( pPane->IsHorizontal() && !fromLowerEdge )
+ {
+ int paneTopEdgeY = bounds.y;
- mHintRect.y = wxMax( paneTopEdgeY - hInPane, mousePos.y - hInPane );
+ mHintRect.y = wxMax( paneTopEdgeY - hInPane, mousePos.y - hInPane );
- check_upper_overrun( mHintRect.y, hInPane, mousePos.y );
- }
- else
- if ( !pPane->IsHorizontal() && fromLowerEdge )
- {
- int paneRightEdgeX = bounds.x + bounds.width;
+ check_upper_overrun( mHintRect.y, hInPane, mousePos.y );
+ }
+ else
+ if ( !pPane->IsHorizontal() && fromLowerEdge )
+ {
+ int paneRightEdgeX = bounds.x + bounds.width;
- mHintRect.x = wxMin( paneRightEdgeX, mousePos.x );
+ mHintRect.x = wxMin( paneRightEdgeX, mousePos.x );
- check_lower_overrun( mHintRect.x, hInPane, mousePos.x );
- }
- else
- if ( !pPane->IsHorizontal() && !fromLowerEdge )
- {
- int paneLeftEdgeX = bounds.x;
+ check_lower_overrun( mHintRect.x, hInPane, mousePos.x );
+ }
+ else
+ if ( !pPane->IsHorizontal() && !fromLowerEdge )
+ {
+ int paneLeftEdgeX = bounds.x;
- mHintRect.x = wxMax( paneLeftEdgeX - hInPane, mousePos.x - hInPane );
+ mHintRect.x = wxMax( paneLeftEdgeX - hInPane, mousePos.x - hInPane );
- check_upper_overrun( mHintRect.x, hInPane, mousePos.x );
- }
+ check_upper_overrun( mHintRect.x, hInPane, mousePos.x );
+ }
- mMouseInRectX = mousePos.x - mHintRect.x;
- mMouseInRectY = mousePos.y - mHintRect.y;
+ mMouseInRectX = mousePos.x - mHintRect.x;
+ mMouseInRectY = mousePos.y - mHintRect.y;
- mpCurPane = pPane; // memorize pane to which the hint is currently sticked
+ mpCurPane = pPane; // memorize pane to which the hint is currently sticked
}
void cbBarDragPlugin::UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos )
{
- // unsticking causes rectangle to get the shape in which
- // dragged control-bar would be when floated
+ // unsticking causes rectangle to get the shape in which
+ // dragged control-bar would be when floated
- int newWidth = mpDraggedBar->mDimInfo.mSizes[wxCBAR_FLOATING].x;
- int newHeight = mpDraggedBar->mDimInfo.mSizes[wxCBAR_FLOATING].y;
+ int newWidth = mpDraggedBar->mDimInfo.mSizes[wxCBAR_FLOATING].x;
+ int newHeight = mpDraggedBar->mDimInfo.mSizes[wxCBAR_FLOATING].y;
- wxRect& flBounds = mpDraggedBar->mDimInfo.mBounds[wxCBAR_FLOATING];
+ wxRect& flBounds = mpDraggedBar->mDimInfo.mBounds[wxCBAR_FLOATING];
- if ( flBounds.width != -1 )
- {
- newWidth = flBounds.width;
- newHeight = flBounds.height;
- }
+ if ( flBounds.width != -1 )
+ {
+ newWidth = flBounds.width;
+ newHeight = flBounds.height;
+ }
- mHintRect.width = newWidth;
- mHintRect.height = newHeight;
+ mHintRect.width = newWidth;
+ mHintRect.height = newHeight;
- wxRect& bounds = pPane->mBoundsInParent;
+ wxRect& bounds = pPane->mBoundsInParent;
- // TRUE, if hint leaves the pane through it's lower edge
+ // true, if hint leaves the pane through it's lower edge
- bool fromLowerEdge = ( pPane->IsHorizontal() )
- ? mousePos.y > bounds.y
- : mousePos.x > bounds.x;
+ bool fromLowerEdge = ( pPane->IsHorizontal() )
+ ? mousePos.y > bounds.y
+ : mousePos.x > bounds.x;
- // NOTE:: ...all the below min/max things - see comments about it in StickToPane(..)
+ // NOTE:: ...all the below min/max things - see comments about it in StickToPane(..)
- if ( pPane->IsHorizontal() && fromLowerEdge )
- {
-// bool fromLowerEdge = mousePos.y > bounds.y;
+ if ( pPane->IsHorizontal() && fromLowerEdge )
+ {
+ // bool fromLowerEdge = mousePos.y > bounds.y;
- mHintRect.y = wxMax( bounds.y + bounds.height + 1, mousePos.y - newHeight );
+ mHintRect.y = wxMax( bounds.y + bounds.height + 1, mousePos.y - newHeight );
- check_upper_overrun( mHintRect.y, newHeight, mousePos.y );
+ check_upper_overrun( mHintRect.y, newHeight, mousePos.y );
- // this is how MFC's hint behaves:
+ // this is how MFC's hint behaves:
- if ( mMouseInRectX > newWidth )
-
- mHintRect.x = mousePos.x - ( newWidth / 2 );
- }
- else
- if ( pPane->IsHorizontal() && !fromLowerEdge )
- {
- mHintRect.y = wxMin( bounds.y - newHeight - 1, mousePos.y );
+ if ( mMouseInRectX > newWidth )
+ mHintRect.x = mousePos.x - ( newWidth / 2 );
+ }
+ else
+ if ( pPane->IsHorizontal() && !fromLowerEdge )
+ {
+ mHintRect.y = wxMin( bounds.y - newHeight - 1, mousePos.y );
- // -/-
+ // -/-
- if ( mMouseInRectX > newWidth )
-
- mHintRect.x = mousePos.x - ( newWidth / 2 );
+ if ( mMouseInRectX > newWidth )
+ mHintRect.x = mousePos.x - ( newWidth / 2 );
- check_lower_overrun( mHintRect.y, newHeight, mousePos.y );
- }
- else
- if ( !pPane->IsHorizontal() && fromLowerEdge )
- {
- mHintRect.x = wxMax( bounds.x + bounds.width, mousePos.x - newWidth );
+ check_lower_overrun( mHintRect.y, newHeight, mousePos.y );
+ }
+ else
+ if ( !pPane->IsHorizontal() && fromLowerEdge )
+ {
+ mHintRect.x = wxMax( bounds.x + bounds.width, mousePos.x - newWidth );
- // -/-
-
- if ( mMouseInRectY > newHeight )
+ // -/-
- mHintRect.y = mousePos.y - ( newHeight / 2 );
+ if ( mMouseInRectY > newHeight )
+ mHintRect.y = mousePos.y - ( newHeight / 2 );
- check_upper_overrun( mHintRect.x, newWidth, mousePos.x );
- }
- else
- if ( !pPane->IsHorizontal() && !fromLowerEdge )
- {
- mHintRect.x = wxMin( bounds.x - newWidth - 1, mousePos.x );
+ check_upper_overrun( mHintRect.x, newWidth, mousePos.x );
+ }
+ else
+ if ( !pPane->IsHorizontal() && !fromLowerEdge )
+ {
+ mHintRect.x = wxMin( bounds.x - newWidth - 1, mousePos.x );
- // -/-
-
- if ( mMouseInRectY > newHeight )
+ // -/-
- mHintRect.y = mousePos.y - ( newHeight / 2 );
+ if ( mMouseInRectY > newHeight )
+ mHintRect.y = mousePos.y - ( newHeight / 2 );
- check_lower_overrun( mHintRect.x, newWidth, mousePos.x );
- }
+ check_lower_overrun( mHintRect.x, newWidth, mousePos.x );
+ }
- mMouseInRectX = mousePos.x - mHintRect.x;
- mMouseInRectY = mousePos.y - mHintRect.y;
+ mMouseInRectX = mousePos.x - mHintRect.x;
+ mMouseInRectY = mousePos.y - mHintRect.y;
- mpCurPane = NULL;
-}
+ mpCurPane = NULL;
+}
int cbBarDragPlugin::GetBarWidthInPane( cbDockPane* pPane )
{
- if ( pPane == mpSrcPane )
-
- return mBarWidthInSrcPane;
+ if ( pPane == mpSrcPane )
+ return mBarWidthInSrcPane;
- // this is how MFC's bars behave:
+ // this is how MFC's bars behave:
- if ( pPane->IsHorizontal() )
-
- return mpDraggedBar->mDimInfo.mSizes[wxCBAR_DOCKED_HORIZONTALLY].x;
- else
- return mpDraggedBar->mDimInfo.mSizes[wxCBAR_DOCKED_VERTICALLY ].x;
+ if ( pPane->IsHorizontal() )
+ return mpDraggedBar->mDimInfo.mSizes[wxCBAR_DOCKED_HORIZONTALLY].x;
+ else
+ return mpDraggedBar->mDimInfo.mSizes[wxCBAR_DOCKED_VERTICALLY ].x;
}
int cbBarDragPlugin::GetBarHeightInPane( cbDockPane* pPane )
{
- if ( pPane->IsHorizontal() )
-
- return mpDraggedBar->mDimInfo.mSizes[wxCBAR_DOCKED_HORIZONTALLY].y;
- else
- return mpDraggedBar->mDimInfo.mSizes[wxCBAR_DOCKED_VERTICALLY ].y;
+ if ( pPane->IsHorizontal() )
+ return mpDraggedBar->mDimInfo.mSizes[wxCBAR_DOCKED_HORIZONTALLY].y;
+ else
+ return mpDraggedBar->mDimInfo.mSizes[wxCBAR_DOCKED_VERTICALLY ].y;
}
void cbBarDragPlugin::ShowHint( bool prevWasInClient )
{
- bool wasDocked = FALSE;
+ bool wasDocked = false;
+ if ( mpSrcPane->mProps.mRealTimeUpdatesOn == false )
+ {
+ // do heavy calculations first
- if ( mpSrcPane->mProps.mRealTimeUpdatesOn == FALSE )
- {
- // do heavy calculations first
-
- wxRect actualRect = mHintRect; // will be adjusted depending on drag-settings
+ wxRect actualRect = mHintRect; // will be adjusted depending on drag-settings
- if ( mpSrcPane->mProps.mExactDockPredictionOn && mpCurPane )
- {
- #ifdef __WXDEBUG__
- bool success =
- #endif
- mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, FALSE );
+ if ( mpSrcPane->mProps.mExactDockPredictionOn && mpCurPane )
+ {
+#ifdef __WXDEBUG__
+ bool success =
+#endif
+ mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, false );
- wxASSERT( success ); // DBG::
+ wxASSERT( success ); // DBG::
- actualRect = mpDraggedBar->mBounds;
+ actualRect = mpDraggedBar->mBounds;
- mpCurPane->PaneToFrame( &actualRect );
- }
- else
- CalcOnScreenDims( actualRect );
+ mpCurPane->PaneToFrame( &actualRect );
+ }
+ else
+ CalcOnScreenDims( actualRect );
- // release previous hint
+ // release previous hint
- if ( mPrevHintRect.x != POS_UNDEFINED )
- {
- // erase previous rectangle
+ if ( mPrevHintRect.x != POS_UNDEFINED )
+ {
+ // erase previous rectangle
- cbDrawHintRectEvent evt( mPrevHintRect, prevWasInClient, TRUE, FALSE );
+ cbDrawHintRectEvent evt( mPrevHintRect, prevWasInClient, true, false );
- mpLayout->FirePluginEvent( evt );
- }
+ mpLayout->FirePluginEvent( evt );
+ }
- // draw new hint
+ // draw new hint
- cbDrawHintRectEvent evt( actualRect, mpCurPane == NULL, FALSE, FALSE );
+ cbDrawHintRectEvent evt( actualRect, mpCurPane == NULL, false, false );
- mpLayout->FirePluginEvent( evt );
+ mpLayout->FirePluginEvent( evt );
- mPrevHintRect = actualRect;
- }
- else
- {
- // otherwise, if real-time updates option is ON
+ mPrevHintRect = actualRect;
+ }
+ else
+ {
+ // otherwise, if real-time updates option is ON
- if ( mpDraggedBar->mState != wxCBAR_FLOATING && !mpCurPane )
- {
- mpLayout->SetBarState( mpDraggedBar, wxCBAR_FLOATING, TRUE );
- }
- else
- if ( mpDraggedBar->mState == wxCBAR_FLOATING && mpCurPane )
- {
- mpLayout->SetBarState( mpDraggedBar, wxCBAR_DOCKED_HORIZONTALLY, FALSE );
+ if ( mpDraggedBar->mState != wxCBAR_FLOATING && !mpCurPane )
+ {
+ mpLayout->SetBarState( mpDraggedBar, wxCBAR_FLOATING, true );
+ }
+ else
+ if ( mpDraggedBar->mState == wxCBAR_FLOATING && mpCurPane )
+ {
+ mpLayout->SetBarState( mpDraggedBar, wxCBAR_DOCKED_HORIZONTALLY, false );
- wasDocked = TRUE;
- }
+ wasDocked = true;
+ }
- if ( mpCurPane )
- {
- mpLayout->GetUpdatesManager().OnStartChanges();
+ if ( mpCurPane )
+ {
+ mpLayout->GetUpdatesManager().OnStartChanges();
- if ( wasDocked )
+ if ( wasDocked )
- mpDraggedBar->mUMgrData.SetDirty( TRUE );
+ mpDraggedBar->mUMgrData.SetDirty( true );
- #ifdef __WXDEBUG__
- bool success =
- #endif
- mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, FALSE );
+#ifdef __WXDEBUG__
+ bool success =
+#endif
+ mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, false );
- wxASSERT( success ); // DBG ::
+ wxASSERT( success ); // DBG ::
- mpLayout->GetUpdatesManager().OnFinishChanges();
- mpLayout->GetUpdatesManager().UpdateNow();
- }
- else
- {
- if ( mpLayout->mFloatingOn )
- {
- // move the top-most floated bar around as user drags the hint
+ mpLayout->GetUpdatesManager().OnFinishChanges();
+ mpLayout->GetUpdatesManager().UpdateNow();
+ }
+ else
+ {
+ if ( mpLayout->mFloatingOn )
+ {
+ // move the top-most floated bar around as user drags the hint
- mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mHintRect;
+ mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mHintRect;
- mpLayout->ApplyBarProperties( mpDraggedBar );
- }
- }
- }
+ mpLayout->ApplyBarProperties( mpDraggedBar );
+ }
+ }
+ }
}
/*** event handlers ***/
void cbBarDragPlugin::OnMouseMove( cbMotionEvent& event )
{
- // calculate postion in frame's coordiantes
-
- if ( !mBarDragStarted )
- {
- event.Skip(); // pass event to the next plugin
- return;
- }
-
- wxPoint mousePos = event.mPos;
-
- event.mpPane->PaneToFrame( &mousePos.x, &mousePos.y );
-
- bool prevIsInClient = ( mpCurPane == 0 );
-
- AdjustHintRect( mousePos );
-
- // if the hint-rect is not "tempted" to any pane yet
-
- if ( mpCurPane == NULL )
- {
- cbDockPane* pPane = HitTestPanes( mHintRect );
-
- if ( !pPane )
-
- // enable sticking again, if we've left the pane completely
- mCanStick = TRUE;
-
- if ( mCanStick && pPane &&
- GetDistanceToPane( pPane, mousePos ) < GetBarHeightInPane( pPane ) )
-
- StickToPane( pPane, mousePos );
- else
- if ( pPane && HitTestPanes( mousePos ) == pPane && 0 ) // FOR NOW:: disabled
-
- StickToPane( pPane, mousePos );
- }
- else
- {
- // otherwise, when rect is now sticked to some of the panes
- // check if it should still remain in this pane
-
- mCanStick = TRUE;
-
- bool mouseInOther = IsInOtherPane( mousePos );
-
- if ( mouseInOther )
- {
- cbDockPane* pPane = HitTestPanes( mousePos );
-
- StickToPane( pPane, mousePos );
- }
- else
- {
- if ( IsInClientArea( mousePos ) )
- {
- cbDockPane* pPane = HitTestPanes( mHintRect );
-
- if ( pPane &&
- pPane != mpCurPane &&
- GetDistanceToPane( pPane, mousePos ) < GetBarHeightInPane( pPane ) )
-
- StickToPane( pPane, mousePos );
- else
- if ( !pPane )
- {
- UnstickFromPane( mpCurPane, mousePos );
-
- // FOR NOW:: disabled, would cause some mess
- //mCanStick = FALSE; // prevents from sticking to this
- // pane again, flag is reset when hint-rect
- // leaves the pane completely
- }
- else
- if ( GetDistanceToPane( pPane, mousePos ) > GetBarHeightInPane( pPane ) )
- {
- if ( !HitsPane( mpCurPane, mHintRect ) )
- {
- UnstickFromPane( mpCurPane, mousePos );
-
- // FOR NOW:: disabled, would cause some mess
- //mCanStick = FALSE; // prevents from sticking to this
- // pane again, flag is reset when hint-rect
- // leaves the pane completely
- }
- }
-
- }
- else
- {
- }
- }
- }
-
- ShowHint( prevIsInClient );
-
- wxCursor* pPrevCurs = mpCurCursor;
-
- if ( mpCurPane )
+ // calculate postion in frame's coordiantes
+
+ if ( !mBarDragStarted )
{
- mpCurCursor = mpLayout->mpNormalCursor;
+ event.Skip(); // pass event to the next plugin
+ return;
}
- else
- {
+
+ wxPoint mousePos = event.mPos;
+
+ event.mpPane->PaneToFrame( &mousePos.x, &mousePos.y );
+
+ bool prevIsInClient = ( mpCurPane == 0 );
+
+ AdjustHintRect( mousePos );
+
+ // if the hint-rect is not "tempted" to any pane yet
+
+ if ( mpCurPane == NULL )
+ {
+ cbDockPane* pPane = HitTestPanes( mHintRect );
+
+ // enable sticking again, if we've left the pane completely
+ if ( !pPane )
+ mCanStick = true;
+
+ if ( mCanStick && pPane &&
+ GetDistanceToPane( pPane, mousePos ) < GetBarHeightInPane( pPane ) )
+ StickToPane( pPane, mousePos );
+ else
+ if ( pPane && HitTestPanes( mousePos ) == pPane && 0 ) // FOR NOW:: disabled
+
+ StickToPane( pPane, mousePos );
+ }
+ else
+ {
+ // otherwise, when rect is now sticked to some of the panes
+ // check if it should still remain in this pane
+
+ mCanStick = true;
+
+ bool mouseInOther = IsInOtherPane( mousePos );
+
+ if ( mouseInOther )
+ {
+ cbDockPane* pPane = HitTestPanes( mousePos );
+
+ StickToPane( pPane, mousePos );
+ }
+ else
+ {
+ if ( IsInClientArea( mousePos ) )
+ {
+ cbDockPane* pPane = HitTestPanes( mHintRect );
+
+ if ( pPane &&
+ pPane != mpCurPane &&
+ GetDistanceToPane( pPane, mousePos ) < GetBarHeightInPane( pPane ) )
+ StickToPane( pPane, mousePos );
+ else
+ if ( !pPane )
+ {
+ UnstickFromPane( mpCurPane, mousePos );
+
+ // FOR NOW:: disabled, would cause some mess
+ // mCanStick = false; // prevents from sticking to this
+ // pane again, flag is reset when hint-rect
+ // leaves the pane completely
+ }
+ else
+ if ( GetDistanceToPane( pPane, mousePos ) > GetBarHeightInPane( pPane ) )
+ {
+ if ( !HitsPane( mpCurPane, mHintRect ) )
+ {
+ UnstickFromPane( mpCurPane, mousePos );
+
+ // FOR NOW:: disabled, would cause some mess
+ // mCanStick = false; // prevents from sticking to this
+ // pane again, flag is reset when hint-rect
+ // leaves the pane completely
+ }
+ }
+
+ }
+ }
+ }
+
+ ShowHint( prevIsInClient );
+
+ wxCursor* pPrevCurs = mpCurCursor;
+
+ if ( mpCurPane )
+ {
+ mpCurCursor = mpLayout->mpNormalCursor;
+ }
+ else
+ {
// if floating is off, and we are in the client
// area, the cursor will be invalid, otherwise
// it will be the normal cursor
-
+
if (mpLayout->mFloatingOn)
{
- mpCurCursor = mpLayout->mpNormalCursor;
+ mpCurCursor = mpLayout->mpNormalCursor;
}
- else
+ else
{
- mpCurCursor = mpLayout->mpNECursor;
- }
+ mpCurCursor = mpLayout->mpNECursor;
+ }
- }
- if ( pPrevCurs != mpCurCursor )
- mpLayout->GetParentFrame().SetCursor( *mpCurCursor );
+ }
+ if ( pPrevCurs != mpCurCursor )
+ mpLayout->GetParentFrame().SetCursor( *mpCurCursor );
}
void cbBarDragPlugin::OnLButtonDown( cbLeftDownEvent& event )
{
- if ( mBarDragStarted )
- {
- wxMessageBox(wxT("DblClick!"));
- }
+ if ( mBarDragStarted )
+ {
+ wxMessageBox(wxT("DblClick!"));
+ }
- event.Skip();
+ event.Skip();
}
void cbBarDragPlugin::OnLButtonUp( cbLeftUpEvent& event )
{
- if ( mBarDragStarted )
- {
- if ( mpSrcPane->mProps.mRealTimeUpdatesOn == FALSE )
- {
- // erase current rectangle, and finsih on-screen drawing session
+ if ( mBarDragStarted )
+ {
+ if ( mpSrcPane->mProps.mRealTimeUpdatesOn == false )
+ {
+ // erase current rectangle, and finsih on-screen drawing session
- cbDrawHintRectEvent evt( mPrevHintRect, mpCurPane == NULL, TRUE, TRUE );
+ cbDrawHintRectEvent evt( mPrevHintRect, mpCurPane == NULL, true, true );
- mpLayout->FirePluginEvent( evt );
+ mpLayout->FirePluginEvent( evt );
- if ( mpCurPane != NULL )
- {
- if ( mpSrcPane->mProps.mExactDockPredictionOn )
- {
- mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, FALSE );
+ if ( mpCurPane != NULL )
+ {
+ if ( mpSrcPane->mProps.mExactDockPredictionOn )
+ {
+ mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, false );
- mpLayout->GetUpdatesManager().OnFinishChanges();
- mpLayout->GetUpdatesManager().UpdateNow();
- }
- else
+ mpLayout->GetUpdatesManager().OnFinishChanges();
+ mpLayout->GetUpdatesManager().UpdateNow();
+ }
+ else
{
if (mpDraggedBar->mState == wxCBAR_FLOATING)
{
- mpLayout->SetBarState( mpDraggedBar, wxCBAR_DOCKED_HORIZONTALLY, TRUE);
+ mpLayout->SetBarState( mpDraggedBar, wxCBAR_DOCKED_HORIZONTALLY, true);
}
- mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane );
- }
- }
- else
+ mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane );
+ }
+ }
+ else
{
if (mpDraggedBar->mState != wxCBAR_FLOATING)
{
mpLayout->SetBarState(mpDraggedBar, wxCBAR_FLOATING, true);
}
- mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mHintRect;
- mpLayout->ApplyBarProperties( mpDraggedBar );
+ mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mHintRect;
+ mpLayout->ApplyBarProperties( mpDraggedBar );
}
- }
-
- mHintRect.width = -1;
+ }
+
+ mHintRect.width = -1;
// In Windows, at least, the frame needs to have a null cursor
// else child windows (such as text windows) inherit the cursor
mpLayout->GetParentFrame().SetCursor( *mpLayout->mpNormalCursor );
#endif
- mpLayout->ReleaseEventsFromPane( event.mpPane );
- mpLayout->ReleaseEventsFromPlugin( this );
+ mpLayout->ReleaseEventsFromPane( event.mpPane );
+ mpLayout->ReleaseEventsFromPlugin( this );
- mBarDragStarted = FALSE;
+ mBarDragStarted = false;
- if ( mBarWasFloating && mpDraggedBar->mState != wxCBAR_FLOATING )
- {
- // save bar's floating position before it was docked
+ if ( mBarWasFloating && mpDraggedBar->mState != wxCBAR_FLOATING )
+ {
+ // save bar's floating position before it was docked
- mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mFloatedBarBounds;
- }
- }
- else
- event.Skip(); // pass event to the next plugin
+ mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mFloatedBarBounds;
+ }
+ }
+ else
+ event.Skip(); // pass event to the next plugin
}
void cbBarDragPlugin::OnLDblClick( cbLeftDClickEvent& event )
{
- int avoidCompilerWarning = 1;
- if ( avoidCompilerWarning )
- {
- cbBarInfo* pHittedBar;
- cbRowInfo* pRow;
+ int avoidCompilerWarning = 1;
+ if ( avoidCompilerWarning )
+ {
+ cbBarInfo* pHittedBar;
+ cbRowInfo* pRow;
- if ( event.mpPane->HitTestPaneItems( event.mPos, // in pane's coordiantes
- &pRow,
- &pHittedBar ) == CB_BAR_CONTENT_HITTED
- )
- {
- mpLayout->SetBarState( pHittedBar, wxCBAR_FLOATING, TRUE );
+ if ( event.mpPane->HitTestPaneItems( event.mPos, // in pane's coordiantes
+ &pRow,
+ &pHittedBar ) == CB_BAR_CONTENT_HITTED
+ )
+ {
+ mpLayout->SetBarState( pHittedBar, wxCBAR_FLOATING, true );
- mpLayout->RepositionFloatedBar( pHittedBar );
+ mpLayout->RepositionFloatedBar( pHittedBar );
- return; // event is "eaten" by this plugin
- }
+ return; // event is "eaten" by this plugin
+ }
- mBarDragStarted = FALSE;
+ mBarDragStarted = false;
- event.Skip();
- }
+ event.Skip();
+ }
- //wxMessageBox("Hi, dblclick arrived!");
+ //wxMessageBox("Hi, dblclick arrived!");
}
void cbBarDragPlugin::OnStartBarDragging( cbStartBarDraggingEvent& event )
{
- mpDraggedBar = event.mpBar;
- mpSrcPane = event.mpPane;
+ mpDraggedBar = event.mpBar;
+ mpSrcPane = event.mpPane;
+
+ mpLayout->CaptureEventsForPane( event.mpPane );
+ mpLayout->CaptureEventsForPlugin( this );
- mpLayout->CaptureEventsForPane( event.mpPane );
- mpLayout->CaptureEventsForPlugin( this );
+ mpLayout->GetParentFrame().SetCursor( *mpLayout->mpNormalCursor );
- mpLayout->GetParentFrame().SetCursor( *mpLayout->mpNormalCursor );
+ mBarDragStarted = true;
- mBarDragStarted = TRUE;
+ wxRect inParent = mpDraggedBar->mBounds;
- wxRect inParent = mpDraggedBar->mBounds;
+ mBarWasFloating = mpDraggedBar->mState == wxCBAR_FLOATING;
- mBarWasFloating = mpDraggedBar->mState == wxCBAR_FLOATING;
-
- if ( mBarWasFloating )
- {
- inParent = mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ];
- mFloatedBarBounds = inParent;
- }
- else
- event.mpPane->PaneToFrame( &inParent );
+ if ( mBarWasFloating )
+ {
+ inParent = mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ];
+ mFloatedBarBounds = inParent;
+ }
+ else
+ event.mpPane->PaneToFrame( &inParent );
- mHintRect.x = POS_UNDEFINED;
+ mHintRect.x = POS_UNDEFINED;
- mHintRect.width = inParent.width;
- mHintRect.height = inParent.height;
+ mHintRect.width = inParent.width;
+ mHintRect.height = inParent.height;
- mMouseInRectX = event.mPos.x - inParent.x;
- mMouseInRectY = event.mPos.y - inParent.y;
+ mMouseInRectX = event.mPos.x - inParent.x;
+ mMouseInRectY = event.mPos.y - inParent.y;
- mpSrcPane = event.mpPane;
+ mpSrcPane = event.mpPane;
- if ( mpDraggedBar->mState == wxCBAR_FLOATING )
+ if ( mpDraggedBar->mState == wxCBAR_FLOATING )
- mpCurPane = NULL;
- else
- mpCurPane = event.mpPane;
+ mpCurPane = NULL;
+ else
+ mpCurPane = event.mpPane;
- mPrevHintRect.x = POS_UNDEFINED;
+ mPrevHintRect.x = POS_UNDEFINED;
- mCanStick = FALSE; // we're not stuck into any pane now -
- // there's nowhere to "stick-twice"
+ mCanStick = false; // we're not stuck into any pane now -
+ // there's nowhere to "stick-twice"
- mBarWidthInSrcPane = mpDraggedBar->mDimInfo.mSizes[ mpDraggedBar->mState ].x;
+ mBarWidthInSrcPane = mpDraggedBar->mDimInfo.mSizes[ mpDraggedBar->mState ].x;
- if ( mpSrcPane->mProps.mRealTimeUpdatesOn == FALSE &&
- mpSrcPane->mProps.mExactDockPredictionOn )
-
- mpLayout->GetUpdatesManager().OnStartChanges(); // capture initial state of layout
-
- // simulate the first mouse movement
+ if ( mpSrcPane->mProps.mRealTimeUpdatesOn == false &&
+ mpSrcPane->mProps.mExactDockPredictionOn )
+ mpLayout->GetUpdatesManager().OnStartChanges(); // capture initial state of layout
- int x = event.mPos.x, y = event.mPos.y;
+ // simulate the first mouse movement
- mpSrcPane->FrameToPane( &x, &y );
+ int x = event.mPos.x, y = event.mPos.y;
- cbMotionEvent motionEvt( wxPoint(x,y), event.mpPane );
+ mpSrcPane->FrameToPane( &x, &y );
+ cbMotionEvent motionEvt( wxPoint(x,y), event.mpPane );
- this->OnMouseMove( motionEvt );
- return; // event is "eaten" by this plugin
+ this->OnMouseMove( motionEvt );
+
+ return; // event is "eaten" by this plugin
}
/*** on-screen hint-tracking related methods ***/
void cbBarDragPlugin::OnDrawHintRect( cbDrawHintRectEvent& event )
{
- if ( !mpScrDc ) StartTracking();
-
- DoDrawHintRect( event.mRect, event.mIsInClient );
+ if ( !mpScrDc ) StartTracking();
- if ( event.mLastTime )
+ DoDrawHintRect( event.mRect, event.mIsInClient );
- FinishTracking();
+ if ( event.mLastTime )
+ FinishTracking();
}
#define _IMG_A 0xAA // Note: modified from _A to _IMG_A, _A was already defined (cygwin)
// FOR NOW:: static
static const unsigned char _gCheckerImg[16] = { _IMG_A,_IMG_B,_IMG_C,_IMG_D,
- _IMG_A,_IMG_B,_IMG_C,_IMG_D,
- _IMG_A,_IMG_B,_IMG_C,_IMG_D,
- _IMG_A,_IMG_B,_IMG_C,_IMG_D
- };
+ _IMG_A,_IMG_B,_IMG_C,_IMG_D,
+ _IMG_A,_IMG_B,_IMG_C,_IMG_D,
+ _IMG_A,_IMG_B,_IMG_C,_IMG_D
+ };
void cbBarDragPlugin::StartTracking()
{
- mpScrDc = new wxScreenDC;
+ mpScrDc = new wxScreenDC;
- wxScreenDC::StartDrawingOnTop(&mpLayout->GetParentFrame());
+ wxScreenDC::StartDrawingOnTop(&mpLayout->GetParentFrame());
}
void cbBarDragPlugin::DoDrawHintRect( wxRect& rect, bool isInClientRect)
{
- wxRect scrRect;
+ wxRect scrRect;
- RectToScr( rect, scrRect );
+ RectToScr( rect, scrRect );
- int prevLF = mpScrDc->GetLogicalFunction();
+ int prevLF = mpScrDc->GetLogicalFunction();
- mpScrDc->SetLogicalFunction( wxINVERT );
+ mpScrDc->SetLogicalFunction( wxINVERT );
- if ( isInClientRect )
- {
- // BUG BUG BUG (wx):: somehow stippled brush works only
- // when the bitmap created on stack, not
- // as a member of the class
+ if ( isInClientRect )
+ {
+ // BUG BUG BUG (wx):: somehow stippled brush works only
+ // when the bitmap created on stack, not
+ // as a member of the class
- wxBitmap checker( (const char*)_gCheckerImg, 8,8 );
+ wxBitmap checker( (const char*)_gCheckerImg, 8,8 );
- wxBrush checkerBrush( checker );
+ wxBrush checkerBrush( checker );
- mpScrDc->SetPen( mpLayout->mNullPen );
- mpScrDc->SetBrush( checkerBrush );
+ mpScrDc->SetPen( mpLayout->mNullPen );
+ mpScrDc->SetBrush( checkerBrush );
- int half = mInClientHintBorder / 2;
+ int half = mInClientHintBorder / 2;
- mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y - half,
- scrRect.width + 2*half, mInClientHintBorder );
+ mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y - half,
+ scrRect.width + 2*half, mInClientHintBorder );
- mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y + scrRect.height - half,
- scrRect.width + 2*half, mInClientHintBorder );
+ mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y + scrRect.height - half,
+ scrRect.width + 2*half, mInClientHintBorder );
- mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y + half - 1,
- mInClientHintBorder, scrRect.height - 2*half + 2);
+ mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y + half - 1,
+ mInClientHintBorder, scrRect.height - 2*half + 2);
- mpScrDc->DrawRectangle( scrRect.x + scrRect.width - half,
- scrRect.y + half - 1,
- mInClientHintBorder, scrRect.height - 2*half + 2);
+ mpScrDc->DrawRectangle( scrRect.x + scrRect.width - half,
+ scrRect.y + half - 1,
+ mInClientHintBorder, scrRect.height - 2*half + 2);
- mpScrDc->SetBrush( wxNullBrush );
- }
- else
- {
- mpScrDc->SetPen( mpLayout->mBlackPen );
+ mpScrDc->SetBrush( wxNullBrush );
+ }
+ else
+ {
+ mpScrDc->SetPen( mpLayout->mBlackPen );
- mpScrDc->DrawLine( scrRect.x, scrRect.y,
- scrRect.x + scrRect.width, scrRect.y );
+ mpScrDc->DrawLine( scrRect.x, scrRect.y,
+ scrRect.x + scrRect.width, scrRect.y );
- mpScrDc->DrawLine( scrRect.x, scrRect.y + 1,
- scrRect.x, scrRect.y + scrRect.height );
+ mpScrDc->DrawLine( scrRect.x, scrRect.y + 1,
+ scrRect.x, scrRect.y + scrRect.height );
- mpScrDc->DrawLine( scrRect.x+1, scrRect.y + scrRect.height,
- scrRect.x + scrRect.width, scrRect.y + scrRect.height );
+ mpScrDc->DrawLine( scrRect.x+1, scrRect.y + scrRect.height,
+ scrRect.x + scrRect.width, scrRect.y + scrRect.height );
- mpScrDc->DrawLine( scrRect.x + scrRect.width , scrRect.y,
- scrRect.x + scrRect.width, scrRect.y + scrRect.height + 1);
- }
+ mpScrDc->DrawLine( scrRect.x + scrRect.width , scrRect.y,
+ scrRect.x + scrRect.width, scrRect.y + scrRect.height + 1);
+ }
- mpScrDc->SetLogicalFunction( prevLF );
+ mpScrDc->SetLogicalFunction( prevLF );
}
void cbBarDragPlugin::DrawHintRect ( wxRect& rect, bool isInClientRect)
{
- DoDrawHintRect( rect, isInClientRect );
+ DoDrawHintRect( rect, isInClientRect );
}
void cbBarDragPlugin::EraseHintRect( wxRect& rect, bool isInClientRect)
{
- DoDrawHintRect( rect, isInClientRect );
+ DoDrawHintRect( rect, isInClientRect );
}
void cbBarDragPlugin::FinishTracking()
{
- wxScreenDC::EndDrawingOnTop();
+ wxScreenDC::EndDrawingOnTop();
- delete mpScrDc;
+ delete mpScrDc;
- mpScrDc = NULL;
+ mpScrDc = NULL;
}
void cbBarDragPlugin::RectToScr( wxRect& frameRect, wxRect& scrRect )
{
- scrRect = frameRect;
+ scrRect = frameRect;
- int x = frameRect.x, y = frameRect.y;
+ int x = frameRect.x, y = frameRect.y;
- mpLayout->GetParentFrame().ClientToScreen( &x, &y );
+ mpLayout->GetParentFrame().ClientToScreen( &x, &y );
- scrRect.x = x;
- scrRect.y = y;
+ scrRect.x = x;
+ scrRect.y = y;
}
cbBarHintsPlugin::cbBarHintsPlugin(void)
: mpPane( 0 ),
- mBtnPressed ( FALSE ),
- mCloseBoxOn ( TRUE ),
- mCollapseBoxOn( TRUE ),
+ mBtnPressed ( false ),
+ mCloseBoxOn ( true ),
+ mCollapseBoxOn( true ),
mGrooveCount ( 2 ),
mHintGap ( 4 ),
mXWeight ( 2 )
: cbPluginBase( pLayout, paneMask ),
mpPane( 0 ),
- mBtnPressed ( FALSE ),
- mCloseBoxOn ( TRUE ),
- mCollapseBoxOn( TRUE ),
+ mBtnPressed ( false ),
+ mCloseBoxOn ( true ),
+ mCollapseBoxOn( true ),
mGrooveCount ( 2 ),
mHintGap ( 5 ),
mXWeight ( 2 )
if ( info.IsExpanded() )
{
- isAtLeft = FALSE;
+ isAtLeft = false;
cbBarInfo* pCur = info.mpPrev;
{
if ( !pCur->IsFixed() )
{
- isAtLeft = TRUE; break;
+ isAtLeft = true; break;
}
pCur = pCur->mpPrev;
wxRect& rect = info.mBoundsInParent;
- if ( info.IsFixed() ) return FALSE;
+ if ( info.IsFixed() ) return false;
int boxOfs, grooveOfs, coord;
}
}
- return FALSE;
+ return false;
}
// handlers for plugin-events
int i;
for ( i = 0; i != BOXES_IN_HINT; ++i )
{
- mBoxes[i]->mPressed = FALSE;
- mBoxes[i]->mWasClicked = FALSE;
+ mBoxes[i]->mPressed = false;
+ mBoxes[i]->mWasClicked = false;
}
for ( i = 0; i != BOXES_IN_HINT; ++i )
{
if ( mBoxes[i]->mPressed )
{
- mBtnPressed = TRUE;
+ mBtnPressed = true;
mpClickedBar = &bar;
return; // event handled
{
if ( i == 0 )
{
- mpLayout->SetBarState( mpClickedBar, wxCBAR_HIDDEN, TRUE );
+ mpLayout->SetBarState( mpClickedBar, wxCBAR_HIDDEN, true );
// Notify bar child window of close event:
if(mpClickedBar->mpBarWnd!=NULL)
mpClickedBar->mpBarWnd->Close();
}
}
- mBtnPressed = FALSE;
+ mBtnPressed = false;
return;
}
else
// Created: 06/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
class cbContextMenuHandler : public wxEvtHandler
{
public:
- cbSimpleCustomizationPlugin* mpBackRef;
+ cbSimpleCustomizationPlugin* mpBackRef;
public:
- void OnMenuCommand( wxCommandEvent& evt );
+ void OnMenuCommand( wxCommandEvent& evt );
- void OnCommandEvents( wxCommandEvent& evt );
+ void OnCommandEvents( wxCommandEvent& evt );
- DECLARE_EVENT_TABLE()
+ DECLARE_EVENT_TABLE()
};
// FIXME:: is this "safe" ?
BEGIN_EVENT_TABLE( cbContextMenuHandler, wxEvtHandler )
- // FIXME:: what is the right range for these ids ? so that they
- // would not collide with user commands?
+ // FIXME:: what is the right range for these ids ? so that they
+ // would not collide with user commands?
- EVT_COMMAND_RANGE( CB_CUSTOMIZE_MENU_FIRST_ITEM_ID,
- CB_CUSTOMIZE_MENU_FIRST_ITEM_ID + 300,
- wxEVT_COMMAND_MENU_SELECTED,
- cbContextMenuHandler::OnCommandEvents )
+ EVT_COMMAND_RANGE( CB_CUSTOMIZE_MENU_FIRST_ITEM_ID,
+ CB_CUSTOMIZE_MENU_FIRST_ITEM_ID + 300,
+ wxEVT_COMMAND_MENU_SELECTED,
+ cbContextMenuHandler::OnCommandEvents )
END_EVENT_TABLE()
void cbContextMenuHandler::OnCommandEvents( wxCommandEvent& evt )
{
- //wxMessageBox("Wowwwww, Yeah!");
+ //wxMessageBox("Wowwwww, Yeah!");
- mpBackRef->OnMenuItemSelected( evt );
+ mpBackRef->OnMenuItemSelected( evt );
}
/***** Implementation for class cbSimpleCustomizationPlugin *****/
BEGIN_EVENT_TABLE( cbSimpleCustomizationPlugin, cbPluginBase )
- EVT_PL_CUSTOMIZE_BAR ( cbSimpleCustomizationPlugin::OnCustomizeBar )
- EVT_PL_CUSTOMIZE_LAYOUT( cbSimpleCustomizationPlugin::OnCustomizeLayout )
+ EVT_PL_CUSTOMIZE_BAR ( cbSimpleCustomizationPlugin::OnCustomizeBar )
+ EVT_PL_CUSTOMIZE_LAYOUT( cbSimpleCustomizationPlugin::OnCustomizeLayout )
END_EVENT_TABLE()
cbSimpleCustomizationPlugin::cbSimpleCustomizationPlugin( wxFrameLayout* pPanel, int paneMask )
- : cbPluginBase( pPanel, paneMask )
+ : cbPluginBase( pPanel, paneMask )
{}
void cbSimpleCustomizationPlugin::OnCustomizeBar( cbCustomizeBarEvent& event )
{
- // ingnore bar customization, treat it
- // as layout-customization...ugly, eh?
+ // ingnore bar customization, treat it
+ // as layout-customization...ugly, eh?
- cbCustomizeLayoutEvent clEvt( event.mClickPos );
+ cbCustomizeLayoutEvent clEvt( event.mClickPos );
- OnCustomizeLayout( clEvt );
+ OnCustomizeLayout( clEvt );
}
void cbSimpleCustomizationPlugin::OnCustomizeLayout( cbCustomizeLayoutEvent& event )
{
- wxString helpStr1 = wxT("Select this item to show the corresponding control bar");
- wxString helpStr2 = wxT("Select this itme to hide the corresponding control bar");
+ wxString helpStr1 = wxT("Select this item to show the corresponding control bar");
+ wxString helpStr2 = wxT("Select this itme to hide the corresponding control bar");
- int id = CB_CUSTOMIZE_MENU_FIRST_ITEM_ID;
+ int id = CB_CUSTOMIZE_MENU_FIRST_ITEM_ID;
- wxMenu* pMenu = new wxMenu();
+ wxMenu* pMenu = new wxMenu();
- BarArrayT& bars = mpLayout->GetBars();
+ BarArrayT& bars = mpLayout->GetBars();
- for( size_t i = 0; i != bars.GetCount(); ++i )
- {
- cbBarInfo& bar = *bars[i];
-
- bool isHidden = ( bar.mState == wxCBAR_HIDDEN );
+ for( size_t i = 0; i != bars.GetCount(); ++i )
+ {
+ cbBarInfo& bar = *bars[i];
- wxString* pHelpStr = ( isHidden ) ? &helpStr1 : &helpStr2;
+ bool isHidden = ( bar.mState == wxCBAR_HIDDEN );
- pMenu->Append( id, bar.mName, *pHelpStr, TRUE );
+ wxString* pHelpStr = ( isHidden ) ? &helpStr1 : &helpStr2;
- pMenu->Check( id, (isHidden == FALSE) );
+ pMenu->Append( id, bar.mName, *pHelpStr, true );
- ++id;
- }
+ pMenu->Check( id, (isHidden == false) );
+
+ ++id;
+ }
// Customization dialog not implemented, so don't show the menu item
#if 0
- pMenu->AppendSeparator();
- pMenu->Append( id, "Customize...", "Show layout customization dialog", FALSE );
+ pMenu->AppendSeparator();
+ pMenu->Append( id, "Customize...", "Show layout customization dialog", false );
#endif
- mCustMenuItemId = id;
+ mCustMenuItemId = id;
- cbContextMenuHandler* pHandler = new cbContextMenuHandler();
- pHandler->mpBackRef = this;
+ cbContextMenuHandler* pHandler = new cbContextMenuHandler();
+ pHandler->mpBackRef = this;
- wxWindow* pFrm = &mpLayout->GetParentFrame();
+ wxWindow* pFrm = &mpLayout->GetParentFrame();
- // FOR NOW FOR NOW:: to work-around wxFrame's (MSW) nasty event-handling bugs!!!
+ // FOR NOW FOR NOW:: to work-around wxFrame's (MSW) nasty event-handling bugs!!!
- wxWindow* pTmpWnd = new wxWindow( pFrm, -1, event.mClickPos, wxSize(0,0) );
+ wxWindow* pTmpWnd = new wxWindow( pFrm, wxID_ANY, event.mClickPos, wxSize(0,0) );
- pMenu->SetEventHandler( pHandler );
+ pMenu->SetEventHandler( pHandler );
- pTmpWnd->PopupMenu( pMenu, 0,0 );
+ pTmpWnd->PopupMenu( pMenu, 0,0 );
- pTmpWnd->Destroy();
+ pTmpWnd->Destroy();
- delete pMenu;
- delete pHandler;
+ delete pMenu;
+ delete pHandler;
- // event is "eaten" by this plugin
+ // event is "eaten" by this plugin
}
void cbSimpleCustomizationPlugin::OnMenuItemSelected( wxCommandEvent& event )
{
- if ( event.GetId() == mCustMenuItemId )
- {
- wxMessageBox(wxT("Customization dialog box is not supported by this plugin yet"));
-
- return;
- }
- else
- {
- cbBarInfo* pBar = mpLayout->GetBars()[ event.GetId() -
- CB_CUSTOMIZE_MENU_FIRST_ITEM_ID
- ];
+ if ( event.GetId() == mCustMenuItemId )
+ {
+ wxMessageBox(wxT("Customization dialog box is not supported by this plugin yet"));
- wxASSERT( pBar ); // DBG::
+ return;
+ }
+ else
+ {
+ cbBarInfo* pBar = mpLayout->GetBars()[ event.GetId() - CB_CUSTOMIZE_MENU_FIRST_ITEM_ID ];
- // "inverse" bar-visibility of the selected bar
+ wxASSERT( pBar ); // DBG::
- int newState;
+ // "inverse" bar-visibility of the selected bar
- if ( pBar->mState == wxCBAR_HIDDEN )
- {
- if ( pBar->mAlignment == -1 )
- {
- pBar->mAlignment = 0; // just remove "-1" marking
- newState = wxCBAR_FLOATING;
- }
- else
- if ( pBar->mAlignment == FL_ALIGN_TOP ||
- pBar->mAlignment == FL_ALIGN_BOTTOM )
+ int newState;
- newState = wxCBAR_DOCKED_HORIZONTALLY;
- else
- newState = wxCBAR_DOCKED_VERTICALLY;
- }
- else
- {
- newState = wxCBAR_HIDDEN;
+ if ( pBar->mState == wxCBAR_HIDDEN )
+ {
+ if ( pBar->mAlignment == -1 )
+ {
+ pBar->mAlignment = 0; // just remove "-1" marking
+ newState = wxCBAR_FLOATING;
+ }
+ else
+ if ( pBar->mAlignment == FL_ALIGN_TOP ||
+ pBar->mAlignment == FL_ALIGN_BOTTOM )
- if ( pBar->mState == wxCBAR_FLOATING )
+ newState = wxCBAR_DOCKED_HORIZONTALLY;
+ else
+ newState = wxCBAR_DOCKED_VERTICALLY;
+ }
+ else
+ {
+ newState = wxCBAR_HIDDEN;
- pBar->mAlignment = -1;
- }
+ if ( pBar->mState == wxCBAR_FLOATING )
- mpLayout->SetBarState( pBar, newState, TRUE );
+ pBar->mAlignment = -1;
+ }
- if ( newState == wxCBAR_FLOATING )
+ mpLayout->SetBarState( pBar, newState, true );
- mpLayout->RepositionFloatedBar( pBar );
- }
+ if ( newState == wxCBAR_FLOATING )
+ mpLayout->RepositionFloatedBar( pBar );
+ }
- // menu-item-selected event is "eaten"
+ // menu-item-selected event is "eaten"
}
else
mpLayout->OnLDblClick( mevent );
- //event.Skip(FALSE);
+ //event.Skip(false);
}
return handled;
mpTopPlugin ( NULL ),
mpCaputesInput( NULL ),
- mClientWndRefreshPending( FALSE ),
- mRecalcPending( TRUE ),
- mCheckFocusWhenIdle( FALSE )
+ mClientWndRefreshPending( false ),
+ mRecalcPending( true ),
+ mCheckFocusWhenIdle( false )
{
CreateCursors();
mpPaneInFocus( NULL ),
mpLRUPane ( NULL ),
- mFloatingOn ( TRUE ),
+ mFloatingOn ( true ),
mpTopPlugin ( NULL ),
mpCaputesInput( NULL ),
- mClientWndRefreshPending( FALSE ),
- mRecalcPending( TRUE ),
- mCheckFocusWhenIdle( FALSE ),
+ mClientWndRefreshPending( false ),
+ mRecalcPending( true ),
+ mCheckFocusWhenIdle( false ),
mpUpdatesMgr( NULL )
{
bool wxFrameLayout::CanReparent()
{
#ifdef __WXMSW__
- return TRUE;
+ return true;
#elif defined (__WXGTK__)
- //return TRUE;
- return FALSE;
+ //return true;
+ return false;
#else
- return FALSE; // reparenting is not yet supported by Motif and others
+ return false; // reparenting is not yet supported by Motif and others
#endif
}
{
HookUpToFrame();
- RefreshNow( TRUE );
+ RefreshNow( true );
- ShowFloatedWindows( TRUE );
+ ShowFloatedWindows( true );
}
void wxFrameLayout::Deactivate()
{
- ShowFloatedWindows( FALSE );
+ ShowFloatedWindows( false );
UnhookFromFrame();
if ( !pToPane )
- return FALSE; // bar's shape does not hit any pane
+ return false; // bar's shape does not hit any pane
// - redocking is NOT possible
cbDockPane* pBarPane = GetBarPane( pBar );
// but first the "pane-postion-changed" problem
// has to be fixed
- RecalcLayout( FALSE );
+ RecalcLayout( false );
pToPane->InsertBar( pBar, shapeInParent );
- RecalcLayout( FALSE );
+ RecalcLayout( false );
// finish update "transaction"
GetUpdatesManager().UpdateNow();
}
- return TRUE;
+ return true;
}
cbBarInfo* wxFrameLayout::FindBarByName( const wxString& name )
GetUpdatesManager().OnStartChanges();
- pBar->mUMgrData.SetDirty(TRUE);
+ pBar->mUMgrData.SetDirty(true);
// check bar's previous state
if ( pBar->mpBarWnd )
{
- pBar->mpBarWnd->Show(FALSE); // to avoid flicker upon reparenting
+ pBar->mpBarWnd->Show(false); // to avoid flicker upon reparenting
wxNode* pNode = mFloatedFrames.GetFirst();
if ( pFFrm->GetBar() == pBar )
{
- pFFrm->Show( FALSE ); // reduces flicker sligthly
+ pFFrm->Show( false ); // reduces flicker sligthly
ReparentWindow( pBar->mpBarWnd, &GetParentFrame() );
mFloatedFrames.DeleteNode( pNode );
- pFFrm->Show( FALSE );
+ pFFrm->Show( false );
pFFrm->Destroy(); break;
}
// FOR NOW:: excessive!
//if ( mpFrameClient ) mpFrameClient->Refresh();
if ( mpFrameClient )
- mClientWndRefreshPending = TRUE;
+ mClientWndRefreshPending = true;
}
}
if ( updateNow )
{
- RecalcLayout(FALSE);
+ RecalcLayout(false);
GetUpdatesManager().OnFinishChanges();
GetUpdatesManager().UpdateNow();
pBar->mAlignment = -1;
}
- this->SetBarState( pBar, newState, TRUE );
+ this->SetBarState( pBar, newState, true );
if ( newState == wxCBAR_FLOATING )
if ( pBar->mpBarWnd )
- pBar->mpBarWnd->Show( FALSE );
+ pBar->mpBarWnd->Show( false );
}
else
{
if ( pBar->mpBarWnd )
- pBar->mpBarWnd->Show( FALSE );
+ pBar->mpBarWnd->Show( false );
pBar->mState = wxCBAR_HIDDEN;
pMiniFrm->SetBar( pBar );
pMiniFrm->SetLayout( this );
- pMiniFrm->Create( &GetParentFrame(), -1, pBar->mName,
+ pMiniFrm->Create( &GetParentFrame(), wxID_ANY, pBar->mName,
wxPoint( 50,50 ),
wxSize ( 0, 0 ),
wxFRAME_FLOAT_ON_PARENT |
mNextFloatedWndPos.y += mFloatingPosStep.y;
}
- pMiniFrm->Show( TRUE );
+ pMiniFrm->Show( true );
// FIXME:: this is excessive
- pBar->mpBarWnd->Show(TRUE);
+ pBar->mpBarWnd->Show(true);
}
}
#endif
if ( pBarInfo->mpBarWnd ) // hides it's window
- pBarInfo->mpBarWnd->Show( FALSE );
+ pBarInfo->mpBarWnd->Show( false );
delete pBarInfo;
(*ppPane) = mPanes[n];
(*ppRow ) = &i.RowInfo();
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
void wxFrameLayout::RecalcLayout( bool repositionBarsNow )
{
- mRecalcPending = FALSE;
+ mRecalcPending = false;
int frmWidth, frmHeight;
mpFrame->GetClientSize( &frmWidth, &frmHeight );
if ( !mpFrameClient->IsShown() )
- mpFrameClient->Show( TRUE );
+ mpFrameClient->Show( true );
}
else
- mpFrameClient->Show( FALSE );
+ mpFrameClient->Show( false );
}
}
void wxFrameLayout::OnSize( wxSizeEvent& event )
{
mpFrame->ProcessEvent( event );
- event.Skip( FALSE ); // stop its progpagation
+ event.Skip( false ); // stop its progpagation
if ( event.GetEventObject() == (wxObject*) mpFrame )
{
GetUpdatesManager().OnStartChanges();
- RecalcLayout(TRUE);
+ RecalcLayout(true);
GetUpdatesManager().OnFinishChanges();
GetUpdatesManager().UpdateNow();
}
size_t i;
for ( i = 0; i != mAllBars.Count(); ++i )
if ( mAllBars[i]->mpBarWnd && mAllBars[i]->mState != wxCBAR_FLOATING )
- mAllBars[i]->mpBarWnd->Show( FALSE );
+ mAllBars[i]->mpBarWnd->Show( false );
// then floated frames
- ShowFloatedWindows( FALSE );
+ ShowFloatedWindows( false );
if ( mpFrameClient )
- mpFrameClient->Show( FALSE );
+ mpFrameClient->Show( false );
}
void wxFrameLayout::UnhookFromFrame()
void wxFrameLayout::OnPaint( wxPaintEvent& event )
{
if ( mRecalcPending )
- RecalcLayout( TRUE );
+ RecalcLayout( true );
wxPaintDC dc(mpFrame);
{
wxMessageBox(wxT("Hi, no more focus in this app!"));
- mCheckFocusWhenIdle = FALSE;
- //ShowFloatedWindows( FALSE );
+ mCheckFocusWhenIdle = false;
+ //ShowFloatedWindows( false );
}
- mCheckFocusWhenIdle = FALSE;
+ mCheckFocusWhenIdle = false;
event.Skip();
}
void wxFrameLayout::OnKillFocus( wxFocusEvent& WXUNUSED(event) )
{
//wxMessageBox( "wxFrameLayoutGot Kill Focus!" );
- //ShowFloatedWindows( FALSE );
+ //ShowFloatedWindows( false );
}
void wxFrameLayout::OnSetFocus( wxFocusEvent& WXUNUSED(event) )
{
- //ShowFloatedWindows( TRUE );
+ //ShowFloatedWindows( true );
}
void wxFrameLayout::OnActivate( wxActivateEvent& WXUNUSED(event) )
{
#if 0
- if ( event.GetActive() == FALSE )
+ if ( event.GetActive() == false )
{
wxWindow* focus = wxWindow::FindFocus();
if ( !focus || focus == &GetParentFrame() )
{
- mCheckFocusWhenIdle = TRUE;
+ mCheckFocusWhenIdle = true;
if ( !focus )
void wxFrameLayout::RefreshNow( bool recalcLayout )
{
if ( recalcLayout )
- RecalcLayout( TRUE );
+ RecalcLayout( true );
if ( mpFrame )
mpFrame->Refresh();
if ( mpCaputesInput )
{
- bool isInputEvt = TRUE;
+ bool isInputEvt = true;
#if wxCHECK_VERSION(2,3,0)
if ( event.m_eventType != cbEVT_PL_LEFT_DOWN &&
event.m_eventType != cbEVT_PL_LEFT_UP &&
event.m_eventType != cbEVT_PL_RIGHT_DOWN &&
event.m_eventType != cbEVT_PL_RIGHT_UP &&
event.m_eventType != cbEVT_PL_MOTION )
- isInputEvt = FALSE;
+ isInputEvt = false;
#else
switch ( event.m_eventType )
{
case cbEVT_PL_RIGHT_UP : break;
case cbEVT_PL_MOTION : break;
- default : isInputEvt = FALSE; break;
+ default : isInputEvt = false; break;
}
#endif // #if wxCHECK_VERSION(2,3,0)
cbUpdateMgrData::cbUpdateMgrData()
: mPrevBounds( -1,-1,0,0 ),
- mIsDirty( TRUE ) // inidicate initial change
+ mIsDirty( true ) // inidicate initial change
{}
void cbUpdateMgrData::StoreItemState( const wxRect& boundsInParent )
{
if ( mpRow->mBars.GetCount() == 0 )
{
- return FALSE;
+ return false;
}
mpBar = mpRow->mBars[0];
mpBar = mpRow->mBars[0];
else
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
cbBarInfo& wxBarIterator::BarInfo()
: mVertGap ( 0 ),
mHorizGap( 0 ),
- mIsFixed(TRUE),
+ mIsFixed(true),
mpHandler( NULL )
{
size_t i;
cbCommonPaneProperties::cbCommonPaneProperties(void)
- : mRealTimeUpdatesOn ( TRUE ),
- mOutOfPaneDragOn ( TRUE ),
- mExactDockPredictionOn( FALSE ),
- mNonDestructFrictionOn( FALSE ),
- mShow3DPaneBorderOn ( TRUE ),
- mBarFloatingOn ( FALSE ),
- mRowProportionsOn ( FALSE ),
- mColProportionsOn ( TRUE ),
- mBarCollapseIconsOn ( FALSE ),
- mBarDragHintsOn ( FALSE ),
+ : mRealTimeUpdatesOn ( true ),
+ mOutOfPaneDragOn ( true ),
+ mExactDockPredictionOn( false ),
+ mNonDestructFrictionOn( false ),
+ mShow3DPaneBorderOn ( true ),
+ mBarFloatingOn ( false ),
+ mRowProportionsOn ( false ),
+ mColProportionsOn ( true ),
+ mBarCollapseIconsOn ( false ),
+ mBarDragHintsOn ( false ),
mMinCBarDim( 16, 16 ),
mResizeHandleSize( 4 )
cbRowInfo::cbRowInfo(void)
- : mNotFixedBarsCnt( FALSE ),
+ : mNotFixedBarsCnt( false ),
mpNext ( NULL ),
mpPrev ( NULL ),
mpExpandedBar ( NULL )
cbBarInfo::cbBarInfo(void)
: mpRow( NULL ),
- mFloatingOn( TRUE ),
+ mFloatingOn( true ),
mpNext( NULL ),
mpPrev( NULL )
{}
for ( i = 0; i != mRows.Count(); ++i )
delete mRows[i];
- mRowShapeData.DeleteContents( TRUE );
+ mRowShapeData.DeleteContents( true );
// NOTE:: control bar infromation structures are cleaned-up
// in wxFrameLayout's destructor, using global control-bar list
void cbDockPane::SyncRowFlags( cbRowInfo* pRow )
{
// setup mHasOnlyFixedBars flag for the row information
- pRow->mHasOnlyFixedBars = TRUE;
+ pRow->mHasOnlyFixedBars = true;
pRow->mNotFixedBarsCnt = 0;
if ( !bar.IsFixed() )
{
- pRow->mHasOnlyFixedBars = FALSE;
+ pRow->mHasOnlyFixedBars = false;
++pRow->mNotFixedBarsCnt;
}
}
if ( pRow->mHasOnlyFixedBars )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool cbDockPane::HasNotFixedRowsBelow( cbRowInfo* pRow )
if ( pRow->mHasOnlyFixedBars )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool cbDockPane::HasNotFixedBarsLeft( cbBarInfo* pBar )
if ( pBar->IsFixed() )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool cbDockPane::HasNotFixedBarsRight( cbBarInfo* pBar )
if ( pBar->IsFixed() )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void cbDockPane::CalcLengthRatios( cbRowInfo* pInRow )
pBar->mpRow->mpExpandedBar = pBar;
- mpLayout->RecalcLayout( FALSE );
+ mpLayout->RecalcLayout( false );
mpLayout->GetUpdatesManager().OnFinishChanges();
mpLayout->GetUpdatesManager().UpdateNow();
pBar->mpRow->mpExpandedBar = NULL;
- mpLayout->RecalcLayout( FALSE );
+ mpLayout->RecalcLayout( false );
mpLayout->GetUpdatesManager().OnFinishChanges();
mpLayout->GetUpdatesManager().UpdateNow();
{
pRow = mRows[rowNo];
- if ( mProps.mNonDestructFrictionOn == TRUE )
+ if ( mProps.mNonDestructFrictionOn == true )
{
// store original shape of the row (before the bar is inserted)
// set transient properties
pBarInfo->mpRow = NULL;
- pBarInfo->mHasLeftHandle = FALSE;
- pBarInfo->mHasRightHandle = FALSE;
+ pBarInfo->mHasLeftHandle = false;
+ pBarInfo->mHasRightHandle = false;
pBarInfo->mLenRatio = 0.0;
// set preferred bar dimensions, according to the state in which
for ( i = 0; i != pRow->mBars.Count(); ++i )
{
if ( pRow->mBars[i]->mpBarWnd )
- pRow->mBars[i]->mpBarWnd->Show( FALSE );
+ pRow->mBars[i]->mpBarWnd->Show( false );
}
mRows.Remove( pRow );
- pRow->mUMgrData.SetDirty(TRUE);
+ pRow->mUMgrData.SetDirty(true);
}
void cbDockPane::InsertRow( cbRowInfo* pRow, cbRowInfo* pBeforeRow )
InitLinksForRows();
- pRow->mUMgrData.SetDirty(TRUE);
+ pRow->mUMgrData.SetDirty(true);
size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
- pRow->mBars[i]->mUMgrData.SetDirty( TRUE );
+ pRow->mBars[i]->mUMgrData.SetDirty( true );
SyncRowFlags( pRow );
}
while( iter.Next() )
- if ( &iter.BarInfo() == pBar ) return TRUE;
+ if ( &iter.BarInfo() == pBar ) return true;
- return FALSE;
+ return false;
}
cbRowInfo* cbDockPane::GetRow( int row )
InsertBar( pBar, pToRow );
- mpLayout->RecalcLayout(FALSE);
+ mpLayout->RecalcLayout(false);
mpLayout->GetUpdatesManager().OnFinishChanges();
mpLayout->GetUpdatesManager().UpdateNow();
void cbDockPane::GetRowShapeData( cbRowInfo* pRow, wxList* pLst )
{
- pLst->DeleteContents( TRUE );
+ pLst->DeleteContents( true );
pLst->Clear();
size_t i;
if ( GetNextHandler() && GetNextHandler()->ProcessEvent( event ) )
- return TRUE;
+ return true;
else
- return FALSE;
+ return false;
}
// Created: ??/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows license
+// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// cut&pasted from wxtbatsmpl.h
if ( ! wxWindow::Create(parent, id, pos, size, style, name) )
- return FALSE;
+ return false;
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ));
- return TRUE;
+ return true;
}
bool wxDynamicToolBar::Realize(void)
{
// FOR NOW:: nothing
- return TRUE;
+ return true;
}
wxDynamicToolBar::~wxDynamicToolBar(void)
pInfo->mpToolWnd = pToolWindow;
pInfo->mIndex = toolIndex;
- pInfo->mIsSeparator = FALSE;
+ pInfo->mIsSeparator = false;
int x,y;
pToolWindow->GetSize( &x, &y );
pInfo->mpToolWnd = pSepartorWnd;
pInfo->mIndex = -1;
- pInfo->mIsSeparator = TRUE;
+ pInfo->mIsSeparator = true;
// Do we draw a separator or is a other object?
if ( pSepartorWnd )
void wxDynamicToolBar::SizeToolWindows()
{
- bool bStateCheckDone = FALSE;
- bool bHorzSeparator = FALSE;
+ bool bStateCheckDone = false;
+ bool bHorzSeparator = false;
int maxWidth = 0;
int maxHeight = 0;
// separators and we do it only once (all to do with performance...)
if (!bStateCheckDone)
{
- bStateCheckDone = TRUE;
+ bStateCheckDone = true;
size_t j;
wxDynToolInfo *pInfo;
GetPreferredDim( wndDim, result );
SizeToolWindows();
- return TRUE;
+ return true;
}
void wxDynamicToolBar::GetPreferredDim( const wxSize& givenDim, wxSize& prefDim )
bool wxDynamicToolBar::DoInsertTool( size_t WXUNUSED(pos), wxToolBarToolBase* WXUNUSED(tool) )
{
- return TRUE;
+ return true;
}
bool wxDynamicToolBar::DoDeleteTool( size_t WXUNUSED(pos), wxToolBarToolBase* WXUNUSED(tool) )
{
- return TRUE;
+ return true;
}
void wxDynamicToolBar::DoEnableTool( wxToolBarToolBase* WXUNUSED(tool), bool WXUNUSED(enable) )
void wxFrameView::CreateLayout()
{
- mpLayout = new wxFrameLayout( GetParentFrame(), mpFrameMgr->GetClientWindow(), FALSE );
+ mpLayout = new wxFrameLayout( GetParentFrame(), mpFrameMgr->GetClientWindow(), false );
}
wxFrameLayout* wxFrameView::GetLayout()
{
if ( i != mActiveViewNo )
- EnableMenusForView( (wxFrameView*)pNode->GetData(), FALSE );
+ EnableMenusForView( (wxFrameView*)pNode->GetData(), false );
pNode = pNode->GetNext();
}
- EnableMenusForView( GetView( mActiveViewNo ), TRUE );
+ EnableMenusForView( GetView( mActiveViewNo ), true );
}
/*** public methods ***/
GetParentFrame()->PushEventHandler( pFrmView );
- EnableMenusForView( pFrmView, TRUE );
+ EnableMenusForView( pFrmView, true );
}
void wxFrameManager::SetClinetWindow( wxWindow* pFrameClient )
if ( pView->mpLayout )
pView->mpLayout->Deactivate();
- EnableMenusForView( pView, FALSE );
+ EnableMenusForView( pView, false );
}
void wxFrameManager::SaveViewsNow()
bool wxFrameManager::ReloadViews()
{
- return FALSE;
+ return false;
// TBD: ????
#if 0
if ( mSettingsFile == "" || !wxFileExists( mSettingsFile ) )
- return FALSE;
+ return false;
DestroyViews();
mStore.SetDataStream( stm );
DoSerialize( mStore );
- return TRUE;
+ return true;
#endif
}
// Created: 19/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// store pane state
pane.mUMgrData.StoreItemState( pane.mBoundsInParent );
- pane.mUMgrData.SetDirty( FALSE );
+ pane.mUMgrData.SetDirty( false );
cbRowInfo* pRow = pane.GetFirstRow();
// store row state
pRow->mUMgrData.StoreItemState( pRow->mBoundsInParent );
- pRow->mUMgrData.SetDirty( FALSE );
+ pRow->mUMgrData.SetDirty( false );
while( pBar )
{
// store bar state
pBar->mUMgrData.StoreItemState( pBar->mBoundsInParent );
- pBar->mUMgrData.SetDirty( FALSE );
+ pBar->mUMgrData.SetDirty( false );
pBar = pBar->mpNext;
}
cbBarInfo* pBar = pRow->GetFirstBar();
- bool rowChanged = FALSE;
-// bool rowBkPainted = FALSE;
+ bool rowChanged = false;
+// bool rowBkPainted = false;
// FIXME:: the below should not be fixed
cbBarInfo* barsToRepaint[128];
if ( WasChanged( pRow->mUMgrData, pRow->mBoundsInParent ) )
- rowChanged = TRUE;
+ rowChanged = true;
else
while( pBar )
{
// FIXME FIXME:: excessive!
- pClntWnd->Show( FALSE );
- pClntWnd->Show( TRUE );
+ pClntWnd->Show( false );
+ pClntWnd->Show( true );
// OLD STUFF:: mpLayout->PositionClientWindow();
}
// FIXME FIXME:: there's no other way to repaint non-client area of the wxWindow!!
// so we do *excessive* "hide 'n show"
- pWnd->Show(FALSE);
- pWnd->Show(TRUE);
+ pWnd->Show(false);
+ pWnd->Show(true);
pWnd->Refresh();
}
// Created: 9/11/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows license
+// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
: mpScrDc( NULL ),
mpAnimTimer( 0 ),
- mAnimStarted( FALSE ),
+ mAnimStarted( false ),
mMorphDelay ( 5 ),
mMaxFrames ( 20 ),
mInClientHintBorder( 4 ),
- mAccelerationOn( TRUE )
+ mAccelerationOn( true )
{}
cbHintAnimationPlugin::cbHintAnimationPlugin( wxFrameLayout* pPanel, int paneMask )
: cbPluginBase( pPanel, paneMask ),
mpScrDc( NULL ),
mpAnimTimer( 0 ),
- mAnimStarted( FALSE ),
+ mAnimStarted( false ),
mMorphDelay ( 5 ),
mMaxFrames ( 20 ),
mInClientHintBorder( 4 ),
- mAccelerationOn( TRUE )
+ mAccelerationOn( true )
{}
cbHintAnimationPlugin::~cbHintAnimationPlugin()
mPrevRect = event.mRect;
- mStopPending = FALSE;
+ mStopPending = false;
}
if ( !event.mEraseRect )
mpAnimTimer->Init( this, mAnimStarted );
- mAnimStarted = TRUE;
+ mAnimStarted = true;
}
else
if ( !mAnimStarted )
if ( event.mLastTime && mpAnimTimer )
{
- mStopPending = TRUE;
+ mStopPending = true;
if ( mpAnimTimer->mPrevMorphed.x != POS_UNDEFINED )
mpPl->FinishTracking();
- mpPl->mStopPending = FALSE;
+ mpPl->mStopPending = false;
mpPl->mpAnimTimer = NULL;
- mpPl->mAnimStarted = FALSE;
+ mpPl->mAnimStarted = false;
mPrevMorphed.x = POS_UNDEFINED;
mpPl->FinishTracking();
mpPl->mpAnimTimer = NULL;
- mpPl->mAnimStarted = FALSE;
+ mpPl->mAnimStarted = false;
mPrevMorphed.x = POS_UNDEFINED;
Start( mpPl->mMorphDelay );
- return TRUE;
+ return true;
}
mpFocusedImg ( NULL ),
- mDragStarted ( FALSE ),
- mIsPressed ( FALSE ),
- mIsInFocus ( FALSE ),
- mIsToggled ( FALSE ),
- mHasFocusedBmp( FALSE ),
+ mDragStarted ( false ),
+ mIsPressed ( false ),
+ mIsInFocus ( false ),
+ mIsToggled ( false ),
+ mHasFocusedBmp( false ),
mFiredEventType( firedEventType ),
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mLightPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
- mIsCreated( FALSE ),
- mSizeIsSet( FALSE )
+ mIsCreated( false ),
+ mSizeIsSet( false )
{
}
mMarginX( 2 ),
mMarginY( 2 ),
mTextAlignment( alignText ),
- mIsSticky( FALSE ),
+ mIsSticky( false ),
mIsFlat( isFlat ),
mLabelText( labelText ),
mImageFileName( bitmapFileName ),
mpDisabledImg ( NULL ),
mpFocusedImg ( NULL ),
- mDragStarted ( FALSE ),
- mIsPressed ( FALSE ),
- mIsInFocus ( FALSE ),
- mIsToggled ( FALSE ),
- mHasFocusedBmp( FALSE ),
+ mDragStarted ( false ),
+ mIsPressed ( false ),
+ mIsInFocus ( false ),
+ mIsToggled ( false ),
+ mHasFocusedBmp( false ),
mFiredEventType( wxEVT_COMMAND_MENU_SELECTED ),
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mLightPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
- mIsCreated( FALSE ),
- mSizeIsSet( FALSE )
+ mIsCreated( false ),
+ mSizeIsSet( false )
{
}
destDc.Blit( imgPos.x, imgPos.y,
srcBmp->GetWidth()+1,
srcBmp->GetHeight()+1,
- &srcDc, 0,0, wxCOPY,TRUE );
+ &srcDc, 0,0, wxCOPY,true );
}
if ( hasText )
// adjust button size to fit the new dimensions of the label
if ( !mSizeIsSet && 0 )
{
- mSizeIsSet = TRUE;
- SetSize( -1,-1,
+ mSizeIsSet = true;
+ SetSize( wxDefaultPosition.x,wxDefaultPosition.y,
destBmp->GetWidth() + mMarginX*2,
destBmp->GetHeight() + mMarginY*2, 0
);
{
if ( !mIsCreated )
return;
- RenderLabelImage( mpDisabledImg, &mDepressedBmp, FALSE );
- RenderLabelImage( mpPressedImg, &mDepressedBmp, TRUE, TRUE );
- RenderLabelImage( mpDepressedImg, &mDepressedBmp, TRUE, FALSE );
+ RenderLabelImage( mpDisabledImg, &mDepressedBmp, false );
+ RenderLabelImage( mpPressedImg, &mDepressedBmp, true, true );
+ RenderLabelImage( mpDepressedImg, &mDepressedBmp, true, false );
if ( mHasFocusedBmp )
{
- RenderLabelImage( mpFocusedImg, &mFocusedBmp, TRUE, FALSE );
+ RenderLabelImage( mpFocusedImg, &mFocusedBmp, true, false );
}
}
if ( !IsEnabled() )
{
- RenderLabelImage( mpDisabledImg, &mDepressedBmp, FALSE );
+ RenderLabelImage( mpDisabledImg, &mDepressedBmp, false );
}
else
if ( mIsPressed )
- RenderLabelImage( mpPressedImg, &mDepressedBmp, TRUE, TRUE );
+ RenderLabelImage( mpPressedImg, &mDepressedBmp, true, true );
else
{
if ( mIsInFocus )
{
if ( mHasFocusedBmp )
- RenderLabelImage( mpFocusedImg, &mFocusedBmp, TRUE, FALSE );
+ RenderLabelImage( mpFocusedImg, &mFocusedBmp, true, false );
else
- RenderLabelImage( mpDepressedImg, &mDepressedBmp, TRUE, FALSE );
+ RenderLabelImage( mpDepressedImg, &mDepressedBmp, true, false );
}
else
- RenderLabelImage( mpDepressedImg, &mDepressedBmp, TRUE, FALSE );
+ RenderLabelImage( mpDepressedImg, &mDepressedBmp, true, false );
}
}
{
if ( mIsToggled == enable )
{
- return FALSE;
+ return false;
}
mIsToggled = enable;
Refresh();
- return TRUE;
+ return true;
}
bool wxNewBitmapButton::Enable(bool enable)
{
if ( mIsInFocus )
{
- mIsInFocus = FALSE;
+ mIsInFocus = false;
}
if ( mIsPressed )
{
- mIsPressed = FALSE;
+ mIsPressed = false;
}
Refresh();
void wxNewBitmapButton::OnLButtonDown( wxMouseEvent& WXUNUSED(event) )
{
- mDragStarted = TRUE;
- mIsPressed = TRUE;
+ mDragStarted = true;
+ mIsPressed = true;
Refresh();
}
if ( !mDragStarted )
return;
- mDragStarted = FALSE;
- mIsPressed = FALSE;
+ mDragStarted = false;
+ mIsPressed = false;
Refresh();
if ( IsInWindow( event.m_x, event.m_y ) )
if ( !mIsInFocus )
{
- mIsInFocus = TRUE;
+ mIsInFocus = true;
}
if ( prevIsInFocus != mIsInFocus )
{
bool prevIsPressed = mIsPressed;
if ( mIsInFocus )
{
- mIsInFocus = FALSE;
- mIsPressed = FALSE;
+ mIsInFocus = false;
+ mIsPressed = false;
}
if ( prevIsInFocus != mIsInFocus || prevIsPressed != mIsPressed )
{
void wxNewBitmapButton::Reshape( )
{
bool wasCreated = mIsCreated;
- mIsCreated = TRUE;
+ mIsCreated = true;
if ( !wasCreated )
{
// Created: 06/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
cbPaneDrawPlugin::cbPaneDrawPlugin(void)
- : mResizeStarted ( FALSE ),
+ : mResizeStarted ( false ),
- mResizeCursorOn ( FALSE ),
+ mResizeCursorOn ( false ),
mpDraggedBar ( NULL ),
mpResizedRow ( NULL ),
- mRowHandleHitted ( FALSE ),
- mIsUpperHandle ( FALSE ),
- mBarHandleHitted ( FALSE ),
- mIsLeftHandle ( FALSE ),
- mBarContentHitted ( FALSE ),
+ mRowHandleHitted ( false ),
+ mIsUpperHandle ( false ),
+ mBarHandleHitted ( false ),
+ mIsLeftHandle ( false ),
+ mBarContentHitted ( false ),
mpClntDc ( NULL ),
mpPane ( NULL )
// bar-row resizing state varaibles
- mResizeStarted ( FALSE ),
+ mResizeStarted ( false ),
- mResizeCursorOn ( FALSE ),
+ mResizeCursorOn ( false ),
mpDraggedBar ( NULL ),
mpResizedRow ( NULL ),
- mRowHandleHitted ( FALSE ),
- mIsUpperHandle ( FALSE ),
- mBarHandleHitted ( FALSE ),
- mIsLeftHandle ( FALSE ),
- mBarContentHitted ( FALSE ),
+ mRowHandleHitted ( false ),
+ mIsUpperHandle ( false ),
+ mBarHandleHitted ( false ),
+ mIsLeftHandle ( false ),
+ mBarContentHitted ( false ),
mpClntDc ( NULL ),
mpPane ( NULL )
bool prevWasRowHandle = mRowHandleHitted;
- mBarContentHitted = FALSE;
- mBarHandleHitted = FALSE;
- mRowHandleHitted = FALSE;
+ mBarContentHitted = false;
+ mBarHandleHitted = false;
+ mRowHandleHitted = false;
int testResult =
event.mpPane->HitTestPaneItems( event.mPos, // in pane's coordiantes
mpLayout->ReleaseEventsFromPane( event.mpPane );
mpLayout->ReleaseEventsFromPlugin( this );
- mResizeCursorOn = FALSE;
+ mResizeCursorOn = false;
- mBarContentHitted = TRUE;
+ mBarContentHitted = true;
// In Windows, at least, the frame needs to have a null cursor
// else child windows (such as text windows) inherit the cursor
else
pCurs = mpLayout->mpHorizCursor;
- mRowHandleHitted = TRUE;
+ mRowHandleHitted = true;
mIsUpperHandle = ( testResult == CB_UPPER_ROW_HANDLE_HITTED );
}
else
else
pCurs = mpLayout->mpVertCursor;
- mBarHandleHitted = TRUE;
+ mBarHandleHitted = true;
mIsLeftHandle = ( testResult == CB_LEFT_BAR_HANDLE_HITTED );
}
mpLayout->GetParentFrame().SetCursor( *pCurs );
}
- mResizeCursorOn = TRUE;
+ mResizeCursorOn = true;
// handled is being dragged now, thus event is "eaten" by this plugin
mpLayout->GetParentFrame().SetCursor( *mpLayout->mpNormalCursor );
#endif
- mResizeCursorOn = FALSE;
+ mResizeCursorOn = false;
}
event.Skip(); // pass event to the next plugin
if ( mResizeCursorOn )
{
- mResizeStarted = TRUE;
+ mResizeStarted = true;
mDragOrigin = event.mPos;
// setup constraints for the dragging handle
int from, till;
mHandleOfs = 0;
- mHandleIsVertical = FALSE;
+ mHandleIsVertical = false;
if ( mRowHandleHitted )
if ( mRowHandleHitted )
{
- mHandleIsVertical = ( event.mpPane->IsHorizontal() ) ? FALSE : TRUE;
+ mHandleIsVertical = ( event.mpPane->IsHorizontal() ) ? false : true;
mHandleDragArea.x = 0;
mHandleDragArea.width = event.mpPane->mPaneWidth;
// cbRowInfo& rowInfo = *mpDraggedBar->mpRow;
wxRect& bounds = mpDraggedBar->mBounds;
- mHandleIsVertical = ( event.mpPane->IsHorizontal() ) ? TRUE : FALSE;
+ mHandleIsVertical = ( event.mpPane->IsHorizontal() ) ? true : false;
mHandleDragArea.x = from;
mHandleDragArea.width = till - from;
{
DrawDraggedHandle( event.mPos, *event.mpPane );
- mResizeStarted = FALSE;
- mResizeCursorOn = FALSE;
+ mResizeStarted = false;
+ mResizeCursorOn = false;
mpLayout->ReleaseEventsFromPane( event.mpPane );
mpLayout->ReleaseEventsFromPlugin( this );
if ( !bar.mpBarWnd->IsShown() )
- bar.mpBarWnd->Show( TRUE );
+ bar.mpBarWnd->Show( true );
}
else
// hide bar if not visible
- bar.mpBarWnd->Show( FALSE );
+ bar.mpBarWnd->Show( false );
event.Skip(); // pass event to the next plugin in the chain
}
// Created: 06/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
mTrianInnerColor ( 0,0,255 ),
mTrianInnerPen ( mTrianInnerColor, 1, wxSOLID ),
- mDragStarted ( FALSE ),
- mDecisionMode ( FALSE ),
+ mDragStarted ( false ),
+ mDecisionMode ( false ),
mCurDragOfs ( 0 ),
- mCaptureIsOn ( FALSE ),
+ mCaptureIsOn ( false ),
mSvTopMargin ( -1 ),
mSvBottomMargin ( -1 ),
mSvLeftMargin ( -1 ),
mTrianInnerColor ( 0,0,255 ),
mTrianInnerPen ( mTrianInnerColor, 1, wxSOLID ),
- mDragStarted ( FALSE ),
- mDecisionMode ( FALSE ),
+ mDragStarted ( false ),
+ mDecisionMode ( false ),
mCurDragOfs ( 0 ),
- mCaptureIsOn ( FALSE ),
+ mCaptureIsOn ( false ),
mSvTopMargin ( -1 ),
mSvBottomMargin ( -1 ),
mSvLeftMargin ( -1 ),
//wxPoint drg = mDragOrigin;
//int dif = event.mPos.x - mDragOrigin.x;
- mDragStarted = TRUE;
- mDecisionMode = FALSE;
+ mDragStarted = true;
+ mDecisionMode = false;
mDragOrigin = pos;
PrepareForRowDrag();
cbRowInfo* pRow = GetFirstRow();
- bool focusFound = FALSE;
+ bool focusFound = false;
while( pRow )
{
if ( HitTestRowDragHint( pRow, pos ) )
{
CheckPrevItemInFocus( pRow, -1 );
- SetMouseCapture( TRUE );
+ SetMouseCapture( true );
- focusFound = TRUE;
+ focusFound = true;
mpRowInFocus = pRow;
mCollapsedIconInFocus = -1;
if ( HitTestCollapsedRowIcon( i, pos ) )
{
CheckPrevItemInFocus( NULL, i );
- SetMouseCapture( TRUE );
+ SetMouseCapture( true );
- focusFound = TRUE;
+ focusFound = true;
mCollapsedIconInFocus = i;
mpRowInFocus = NULL;
mpRowInFocus = NULL;
mCollapsedIconInFocus = -1;
- SetMouseCapture( FALSE );
+ SetMouseCapture( false );
}
if ( !ItemIsInFocus() )
if ( ItemIsInFocus() )
{
- mDecisionMode = TRUE;
+ mDecisionMode = true;
wxPoint pos = event.mPos;
mpPane->PaneToFrame( &pos.x, &pos.y );
mDragOrigin = pos;
- SetMouseCapture( TRUE );
+ SetMouseCapture( true );
}
else
// propagate event to other plugins
{
cbDockPane* pPane = mpPane;
- SetMouseCapture( FALSE );
+ SetMouseCapture( false );
- mDecisionMode = FALSE;
- mDragStarted = FALSE;
+ mDecisionMode = false;
+ mDragStarted = false;
wxPoint frmPos = event.mPos;
pPane->PaneToFrame( &frmPos.x, &frmPos.y );
mpLayout->GetUpdatesManager().OnStartChanges();
- pRow->mUMgrData.SetDirty(TRUE);
+ pRow->mUMgrData.SetDirty(true);
cbBarInfo* pBar = mpRowInFocus->mBars[0];
while ( pBar )
{
- pBar->mUMgrData.SetDirty(TRUE);
+ pBar->mUMgrData.SetDirty(true);
if ( pBar->mpBarWnd )
{
// do complete refresh
- pBar->mpBarWnd->Show(FALSE);
- pBar->mpBarWnd->Show(TRUE);
+ pBar->mpBarWnd->Show(false);
+ pBar->mpBarWnd->Show(true);
}
pBar = pBar->mpNext;
mpRowInFocus = NULL;
- mpLayout->RecalcLayout(FALSE);
+ mpLayout->RecalcLayout(false);
// finish change "transaction"
mpLayout->GetUpdatesManager().OnFinishChanges();
mpLayout->GetUpdatesManager().UpdateNow();
// finish drag action
- SetMouseCapture( FALSE );
- mDragStarted = FALSE;
+ SetMouseCapture( false );
+ mDragStarted = false;
}
}
// first, let other plugins add their decorations now
GetNextHandler()->ProcessEvent( event );
- event.Skip(FALSE);
+ event.Skip(false);
}
wxClientDC dc( &mpLayout->GetParentFrame() );
while( pRow )
{
- DrawRowDragHint( pRow, dc, FALSE );
+ DrawRowDragHint( pRow, dc, false );
pRow = pRow->mpNext;
}
for( int i = 0; i != cnt; ++i )
- DrawCollapsedRowIcon(i, dc, FALSE );
+ DrawCollapsedRowIcon(i, dc, false );
}
int cbRowDragPlugin::GetHRowsCountForPane( cbDockPane* pPane )
if ( mpRowInFocus )
- DrawRowDragHint( mpRowInFocus, dc, FALSE );
+ DrawRowDragHint( mpRowInFocus, dc, false );
else
if ( mCollapsedIconInFocus != - 1 )
- DrawCollapsedRowIcon( mCollapsedIconInFocus, dc, FALSE );
+ DrawCollapsedRowIcon( mCollapsedIconInFocus, dc, false );
}
void cbRowDragPlugin::ShowDraggedRow( int offset )
// hide it
if ( pBar->mpBarWnd )
- pBar->mpBarWnd->Show( FALSE );
+ pBar->mpBarWnd->Show( false );
pBar->mState = wxCBAR_HIDDEN;
SetPaneMargins();
- mpLayout->RecalcLayout(FALSE);
+ mpLayout->RecalcLayout(false);
mpRowInFocus = NULL;
SetPaneMargins();
- mpLayout->RecalcLayout(FALSE);
+ mpLayout->RecalcLayout(false);
mCollapsedIconInFocus = -1;
SetPaneMargins();
- mpLayout->RecalcLayout(FALSE);
+ mpLayout->RecalcLayout(false);
mCollapsedIconInFocus = -1;
//wxClientDC dc( &mpLayout->GetParentFrame() );
//mpPane->PaintRow( mpRowInFocus, dc );
- //DrawRowDragHint( mpRowInFocus, dc, FALSE );
+ //DrawRowDragHint( mpRowInFocus, dc, false );
}
}
if ( iconIdx != - 1 )
- DrawCollapsedRowIcon( iconIdx, dc, TRUE );
+ DrawCollapsedRowIcon( iconIdx, dc, true );
else
if ( pRow != NULL )
- DrawRowDragHint( pRow, dc, TRUE );
+ DrawRowDragHint( pRow, dc, true );
}
cbRowInfo* cbRowDragPlugin::GetFirstRow()
pBar = pFromBar;
int prevX = from;
- bool hasNotFixedBars = FALSE;
+ bool hasNotFixedBars = false;
while ( pBar != pTillBar )
{
if ( !pBar->IsFixed() )
{
- hasNotFixedBars = TRUE;
+ hasNotFixedBars = true;
freeSpc -= bounds.width;
}
double unit = freeSpc / pcntSum;
- bool haveSquished = FALSE;
+ bool haveSquished = false;
for ( i = 0; i != pRow->mBars.Count(); ++i )
{
if ( int( unit * bar.mLenRatio ) < mpPane->mProps.mMinCBarDim.x )
{
- haveSquished = TRUE;
+ haveSquished = true;
bar.mBounds.width = -1; // mark as "squished"
{
// first pass from left to right (detect left-side handles)
- bool foundNotFixed = FALSE;
+ bool foundNotFixed = false;
size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
{
cbBarInfo& bar = *pRow->mBars[i];
- bar.mHasLeftHandle = FALSE;
+ bar.mHasLeftHandle = false;
if ( !bar.IsFixed() )
{
if ( bar.mpPrev &&
bar.mpPrev->IsFixed() )
- bar.mHasLeftHandle = TRUE;
+ bar.mHasLeftHandle = true;
- foundNotFixed = TRUE;
+ foundNotFixed = true;
}
}
// pass from right to left (detect right-side handles)
- foundNotFixed = FALSE;
+ foundNotFixed = false;
cbBarInfo* pBar = pRow->mBars[ pRow->mBars.Count() - 1 ];
while( pBar )
{
- pBar->mHasRightHandle = FALSE;
+ pBar->mHasRightHandle = false;
if ( !pBar->IsFixed() )
{
if ( pBar->mpNext )
- pBar->mHasRightHandle = TRUE;
+ pBar->mHasRightHandle = true;
- foundNotFixed = TRUE;
+ foundNotFixed = true;
}
pBar = pBar->mpPrev;
// rest bar information after removing it from the row
pBar->mpRow = NULL;
- pBar->mHasLeftHandle = FALSE;
- pBar->mHasRightHandle = FALSE;
+ pBar->mHasLeftHandle = false;
+ pBar->mHasRightHandle = false;
mpPane->InitLinksForRow( pRow ); // relink "mpNext/mpPrev"s
// force repainting of bars, in the row, from which the bar was removed
// FIXME:: really needed?
- pRow->mBars[0]->mUMgrData.SetDirty(TRUE);
+ pRow->mBars[0]->mUMgrData.SetDirty(true);
// re-setup mHasOnlyFixedBars flag for the row information
event.mpPane->SyncRowFlags( pRow );
if ( mpPane->mAlignment == FL_ALIGN_TOP ||
mpPane->mAlignment == FL_ALIGN_LEFT )
{
- row.mHasLowerHandle = TRUE;
+ row.mHasLowerHandle = true;
- row.mHasUpperHandle = FALSE;
+ row.mHasUpperHandle = false;
}
else
{
- row.mHasUpperHandle = TRUE;
+ row.mHasUpperHandle = true;
- row.mHasLowerHandle = FALSE;
+ row.mHasLowerHandle = false;
}
}
else
{
// otherwise, rows with fixed-bars only, have no height-resizing handles
- row.mHasUpperHandle = FALSE;
- row.mHasLowerHandle = FALSE;
+ row.mHasUpperHandle = false;
+ row.mHasLowerHandle = false;
}
// setup vertical positions for items in the row
else
event.mpPane->SetRowHeight( pTheRow, pTheRow->mRowHeight + ofs );
- mpLayout->RecalcLayout(FALSE);
+ mpLayout->RecalcLayout(false);
mpLayout->GetUpdatesManager().OnFinishChanges();
mpLayout->GetUpdatesManager().UpdateNow();
// Created: 06/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// FOR NOW:: static
static const unsigned char _gCheckerImg[16] = { _IMG_A,_IMG_B,_IMG_C,_IMG_D,
- _IMG_A,_IMG_B,_IMG_C,_IMG_D,
- _IMG_A,_IMG_B,_IMG_C,_IMG_D,
- _IMG_A,_IMG_B,_IMG_C,_IMG_D
- };
+ _IMG_A,_IMG_B,_IMG_C,_IMG_D,
+ _IMG_A,_IMG_B,_IMG_C,_IMG_D,
+ _IMG_A,_IMG_B,_IMG_C,_IMG_D
+ };
/***** Implementation for class wxToolWindow *****/
BEGIN_EVENT_TABLE( wxToolWindow, wxFrame )
- EVT_PAINT ( wxToolWindow::OnPaint )
- EVT_MOTION ( wxToolWindow::OnMotion )
- EVT_LEFT_DOWN( wxToolWindow::OnLeftDown )
- EVT_LEFT_UP ( wxToolWindow::OnLeftUp )
- EVT_SIZE ( wxToolWindow::OnSize )
+ EVT_PAINT ( wxToolWindow::OnPaint )
+ EVT_MOTION ( wxToolWindow::OnMotion )
+ EVT_LEFT_DOWN( wxToolWindow::OnLeftDown )
+ EVT_LEFT_UP ( wxToolWindow::OnLeftUp )
+ EVT_SIZE ( wxToolWindow::OnSize )
- EVT_ERASE_BACKGROUND( wxToolWindow::OnEraseBackground )
+ EVT_ERASE_BACKGROUND( wxToolWindow::OnEraseBackground )
END_EVENT_TABLE()
enum INTERNAL_HIT_CODES
{
- HITS_WND_NOTHING,
- HITS_WND_CLIENT,
- HITS_WND_TITLE,
-
- HITS_WND_LEFT_EDGE,
- HITS_WND_RIGHT_EDGE,
- HITS_WND_TOP_EDGE,
- HITS_WND_BOTTOM_EDGE,
-
- HITS_WND_TOP_LEFT_CORNER,
- HITS_WND_BOTTOM_RIGHT_CORNER,
- HITS_WND_TOP_RIGHT_CORNER,
- HITS_WND_BOTTOM_LEFT_CORNER
+ HITS_WND_NOTHING,
+ HITS_WND_CLIENT,
+ HITS_WND_TITLE,
+
+ HITS_WND_LEFT_EDGE,
+ HITS_WND_RIGHT_EDGE,
+ HITS_WND_TOP_EDGE,
+ HITS_WND_BOTTOM_EDGE,
+
+ HITS_WND_TOP_LEFT_CORNER,
+ HITS_WND_BOTTOM_RIGHT_CORNER,
+ HITS_WND_TOP_RIGHT_CORNER,
+ HITS_WND_BOTTOM_LEFT_CORNER
};
wxToolWindow::wxToolWindow()
- : mpClientWnd ( NULL ),
-
+ : mpClientWnd ( NULL ),
+
#ifndef __WXMSW__
- mTitleFont( 8, wxSWISS, wxNORMAL, wxNORMAL ),
+ mTitleFont( 8, wxSWISS, wxNORMAL, wxNORMAL ),
#else
- // just to simulate MS-Dev style
- mTitleFont( 8, wxSWISS, wxNORMAL, wxNORMAL, FALSE, wxT("MS Sans Serif") ),
+ // just to simulate MS-Dev style
+ mTitleFont( 8, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("MS Sans Serif") ),
#endif
- mTitleHeight ( 16 ),
- mClntHorizGap ( 2 ),
- mClntVertGap ( 2 ),
- mWndVertGap ( 4 ),
- mWndHorizGap ( 4 ),
+ mTitleHeight ( 16 ),
+ mClntHorizGap ( 2 ),
+ mClntVertGap ( 2 ),
+ mWndVertGap ( 4 ),
+ mWndHorizGap ( 4 ),
- mButtonGap ( 2 ),
- mInTitleMargin( 4 ),
- mHintBorder ( 4 ),
+ mButtonGap ( 2 ),
+ mInTitleMargin( 4 ),
+ mHintBorder ( 4 ),
- mResizeStarted( FALSE ),
- mRealTimeUpdatesOn( TRUE ),
+ mResizeStarted( false ),
+ mRealTimeUpdatesOn( true ),
- mMTolerance ( 5 ), // mouse-resizing tollerance
+ mMTolerance ( 5 ), // mouse-resizing tollerance
- mCursorType( HITS_WND_NOTHING ),
- mMouseCaptured( FALSE ),
-
- mpScrDc( NULL )
+ mCursorType( HITS_WND_NOTHING ),
+ mMouseCaptured( false ),
+
+ mpScrDc( NULL )
{
}
wxToolWindow::~wxToolWindow()
{
- if ( mpScrDc ) delete mpScrDc;
+ if ( mpScrDc ) delete mpScrDc;
- for( size_t i = 0; i != mButtons.Count(); ++i )
-
- delete mButtons[i];
+ for( size_t i = 0; i != mButtons.Count(); ++i )
+ delete mButtons[i];
}
void wxToolWindow::LayoutMiniButtons()
-{
- int w,h;
+{
+ int w,h;
- GetSize( &w, &h );
+ GetSize( &w, &h );
- int x = w - mWndHorizGap - mInTitleMargin - BTN_BOX_WIDTH;
- int y = mWndVertGap + 2;
+ int x = w - mWndHorizGap - mInTitleMargin - BTN_BOX_WIDTH;
+ int y = mWndVertGap + 2;
- for( size_t i = 0; i != mButtons.Count(); ++i )
- {
- mButtons[i]->SetPos( wxPoint( x,y ) );
- x-= BTN_BOX_WIDTH + mButtonGap;
- }
+ for( size_t i = 0; i != mButtons.Count(); ++i )
+ {
+ mButtons[i]->SetPos( wxPoint( x,y ) );
+ x-= BTN_BOX_WIDTH + mButtonGap;
+ }
}
void wxToolWindow::SetClient( wxWindow* pWnd )
{
- mpClientWnd = pWnd;
+ mpClientWnd = pWnd;
}
wxWindow* wxToolWindow::GetClient()
{
- return mpClientWnd;
+ return mpClientWnd;
}
void wxToolWindow::SetTitleFont( wxFont& font )
{
- mTitleFont = font;
+ mTitleFont = font;
}
void wxToolWindow::AddMiniButton( cbMiniButton* pBtn )
{
- pBtn->mpWnd = this;
+ pBtn->mpWnd = this;
- mButtons.Add( pBtn );
+ mButtons.Add( pBtn );
- // not necesserely now..
- //LayoutMiniButtons();
+ // not necesserely now..
+ //LayoutMiniButtons();
}
void wxToolWindow::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
wxPaintDC pdc( this );
- wxWindowDC dc( this );
+ wxWindowDC dc( this );
- int w,h;
- GetSize( &w, &h );
+ int w,h;
+ GetSize( &w, &h );
wxBrush backGround( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE), wxSOLID );
//dc.SetBrush( *wxLIGHT_GREY_BRUSH );
dc.SetPen( *wxTRANSPARENT_PEN );
int y = mWndVertGap + mTitleHeight + mClntVertGap;
+
dc.DrawRectangle( 0,0, w, y ); // Top grey part.
dc.DrawRectangle( 0,y-1, mWndHorizGap + mClntHorizGap, h - y ); // Left grey part.
dc.DrawRectangle( w - ( mWndHorizGap + mClntHorizGap ), y-1,
mWndHorizGap + mClntHorizGap, h - y ); // Right grey part.
dc.DrawRectangle( 0, h - mWndVertGap - mClntVertGap, w, mWndVertGap + mClntVertGap ); // Bottom grey part.
- // draw shades
- dc.SetPen( *wxLIGHT_GREY_PEN );
+ // draw shades
+ dc.SetPen( *wxLIGHT_GREY_PEN );
- dc.DrawLine( 0,0, w, 0 );
- dc.DrawLine( 0,0, 0, h );
+ dc.DrawLine( 0,0, w, 0 );
+ dc.DrawLine( 0,0, 0, h );
- dc.SetPen( *wxWHITE_PEN );
+ dc.SetPen( *wxWHITE_PEN );
- dc.DrawLine( 1,1, w, 1 );
- dc.DrawLine( 1,2, 1, h );
+ dc.DrawLine( 1,1, w, 1 );
+ dc.DrawLine( 1,2, 1, h );
- dc.SetPen( *wxGREY_PEN );
+ dc.SetPen( *wxGREY_PEN );
- dc.DrawLine( w - 2, 1, w - 2, h - 1 );
- dc.DrawLine( 1, h - 2, w - 2, h - 2 );
+ dc.DrawLine( w - 2, 1, w - 2, h - 1 );
+ dc.DrawLine( 1, h - 2, w - 2, h - 2 );
- dc.SetPen( *wxBLACK_PEN );
+ dc.SetPen( *wxBLACK_PEN );
- dc.DrawLine( 0, h - 1, w, h - 1 );
- dc.DrawLine( w-1, 0, w-1, h );
+ dc.DrawLine( 0, h - 1, w, h - 1 );
+ dc.DrawLine( w-1, 0, w-1, h );
- // fill inner area
+ // fill inner area
- dc.SetBrush( *wxTheBrushList->FindOrCreateBrush( wxColour( 0,0,128 ), wxSOLID ) );
+ dc.SetBrush( *wxTheBrushList->FindOrCreateBrush( wxColour( 0,0,128 ), wxSOLID ) );
- dc.DrawRectangle( mWndHorizGap, mWndVertGap, w - mWndHorizGap*2, mTitleHeight );
+ dc.DrawRectangle( mWndHorizGap, mWndVertGap, w - mWndHorizGap*2, mTitleHeight );
- dc.SetFont( mTitleFont );
+ dc.SetFont( mTitleFont );
- for( size_t i = 0; i != mButtons.Count(); ++i )
+ for( size_t i = 0; i != mButtons.Count(); ++i )
+ mButtons[i]->Draw( dc );
- mButtons[i]->Draw( dc );
+ int x1 = mWndHorizGap + mClntHorizGap;
+ int x2 = mButtons[ mButtons.GetCount() - 1 ]->mPos.x - mClntHorizGap*2;
- int x1 = mWndHorizGap + mClntHorizGap;
- int x2 = mButtons[ mButtons.GetCount() - 1 ]->mPos.x - mClntHorizGap*2;
+ dc.SetClippingRegion( x1, mWndVertGap + mClntVertGap, x2 - x1, mTitleHeight );
- dc.SetClippingRegion( x1, mWndVertGap + mClntVertGap, x2 - x1, mTitleHeight );
-
- dc.SetTextForeground( *wxWHITE );
- dc.SetBackgroundMode( wxTRANSPARENT );
- dc.DrawText( GetTitle(), mWndHorizGap + 2, mWndVertGap + 1 );
+ dc.SetTextForeground( *wxWHITE );
+ dc.SetBackgroundMode( wxTRANSPARENT );
+ dc.DrawText( GetTitle(), mWndHorizGap + 2, mWndVertGap + 1 );
}
void wxToolWindow::GetScrWindowRect( wxRect& r )
{
- int x,y;
- GetPosition(&x,&y);
- int w,h;
- GetSize( &w, &h );
+ int x,y;
+ GetPosition(&x,&y);
+ int w,h;
+ GetSize( &w, &h );
- r.x = x; r.y = y;
- r.width = w; r.height = h;
+ r.x = x; r.y = y;
+ r.width = w; r.height = h;
}
void wxToolWindow::GetScrMousePos( wxMouseEvent& event, wxPoint& pos )
{
- int x = event.m_x, y = event.m_y;
+ int x = event.m_x, y = event.m_y;
- ClientToScreen( &x, &y );
+ ClientToScreen( &x, &y );
- pos.x = x; pos.y = y;
+ pos.x = x; pos.y = y;
}
int wxToolWindow::HitTestWindow( wxMouseEvent& event )
{
- wxPoint pos;
- wxRect r;
-
- GetScrMousePos( event, pos );
- GetScrWindowRect( r );
-
- int k = mMTolerance;
-
- if ( !( pos.x >= r.x && pos.y >= r.y &&
- pos.x < r.x + r.width &&
- pos.y < r.y + r.height )
- )
- return HITS_WND_NOTHING;
-
- if ( pos.y <= r.y + k )
- {
- if ( pos.x < r.x + k*2 )
-
- return HITS_WND_TOP_LEFT_CORNER;
- else
- if ( pos.x >= r.x + r.width - k*2 )
-
- return HITS_WND_TOP_RIGHT_CORNER;
- else
- return HITS_WND_TOP_EDGE;
- }
- else
- if ( pos.y >= r.y + r.height - k )
- {
- if ( pos.x < r.x + k*2 )
-
- return HITS_WND_BOTTOM_LEFT_CORNER;
- else
- if ( pos.x > r.x + r.width - k*2 )
-
- return HITS_WND_BOTTOM_RIGHT_CORNER;
- else
- return HITS_WND_BOTTOM_EDGE;
- }
- else
- if ( pos.x <= r.x + k )
-
- return HITS_WND_LEFT_EDGE;
- else
- if ( pos.x >= r.x + r.width - k )
-
- return HITS_WND_RIGHT_EDGE;
- else
- {
- if ( pos.y <= r.y + mWndVertGap + mTitleHeight + mClntVertGap )
-
- return HITS_WND_TITLE;
- else
- return HITS_WND_CLIENT;
- }
+ wxPoint pos;
+ wxRect r;
+
+ GetScrMousePos( event, pos );
+ GetScrWindowRect( r );
+
+ int k = mMTolerance;
+
+ if ( !( pos.x >= r.x && pos.y >= r.y &&
+ pos.x < r.x + r.width &&
+ pos.y < r.y + r.height )
+ )
+ return HITS_WND_NOTHING;
+
+ if ( pos.y <= r.y + k )
+ {
+ if ( pos.x < r.x + k*2 )
+ return HITS_WND_TOP_LEFT_CORNER;
+ else
+ {
+ if ( pos.x >= r.x + r.width - k*2 )
+ return HITS_WND_TOP_RIGHT_CORNER;
+ else
+ return HITS_WND_TOP_EDGE;
+ }
+ }
+ else
+ {
+ if ( pos.y >= r.y + r.height - k )
+ {
+ if ( pos.x < r.x + k*2 )
+ return HITS_WND_BOTTOM_LEFT_CORNER;
+ else
+ {
+ if ( pos.x > r.x + r.width - k*2 )
+ return HITS_WND_BOTTOM_RIGHT_CORNER;
+ else
+ return HITS_WND_BOTTOM_EDGE;
+ }
+ }
+ else
+ {
+ if ( pos.x <= r.x + k )
+ return HITS_WND_LEFT_EDGE;
+ else
+ {
+ if ( pos.x >= r.x + r.width - k )
+ return HITS_WND_RIGHT_EDGE;
+ else
+ {
+ if ( pos.y <= r.y + mWndVertGap + mTitleHeight + mClntVertGap )
+ return HITS_WND_TITLE;
+ else
+ return HITS_WND_CLIENT;
+ }
+ }
+ }
+ }
}
void wxToolWindow::DrawHintRect( const wxRect& r )
{
- // BUG BUG BUG (wx):: somehow stippled brush works only
- // when the bitmap created on stack, not
- // as a member of the class
+ // BUG BUG BUG (wx):: somehow stippled brush works only
+ // when the bitmap created on stack, not
+ // as a member of the class
- int prevLF = mpScrDc->GetLogicalFunction();
+ int prevLF = mpScrDc->GetLogicalFunction();
- mpScrDc->SetLogicalFunction( wxXOR );
+ mpScrDc->SetLogicalFunction( wxXOR );
- wxBitmap checker( (const char*)_gCheckerImg, 8,8 );
+ wxBitmap checker( (const char*)_gCheckerImg, 8,8 );
- wxBrush checkerBrush( checker );
+ wxBrush checkerBrush( checker );
- mpScrDc->SetPen( *wxTRANSPARENT_PEN );
- mpScrDc->SetBrush( checkerBrush );
+ mpScrDc->SetPen( *wxTRANSPARENT_PEN );
+ mpScrDc->SetBrush( checkerBrush );
- int half = mHintBorder / 2;
+ int half = mHintBorder / 2;
- mpScrDc->DrawRectangle( r.x - half, r.y - half,
- r.width + 2*half, mHintBorder );
+ mpScrDc->DrawRectangle( r.x - half, r.y - half,
+ r.width + 2*half, mHintBorder );
- mpScrDc->DrawRectangle( r.x - half, r.y + r.height - half,
- r.width + 2*half, mHintBorder );
+ mpScrDc->DrawRectangle( r.x - half, r.y + r.height - half,
+ r.width + 2*half, mHintBorder );
- mpScrDc->DrawRectangle( r.x - half, r.y + half - 1,
- mHintBorder, r.height - 2*half + 2);
+ mpScrDc->DrawRectangle( r.x - half, r.y + half - 1,
+ mHintBorder, r.height - 2*half + 2);
- mpScrDc->DrawRectangle( r.x + r.width - half,
- r.y + half - 1,
- mHintBorder, r.height - 2*half + 2);
+ mpScrDc->DrawRectangle( r.x + r.width - half,
+ r.y + half - 1,
+ mHintBorder, r.height - 2*half + 2);
- mpScrDc->SetBrush( wxNullBrush );
+ mpScrDc->SetBrush( wxNullBrush );
- mpScrDc->SetLogicalFunction( prevLF );
+ mpScrDc->SetLogicalFunction( prevLF );
}
void wxToolWindow::SetHintCursor( int type )
{
- if ( mResizeStarted )
+ if ( mResizeStarted )
return;
- if ( type == HITS_WND_NOTHING || type == HITS_WND_CLIENT )
- {
- // the cursor is out of window - reset to arrow
-
- if ( mMouseCaptured )
- {
- ReleaseMouse();
- mMouseCaptured = FALSE;
- }
-
- SetCursor( wxCURSOR_ARROW );
-
- mCursorType = type;
-
- return;
- }
-
- if ( !mMouseCaptured )
- {
- mMouseCaptured = TRUE;
- CaptureMouse();
- }
-
- // did the cursor actually changed?
-
- if ( type != mCursorType )
- {
- mCursorType = type;
-
- switch ( type )
- {
- case HITS_WND_LEFT_EDGE : SetCursor( wxCURSOR_SIZEWE ); break;
- case HITS_WND_RIGHT_EDGE : SetCursor( wxCURSOR_SIZEWE ); break;
- case HITS_WND_TOP_EDGE : SetCursor( wxCURSOR_SIZENS ); break;
- case HITS_WND_BOTTOM_EDGE : SetCursor( wxCURSOR_SIZENS ); break;
-
- case HITS_WND_TOP_LEFT_CORNER : SetCursor( wxCURSOR_SIZENWSE ); break;
- case HITS_WND_BOTTOM_RIGHT_CORNER : SetCursor( wxCURSOR_SIZENWSE ); break;
- case HITS_WND_TOP_RIGHT_CORNER : SetCursor( wxCURSOR_SIZENESW ); break;
- case HITS_WND_BOTTOM_LEFT_CORNER : SetCursor( wxCURSOR_SIZENESW ); break;
-
- case HITS_WND_TITLE : SetCursor( wxCURSOR_ARROW ); break;
- case HITS_WND_CLIENT : SetCursor( wxCURSOR_ARROW ); break;
-
- default: break;
- }
- }
+ if ( type == HITS_WND_NOTHING || type == HITS_WND_CLIENT )
+ {
+ // the cursor is out of window - reset to arrow
+
+ if ( mMouseCaptured )
+ {
+ ReleaseMouse();
+ mMouseCaptured = false;
+ }
+
+ SetCursor( wxCURSOR_ARROW );
+
+ mCursorType = type;
+
+ return;
+ }
+
+ if ( !mMouseCaptured )
+ {
+ mMouseCaptured = true;
+ CaptureMouse();
+ }
+
+ // did the cursor actually changed?
+
+ if ( type != mCursorType )
+ {
+ mCursorType = type;
+
+ switch ( type )
+ {
+ case HITS_WND_LEFT_EDGE : SetCursor( wxCURSOR_SIZEWE ); break;
+ case HITS_WND_RIGHT_EDGE : SetCursor( wxCURSOR_SIZEWE ); break;
+ case HITS_WND_TOP_EDGE : SetCursor( wxCURSOR_SIZENS ); break;
+ case HITS_WND_BOTTOM_EDGE : SetCursor( wxCURSOR_SIZENS ); break;
+
+ case HITS_WND_TOP_LEFT_CORNER : SetCursor( wxCURSOR_SIZENWSE ); break;
+ case HITS_WND_BOTTOM_RIGHT_CORNER : SetCursor( wxCURSOR_SIZENWSE ); break;
+ case HITS_WND_TOP_RIGHT_CORNER : SetCursor( wxCURSOR_SIZENESW ); break;
+ case HITS_WND_BOTTOM_LEFT_CORNER : SetCursor( wxCURSOR_SIZENESW ); break;
+
+ case HITS_WND_TITLE : SetCursor( wxCURSOR_ARROW ); break;
+ case HITS_WND_CLIENT : SetCursor( wxCURSOR_ARROW ); break;
+
+ default: break;
+ }
+ }
}
#define INFINITY 32768
static inline void clip_to( int& value, long from, long till )
{
- if ( value < from )
- value = from;
+ if ( value < from )
+ value = from;
- if ( value > till )
- value = till;
+ if ( value > till )
+ value = till;
}
void wxToolWindow::AdjustRectPos( const wxRect& original, const wxSize& newDim, wxRect& newRect )
{
- if ( mCursorType == HITS_WND_TOP_EDGE ||
- mCursorType == HITS_WND_TOP_LEFT_CORNER )
- {
- newRect.x = original.x + original.width - newDim.x;
- newRect.y = original.y + original.height - newDim.y;
- }
- else
- if ( mCursorType == HITS_WND_LEFT_EDGE ||
- mCursorType == HITS_WND_BOTTOM_LEFT_CORNER )
- {
- newRect.x = original.x + original.width - newDim.x;
- newRect.y = original.y;
- }
- else
- if ( mCursorType == HITS_WND_RIGHT_EDGE ||
- mCursorType == HITS_WND_TOP_RIGHT_CORNER )
- {
- newRect.x = original.x;
- newRect.y = original.y + original.height - newDim.y;
- }
- else
- if ( mCursorType == HITS_WND_BOTTOM_EDGE ||
- mCursorType == HITS_WND_BOTTOM_RIGHT_CORNER )
- {
- newRect.x = original.x;
- newRect.y = original.y;
- }
-
- newRect.width = newDim.x;
- newRect.height = newDim.y;
+ if ( mCursorType == HITS_WND_TOP_EDGE ||
+ mCursorType == HITS_WND_TOP_LEFT_CORNER )
+ {
+ newRect.x = original.x + original.width - newDim.x;
+ newRect.y = original.y + original.height - newDim.y;
+ }
+ else
+ if ( mCursorType == HITS_WND_LEFT_EDGE ||
+ mCursorType == HITS_WND_BOTTOM_LEFT_CORNER )
+ {
+ newRect.x = original.x + original.width - newDim.x;
+ newRect.y = original.y;
+ }
+ else
+ if ( mCursorType == HITS_WND_RIGHT_EDGE ||
+ mCursorType == HITS_WND_TOP_RIGHT_CORNER )
+ {
+ newRect.x = original.x;
+ newRect.y = original.y + original.height - newDim.y;
+ }
+ else
+ if ( mCursorType == HITS_WND_BOTTOM_EDGE ||
+ mCursorType == HITS_WND_BOTTOM_RIGHT_CORNER )
+ {
+ newRect.x = original.x;
+ newRect.y = original.y;
+ }
+
+ newRect.width = newDim.x;
+ newRect.height = newDim.y;
}
void wxToolWindow::CalcResizedRect( wxRect& rect, wxPoint& delta, const wxSize& minDim )
{
- // Microsoft's rect-coordinates are best suited
- // for the case of corner-clipping
-
- int left = mInitialRect.x;
- int top = mInitialRect.y;
- int right = mInitialRect.x + mInitialRect.width;
- int bottom = mInitialRect.y + mInitialRect.height;
-
- // constraint delta edge is dragged
-
- switch ( mCursorType )
- {
- case HITS_WND_LEFT_EDGE : delta.y = 0; break;
- case HITS_WND_RIGHT_EDGE : delta.y = 0; break;
- case HITS_WND_TOP_EDGE : delta.x = 0; break;
- case HITS_WND_BOTTOM_EDGE : delta.x = 0; break;
- default: break;
- }
-
- if ( mCursorType == HITS_WND_TOP_EDGE ||
- mCursorType == HITS_WND_TOP_LEFT_CORNER )
- {
- left += delta.x;
- top += delta.y;
-
- clip_to( left, -INFINITY, mInitialRect.x + mInitialRect.width - minDim.x );
- clip_to( top, -INFINITY, mInitialRect.y + mInitialRect.height - minDim.y );
- }
- else
- if ( mCursorType == HITS_WND_LEFT_EDGE ||
- mCursorType == HITS_WND_BOTTOM_LEFT_CORNER )
- {
- left += delta.x;
- bottom += delta.y;
-
- clip_to( left, -INFINITY, mInitialRect.x + mInitialRect.width - minDim.x );
- clip_to( bottom, mInitialRect.y + minDim.y, INFINITY );
- }
- else
- if ( mCursorType == HITS_WND_RIGHT_EDGE ||
- mCursorType == HITS_WND_TOP_RIGHT_CORNER )
- {
- right += delta.x;
- top += delta.y;
-
- clip_to( right, mInitialRect.x + minDim.x, INFINITY );
- clip_to( top, -INFINITY, mInitialRect.y + mInitialRect.height - minDim.y );
- }
- else
- if ( mCursorType == HITS_WND_BOTTOM_EDGE ||
- mCursorType == HITS_WND_BOTTOM_RIGHT_CORNER )
- {
- right += delta.x;
- bottom += delta.y;
-
- clip_to( right, mInitialRect.x + minDim.x, INFINITY );
- clip_to( bottom, mInitialRect.y + minDim.y, INFINITY );
- }
- else
- {
- wxFAIL_MSG( _T("what did the cursor hit?") );
- }
-
- rect.x = left;
- rect.y = top;
- rect.width = right - left;
- rect.height = bottom - top;
+ // Microsoft's rect-coordinates are best suited
+ // for the case of corner-clipping
+
+ int left = mInitialRect.x;
+ int top = mInitialRect.y;
+ int right = mInitialRect.x + mInitialRect.width;
+ int bottom = mInitialRect.y + mInitialRect.height;
+
+ // constraint delta edge is dragged
+
+ switch ( mCursorType )
+ {
+ case HITS_WND_LEFT_EDGE : delta.y = 0; break;
+ case HITS_WND_RIGHT_EDGE : delta.y = 0; break;
+ case HITS_WND_TOP_EDGE : delta.x = 0; break;
+ case HITS_WND_BOTTOM_EDGE : delta.x = 0; break;
+ default: break;
+ }
+
+ if ( mCursorType == HITS_WND_TOP_EDGE ||
+ mCursorType == HITS_WND_TOP_LEFT_CORNER )
+ {
+ left += delta.x;
+ top += delta.y;
+
+ clip_to( left, -INFINITY, mInitialRect.x + mInitialRect.width - minDim.x );
+ clip_to( top, -INFINITY, mInitialRect.y + mInitialRect.height - minDim.y );
+ }
+ else
+ if ( mCursorType == HITS_WND_LEFT_EDGE ||
+ mCursorType == HITS_WND_BOTTOM_LEFT_CORNER )
+ {
+ left += delta.x;
+ bottom += delta.y;
+
+ clip_to( left, -INFINITY, mInitialRect.x + mInitialRect.width - minDim.x );
+ clip_to( bottom, mInitialRect.y + minDim.y, INFINITY );
+ }
+ else
+ if ( mCursorType == HITS_WND_RIGHT_EDGE ||
+ mCursorType == HITS_WND_TOP_RIGHT_CORNER )
+ {
+ right += delta.x;
+ top += delta.y;
+
+ clip_to( right, mInitialRect.x + minDim.x, INFINITY );
+ clip_to( top, -INFINITY, mInitialRect.y + mInitialRect.height - minDim.y );
+ }
+ else
+ if ( mCursorType == HITS_WND_BOTTOM_EDGE ||
+ mCursorType == HITS_WND_BOTTOM_RIGHT_CORNER )
+ {
+ right += delta.x;
+ bottom += delta.y;
+
+ clip_to( right, mInitialRect.x + minDim.x, INFINITY );
+ clip_to( bottom, mInitialRect.y + minDim.y, INFINITY );
+ }
+ else
+ {
+ wxFAIL_MSG( _T("what did the cursor hit?") );
+ }
+
+ rect.x = left;
+ rect.y = top;
+ rect.width = right - left;
+ rect.height = bottom - top;
}
wxSize wxToolWindow::GetMinimalWndDim()
{
- return wxSize( (mWndHorizGap + mClntHorizGap)*2 + BTN_BOX_WIDTH*4,
- (mWndVertGap + mClntVertGap )*2 + mTitleHeight );
+ return wxSize( (mWndHorizGap + mClntHorizGap)*2 + BTN_BOX_WIDTH*4,
+ (mWndVertGap + mClntVertGap )*2 + mTitleHeight );
}
void wxToolWindow::OnMotion( wxMouseEvent& event )
{
- if ( !mResizeStarted )
- {
- for( size_t i = 0; i != mButtons.Count(); ++i )
-
- mButtons[i]->OnMotion( wxPoint( event.m_x, event.m_y ) );
+ if ( !mResizeStarted )
+ {
+ for( size_t i = 0; i != mButtons.Count(); ++i )
+ mButtons[i]->OnMotion( wxPoint( event.m_x, event.m_y ) );
- SetHintCursor( HitTestWindow( event ) );
- return;
- }
+ SetHintCursor( HitTestWindow( event ) );
+ return;
+ }
- wxPoint pos;
- GetScrMousePos( event, pos );
+ wxPoint pos;
+ GetScrMousePos( event, pos );
- if ( mCursorType == HITS_WND_TITLE )
- {
- int w,h;
- GetSize( &w, &h );
+ if ( mCursorType == HITS_WND_TITLE )
+ {
+ int w,h;
+ GetSize( &w, &h );
- SetSize( mInitialRect.x + pos.x - mDragOrigin.x,
- mInitialRect.y + pos.y - mDragOrigin.y,
- w,h, 0 );
- }
+ SetSize( mInitialRect.x + pos.x - mDragOrigin.x,
+ mInitialRect.y + pos.y - mDragOrigin.y,
+ w,h, 0 );
+ }
- else
- {
- wxPoint delta( pos.x - mDragOrigin.x, pos.y - mDragOrigin.y );
+ else
+ {
+ wxPoint delta( pos.x - mDragOrigin.x, pos.y - mDragOrigin.y );
- wxRect newRect;
+ wxRect newRect;
- wxSize minDim = GetMinimalWndDim();
+ wxSize minDim = GetMinimalWndDim();
- CalcResizedRect( newRect, delta, minDim );
+ CalcResizedRect( newRect, delta, minDim );
- wxSize borderDim( ( mWndHorizGap + mClntHorizGap )*2,
- ( mWndVertGap + mClntVertGap )*2 + mTitleHeight );
+ wxSize borderDim( ( mWndHorizGap + mClntHorizGap )*2,
+ ( mWndVertGap + mClntVertGap )*2 + mTitleHeight );
- wxSize preferred = GetPreferredSize( wxSize( newRect.width - borderDim.x,
- newRect.height - borderDim.y ) );
+ wxSize preferred = GetPreferredSize( wxSize( newRect.width - borderDim.x,
+ newRect.height - borderDim.y ) );
- preferred.x += borderDim.x;
- preferred.y += borderDim.y;
+ preferred.x += borderDim.x;
+ preferred.y += borderDim.y;
- //CalcResizedRect( newRect, delta, preferred );
+ //CalcResizedRect( newRect, delta, preferred );
- wxRect finalRect = newRect;
+ wxRect finalRect = newRect;
- AdjustRectPos( newRect, preferred, finalRect );
+ AdjustRectPos( newRect, preferred, finalRect );
- if ( mRealTimeUpdatesOn )
- {
- SetSize( finalRect.x, finalRect.y,
- finalRect.width, finalRect.height, 0 );
- }
- else
- {
- DrawHintRect( mPrevHintRect );
- DrawHintRect( finalRect );
+ if ( mRealTimeUpdatesOn )
+ {
+ SetSize( finalRect.x, finalRect.y,
+ finalRect.width, finalRect.height, 0 );
+ }
+ else
+ {
+ DrawHintRect( mPrevHintRect );
+ DrawHintRect( finalRect );
::wxLogTrace(wxT("wxToolWindow"),wxT("%d,%d / %d,%d\n"), finalRect.x, finalRect.y, finalRect.width, finalRect.height);
- }
+ }
- mPrevHintRect = finalRect;
- }
+ mPrevHintRect = finalRect;
+ }
}
void wxToolWindow::OnLeftDown( wxMouseEvent& event )
{
- int result = HitTestWindow( event );
-
- for( size_t i = 0; i != mButtons.Count(); ++i )
- {
- mButtons[i]->OnLeftDown( wxPoint( event.m_x, event.m_y ) );
-
- if ( mButtons[i]->IsPressed() )
+ int result = HitTestWindow( event );
- return; // button hitted,
- }
+ for( size_t i = 0; i != mButtons.Count(); ++i )
+ {
+ mButtons[i]->OnLeftDown( wxPoint( event.m_x, event.m_y ) );
- if ( result >= HITS_WND_LEFT_EDGE || result == HITS_WND_TITLE )
- {
- GetScrMousePos( event, mDragOrigin );
+ if ( mButtons[i]->IsPressed() )
+ return; // button hitted,
+ }
- /*
- if ( mMouseCaptured `)
- {
- ReleaseMouse();
- mMouseCaptured = FALSE;
- }*/
+ if ( result >= HITS_WND_LEFT_EDGE || result == HITS_WND_TITLE )
+ {
+ GetScrMousePos( event, mDragOrigin );
- if ( result == HITS_WND_TITLE &&
- HandleTitleClick( event )
- )
- {
+ /*
+ if ( mMouseCaptured `)
+ {
+ ReleaseMouse();
+ mMouseCaptured = false;
+ }*/
- return;
- }
+ if ( result == HITS_WND_TITLE &&
+ HandleTitleClick( event ) )
+ return;
- mResizeStarted = TRUE;
+ mResizeStarted = true;
- int x,y;
- GetPosition( &x, &y );
+ int x,y;
+ GetPosition( &x, &y );
- mInitialRect.x = x;
- mInitialRect.y = y;
+ mInitialRect.x = x;
+ mInitialRect.y = y;
- GetSize( &x, &y );
- mInitialRect.width = x;
- mInitialRect.height = y;
+ GetSize( &x, &y );
+ mInitialRect.width = x;
+ mInitialRect.height = y;
- mPrevHintRect = mInitialRect;
+ mPrevHintRect = mInitialRect;
- if ( mCursorType != HITS_WND_TITLE && !mRealTimeUpdatesOn )
- {
- mpScrDc = new wxScreenDC();
+ if ( mCursorType != HITS_WND_TITLE && !mRealTimeUpdatesOn )
+ {
+ mpScrDc = new wxScreenDC();
- wxScreenDC::StartDrawingOnTop( (wxRect*)NULL );
+ wxScreenDC::StartDrawingOnTop( (wxRect*)NULL );
- DrawHintRect( mInitialRect );
- }
- }
+ DrawHintRect( mInitialRect );
+ }
+ }
}
void wxToolWindow::OnLeftUp( wxMouseEvent& event )
{
- for( size_t i = 0; i != mButtons.Count(); ++i )
- {
- mButtons[i]->OnLeftUp( wxPoint( event.m_x, event.m_y ) );
-
- if ( mButtons[i]->WasClicked() )
- {
- OnMiniButtonClicked( i ); // notify derived classes
- mButtons[i]->Reset();
- }
- }
-
- if ( mResizeStarted )
- {
- mResizeStarted = FALSE;
-
- if ( mCursorType != HITS_WND_TITLE )
- {
- if ( !mRealTimeUpdatesOn )
- {
- DrawHintRect( mPrevHintRect );
-
- wxScreenDC::EndDrawingOnTop();
-
- delete mpScrDc;
-
- mpScrDc = NULL;
-
- SetSize( mPrevHintRect.x, mPrevHintRect.y,
- mPrevHintRect.width, mPrevHintRect.height, 0 );
- }
- }
- }
+ for( size_t i = 0; i != mButtons.Count(); ++i )
+ {
+ mButtons[i]->OnLeftUp( wxPoint( event.m_x, event.m_y ) );
+
+ if ( mButtons[i]->WasClicked() )
+ {
+ OnMiniButtonClicked( i ); // notify derived classes
+ mButtons[i]->Reset();
+ }
+ }
+
+ if ( mResizeStarted )
+ {
+ mResizeStarted = false;
+
+ if ( mCursorType != HITS_WND_TITLE )
+ {
+ if ( !mRealTimeUpdatesOn )
+ {
+ DrawHintRect( mPrevHintRect );
+
+ wxScreenDC::EndDrawingOnTop();
+
+ delete mpScrDc;
+
+ mpScrDc = NULL;
+
+ SetSize( mPrevHintRect.x, mPrevHintRect.y,
+ mPrevHintRect.width, mPrevHintRect.height, 0 );
+ }
+ }
+ }
}
void wxToolWindow::OnSize( wxSizeEvent& WXUNUSED(event) )
{
- if ( mpClientWnd )
- {
- int w,h;
- GetSize( &w, &h );
+ if ( mpClientWnd )
+ {
+ int w,h;
+ GetSize( &w, &h );
- int x = mWndHorizGap + mClntHorizGap;
- int y = mWndVertGap + mTitleHeight + mClntVertGap;
+ int x = mWndHorizGap + mClntHorizGap;
+ int y = mWndVertGap + mTitleHeight + mClntVertGap;
mpClientWnd->SetSize( x-1, y-1,
w - 2*(mWndHorizGap + mClntHorizGap),
);
}
- LayoutMiniButtons();
+ LayoutMiniButtons();
}
wxSize wxToolWindow::GetPreferredSize( const wxSize& given )
{
- return given;
+ return given;
}
void wxToolWindow::OnEraseBackground( wxEraseEvent& WXUNUSED(event) )
{
- // nothing
+ // nothing
}
/***** Implementation for class cbMiniButton *****/
cbMiniButton::cbMiniButton()
- : mVisible( TRUE ),
- mEnabled( TRUE ),
+ : mVisible( true ),
+ mEnabled( true ),
- mpLayout( NULL ),
- mpPane ( NULL ),
- mpPlugin( NULL ),
- mpWnd ( NULL ),
+ mpLayout( NULL ),
+ mpPane ( NULL ),
+ mpPlugin( NULL ),
+ mpWnd ( NULL ),
- mWasClicked( FALSE ),
- mDragStarted( FALSE ),
- mPressed( FALSE )
+ mWasClicked( false ),
+ mDragStarted( false ),
+ mPressed( false )
{}
void cbMiniButton::SetPos( const wxPoint& pos )
{
- mPos = pos;
+ mPos = pos;
}
bool cbMiniButton::HitTest( const wxPoint& pos )
{
- if ( !mVisible ) return FALSE;
+ if ( !mVisible ) return false;
- return ( pos.x >= mPos.x && pos.y >= mPos.y &&
- pos.x < mPos.x + BTN_BOX_WIDTH &&
- pos.y < mPos.y + BTN_BOX_HEIGHT );
+ return ( pos.x >= mPos.x && pos.y >= mPos.y &&
+ pos.x < mPos.x + BTN_BOX_WIDTH &&
+ pos.y < mPos.y + BTN_BOX_HEIGHT );
}
void cbMiniButton::OnLeftDown( const wxPoint& pos )
{
- if ( !mVisible || mDragStarted ) return;
-
- if ( HitTest( pos ) && mEnabled )
- {
- if ( mpPlugin )
- {
- mpLayout->CaptureEventsForPane( mpPane );
- mpLayout->CaptureEventsForPlugin( mpPlugin );
- }
- else
- mpWnd->CaptureMouse();
-
- mDragStarted = TRUE;
- mPressed = TRUE;
- mWasClicked = FALSE;
-
- Refresh();
- }
+ if ( !mVisible || mDragStarted ) return;
+
+ if ( HitTest( pos ) && mEnabled )
+ {
+ if ( mpPlugin )
+ {
+ mpLayout->CaptureEventsForPane( mpPane );
+ mpLayout->CaptureEventsForPlugin( mpPlugin );
+ }
+ else
+ mpWnd->CaptureMouse();
+
+ mDragStarted = true;
+ mPressed = true;
+ mWasClicked = false;
+
+ Refresh();
+ }
}
void cbMiniButton::OnLeftUp( const wxPoint& WXUNUSED(pos) )
{
- if ( !mVisible || !mDragStarted ) return;
+ if ( !mVisible || !mDragStarted ) return;
- if ( mpPlugin )
- {
- mpLayout->ReleaseEventsFromPane( mpPane );
- mpLayout->ReleaseEventsFromPlugin( mpPlugin );
- }
- else
- mpWnd->ReleaseMouse();
+ if ( mpPlugin )
+ {
+ mpLayout->ReleaseEventsFromPane( mpPane );
+ mpLayout->ReleaseEventsFromPlugin( mpPlugin );
+ }
+ else
+ mpWnd->ReleaseMouse();
- mWasClicked = mPressed;
- mDragStarted = FALSE;
+ mWasClicked = mPressed;
+ mDragStarted = false;
- mPressed = FALSE;
- Refresh();
+ mPressed = false;
+ Refresh();
}
void cbMiniButton::OnMotion( const wxPoint& pos )
{
- if ( !mVisible ) return;
+ if ( !mVisible ) return;
- if ( mDragStarted )
- {
- mPressed = HitTest( pos );
+ if ( mDragStarted )
+ {
+ mPressed = HitTest( pos );
- Refresh();
- }
+ Refresh();
+ }
}
void cbMiniButton::Refresh()
{
- if ( mpLayout )
- {
- wxClientDC dc( &mpLayout->GetParentFrame() );
-
- Draw( dc );
- }
- else
- {
- wxWindowDC dc( mpWnd );
-
- Draw( dc );
- }
+ if ( mpLayout )
+ {
+ wxClientDC dc( &mpLayout->GetParentFrame() );
+
+ Draw( dc );
+ }
+ else
+ {
+ wxWindowDC dc( mpWnd );
+
+ Draw( dc );
+ }
}
void cbMiniButton::Draw( wxDC& dc )
{
- if ( !mVisible ) return;
+ if ( !mVisible ) return;
- dc.SetPen( *wxTRANSPARENT_PEN );
+ dc.SetPen( *wxTRANSPARENT_PEN );
- dc.SetBrush( *wxLIGHT_GREY_BRUSH );
+ dc.SetBrush( *wxLIGHT_GREY_BRUSH );
- dc.DrawRectangle( mPos.x + 1, mPos.y + 1, BTN_BOX_WIDTH - 2, BTN_BOX_HEIGHT - 2 );
+ dc.DrawRectangle( mPos.x + 1, mPos.y + 1, BTN_BOX_WIDTH - 2, BTN_BOX_HEIGHT - 2 );
- // "hard-code" metafile
+ // "hard-code" metafile
- if ( !mPressed )
+ if ( !mPressed )
+ dc.SetPen( *wxWHITE_PEN );
+ else
+ dc.SetPen( *wxBLACK_PEN );
- dc.SetPen( *wxWHITE_PEN );
- else
- dc.SetPen( *wxBLACK_PEN );
+ dc.DrawLine( mPos.x, mPos.y, mPos.x + BTN_BOX_WIDTH, mPos.y );
+ dc.DrawLine( mPos.x, mPos.y, mPos.x, mPos.y + BTN_BOX_HEIGHT );
- dc.DrawLine( mPos.x, mPos.y, mPos.x + BTN_BOX_WIDTH, mPos.y );
- dc.DrawLine( mPos.x, mPos.y, mPos.x, mPos.y + BTN_BOX_HEIGHT );
+ dc.SetPen( *wxGREY_PEN );
- dc.SetPen( *wxGREY_PEN );
+ if ( !mPressed )
+ {
+ dc.DrawLine( mPos.x + 1, mPos.y + BTN_BOX_HEIGHT - 2,
+ mPos.x + BTN_BOX_WIDTH - 1, mPos.y + BTN_BOX_HEIGHT - 2 );
- if ( !mPressed )
- {
- dc.DrawLine( mPos.x + 1, mPos.y + BTN_BOX_HEIGHT - 2,
- mPos.x + BTN_BOX_WIDTH - 1, mPos.y + BTN_BOX_HEIGHT - 2 );
-
- dc.DrawLine( mPos.x + BTN_BOX_WIDTH - 2, mPos.y + 1,
- mPos.x + BTN_BOX_WIDTH - 2, mPos.y + BTN_BOX_HEIGHT - 1 );
- }
- else
- {
- dc.DrawLine( mPos.x + 1, mPos.y + 1,
- mPos.x + BTN_BOX_WIDTH - 2, mPos.y + 1 );
-
- dc.DrawLine( mPos.x + 1, mPos.y + 1,
- mPos.x + 1, mPos.y + BTN_BOX_HEIGHT - 2 );
- }
+ dc.DrawLine( mPos.x + BTN_BOX_WIDTH - 2, mPos.y + 1,
+ mPos.x + BTN_BOX_WIDTH - 2, mPos.y + BTN_BOX_HEIGHT - 1 );
+ }
+ else
+ {
+ dc.DrawLine( mPos.x + 1, mPos.y + 1,
+ mPos.x + BTN_BOX_WIDTH - 2, mPos.y + 1 );
- if ( !mPressed )
+ dc.DrawLine( mPos.x + 1, mPos.y + 1,
+ mPos.x + 1, mPos.y + BTN_BOX_HEIGHT - 2 );
+ }
- dc.SetPen( *wxBLACK_PEN );
- else
- dc.SetPen( *wxWHITE_PEN );
+ if ( !mPressed )
+ dc.SetPen( *wxBLACK_PEN );
+ else
+ dc.SetPen( *wxWHITE_PEN );
- dc.DrawLine( mPos.x, mPos.y + BTN_BOX_HEIGHT - 1,
- mPos.x + BTN_BOX_WIDTH, mPos.y + BTN_BOX_HEIGHT - 1 );
+ dc.DrawLine( mPos.x, mPos.y + BTN_BOX_HEIGHT - 1,
+ mPos.x + BTN_BOX_WIDTH, mPos.y + BTN_BOX_HEIGHT - 1 );
- dc.DrawLine( mPos.x + BTN_BOX_WIDTH - 1, mPos.y ,
- mPos.x + BTN_BOX_WIDTH - 1, mPos.y + BTN_BOX_HEIGHT );
+ dc.DrawLine( mPos.x + BTN_BOX_WIDTH - 1, mPos.y ,
+ mPos.x + BTN_BOX_WIDTH - 1, mPos.y + BTN_BOX_HEIGHT );
}
bool cbMiniButton::WasClicked()
{
- return mWasClicked;
+ return mWasClicked;
}
void cbMiniButton::Reset()
{
- mWasClicked = FALSE;
+ mWasClicked = false;
}
/***** Implementation fro class cbCloseBox *****/
int width = BTN_BOX_WIDTH - 7;
int xOfs = (mPressed) ? 4 : 3;
- int yOfs = (mPressed) ? 4 : 3;
+ int yOfs = (mPressed) ? 4 : 3;
int one = 1;
for( int i = 0; i != BTN_X_WIEGHT; ++i )
#else
- cbMiniButton::Draw( dc );
+ cbMiniButton::Draw( dc );
- dc.SetPen( *wxBLACK_PEN );
+ dc.SetPen( *wxBLACK_PEN );
- int width = BTN_BOX_WIDTH - 7;
+ int width = BTN_BOX_WIDTH - 7;
- int xOfs = (mPressed) ? 4 : 3;
- int yOfs = (mPressed) ? 4 : 3;
+ int xOfs = (mPressed) ? 4 : 3;
+ int yOfs = (mPressed) ? 4 : 3;
- for( int i = 0; i != BTN_X_WIEGHT; ++i )
- {
- dc.DrawLine( mPos.x + xOfs + i,
- mPos.y + yOfs,
- mPos.x + xOfs + i + width,
- mPos.y + yOfs + width );
+ for( int i = 0; i != BTN_X_WIEGHT; ++i )
+ {
+ dc.DrawLine( mPos.x + xOfs + i,
+ mPos.y + yOfs,
+ mPos.x + xOfs + i + width,
+ mPos.y + yOfs + width );
- dc.DrawLine( mPos.x + xOfs + i + width - 1,
- mPos.y + yOfs,
- mPos.x + xOfs + i - 1,
- mPos.y + yOfs + width );
- }
+ dc.DrawLine( mPos.x + xOfs + i + width - 1,
+ mPos.y + yOfs,
+ mPos.x + xOfs + i - 1,
+ mPos.y + yOfs + width );
+ }
#endif
inline static void my_swap( int& a, int& b )
{
- long tmp = a;
- a = b;
- b = tmp;
+ long tmp = a;
+ a = b;
+ b = tmp;
}
void cbCollapseBox::Draw( wxDC& dc )
{
- cbMiniButton::Draw( dc );
+ cbMiniButton::Draw( dc );
- dc.SetPen( *wxTRANSPARENT_PEN );
+ dc.SetPen( *wxTRANSPARENT_PEN );
- wxPoint arr[3];
+ wxPoint arr[3];
- int yOfs = (mPressed) ? 3 : 2;
- int xOfs = (mPressed) ? 5 : 4;
- int width = BTN_BOX_WIDTH - 8;
+ int yOfs = (mPressed) ? 3 : 2;
+ int xOfs = (mPressed) ? 5 : 4;
+ int width = BTN_BOX_WIDTH - 8;
- // rotating/shifting triangle inside collapse box
+ // rotating/shifting triangle inside collapse box
- arr[0].x = xOfs;
- arr[0].y = yOfs-1;
- arr[2].x = xOfs;
- arr[2].y = BTN_BOX_HEIGHT - yOfs - 1;
- arr[1].x = xOfs + width;
- arr[1].y = (arr[2].y + arr[0].y)/2;
+ arr[0].x = xOfs;
+ arr[0].y = yOfs-1;
+ arr[2].x = xOfs;
+ arr[2].y = BTN_BOX_HEIGHT - yOfs - 1;
+ arr[1].x = xOfs + width;
+ arr[1].y = (arr[2].y + arr[0].y)/2;
- if ( !mIsAtLeft )
- {
- arr[0].x = BTN_BOX_WIDTH - arr[0].x;
- arr[1].x = BTN_BOX_WIDTH - arr[1].x;
- arr[2].x = BTN_BOX_WIDTH - arr[2].x;
- }
+ if ( !mIsAtLeft )
+ {
+ arr[0].x = BTN_BOX_WIDTH - arr[0].x;
+ arr[1].x = BTN_BOX_WIDTH - arr[1].x;
+ arr[2].x = BTN_BOX_WIDTH - arr[2].x;
+ }
- if ( !mpPane->IsHorizontal() )
- {
- my_swap( arr[0].y, arr[0].x );
- my_swap( arr[1].y, arr[1].x );
- my_swap( arr[2].y, arr[2].x );
+ if ( !mpPane->IsHorizontal() )
+ {
+ my_swap( arr[0].y, arr[0].x );
+ my_swap( arr[1].y, arr[1].x );
+ my_swap( arr[2].y, arr[2].x );
- arr[0].x += 1;
- arr[1].x += 1;
- arr[2].x += 1;
+ arr[0].x += 1;
+ arr[1].x += 1;
+ arr[2].x += 1;
- //arr[1].y -= 1;
- }
+ //arr[1].y -= 1;
+ }
- arr[0].x += mPos.x;
- arr[0].y += mPos.y;
- arr[1].x += mPos.x;
- arr[1].y += mPos.y;
- arr[2].x += mPos.x;
- arr[2].y += mPos.y;
+ arr[0].x += mPos.x;
+ arr[0].y += mPos.y;
+ arr[1].x += mPos.x;
+ arr[1].y += mPos.y;
+ arr[2].x += mPos.x;
+ arr[2].y += mPos.y;
- if ( !mEnabled ) dc.SetBrush( *wxGREY_BRUSH );
- else dc.SetBrush( *wxBLACK_BRUSH );
+ if ( !mEnabled ) dc.SetBrush( *wxGREY_BRUSH );
+ else dc.SetBrush( *wxBLACK_BRUSH );
- dc.DrawPolygon( 3, arr );
- dc.SetBrush( wxNullBrush );
+ dc.DrawPolygon( 3, arr );
+ dc.SetBrush( wxNullBrush );
}
/***** Implementation for class cbDockBoxBox *****/
void cbDockBox::Draw( wxDC& dc )
{
- cbMiniButton::Draw( dc );
+ cbMiniButton::Draw( dc );
- int width = BTN_BOX_WIDTH - 7;
+ int width = BTN_BOX_WIDTH - 7;
- int xOfs = (mPressed) ? 4 : 3;
- int yOfs = (mPressed) ? 4 : 3;
+ int xOfs = (mPressed) ? 4 : 3;
+ int yOfs = (mPressed) ? 4 : 3;
- dc.SetPen( *wxBLACK_PEN );
- dc.SetBrush( *wxBLACK_BRUSH );
+ dc.SetPen( *wxBLACK_PEN );
+ dc.SetBrush( *wxBLACK_BRUSH );
- dc.DrawRectangle( mPos.x + xOfs, mPos.y + yOfs, width, width );
+ dc.DrawRectangle( mPos.x + xOfs, mPos.y + yOfs, width, width );
- xOfs += 1;
- yOfs += 1;
+ xOfs += 1;
+ yOfs += 1;
- dc.SetBrush( *wxWHITE_BRUSH );
+ dc.SetBrush( *wxWHITE_BRUSH );
- dc.DrawRectangle( mPos.x + xOfs, mPos.y + yOfs, width-2, width-2 );
+ dc.DrawRectangle( mPos.x + xOfs, mPos.y + yOfs, width-2, width-2 );
}
/***** Implementation for class wxToolWindow *****/
BEGIN_EVENT_TABLE( cbFloatedBarWindow, wxToolWindow )
- EVT_LEFT_DCLICK( cbFloatedBarWindow::OnDblClick )
+ EVT_LEFT_DCLICK( cbFloatedBarWindow::OnDblClick )
END_EVENT_TABLE()
cbFloatedBarWindow::cbFloatedBarWindow()
- : mpBar( NULL )
+ : mpBar( NULL )
{
- AddMiniButton( new cbCloseBox() );
- AddMiniButton( new cbDockBox() );
+ AddMiniButton( new cbCloseBox() );
+ AddMiniButton( new cbDockBox() );
}
void cbFloatedBarWindow::SetBar( cbBarInfo* pBar )
{
- mpBar = pBar;
+ mpBar = pBar;
}
cbBarInfo* cbFloatedBarWindow::GetBar()
{
- return mpBar;
+ return mpBar;
}
void cbFloatedBarWindow::SetLayout( wxFrameLayout* pLayout )
{
- mpLayout = pLayout;
+ mpLayout = pLayout;
}
void cbFloatedBarWindow::PositionFloatedWnd( int scrX, int scrY,
- int width, int height )
+ int width, int height )
{
- wxSize minDim = GetMinimalWndDim();
+ wxSize minDim = GetMinimalWndDim();
- SetSize( scrX - mWndHorizGap - mClntHorizGap,
- scrY - mClntVertGap - mTitleHeight - mWndVertGap,
- width + minDim.x, height + minDim.y, 0 );
+ SetSize( scrX - mWndHorizGap - mClntHorizGap,
+ scrY - mClntVertGap - mTitleHeight - mWndVertGap,
+ width + minDim.x, height + minDim.y, 0 );
}
wxSize cbFloatedBarWindow::GetPreferredSize( const wxSize& given )
{
- if ( mpBar->mDimInfo.GetDimHandler() )
- {
-
- cbBarDimHandlerBase* pHandler = mpBar->mDimInfo.GetDimHandler();
-
- wxSize prefDim;
+ if ( mpBar->mDimInfo.GetDimHandler() )
+ {
+ cbBarDimHandlerBase* pHandler = mpBar->mDimInfo.GetDimHandler();
- // int vtad = *((int*)pHandler);
+ wxSize prefDim;
- pHandler->OnResizeBar( mpBar, given, prefDim );
+ // int vtad = *((int*)pHandler);
- return prefDim;
- }
- else
- {
- if ( mpBar->IsFixed() )
+ pHandler->OnResizeBar( mpBar, given, prefDim );
- return mpBar->mDimInfo.mSizes[ wxCBAR_FLOATING ];
- else
- return given; // not-fixed bars are resized exactly the way user wants
- }
+ return prefDim;
+ }
+ else
+ {
+ if ( mpBar->IsFixed() )
+ return mpBar->mDimInfo.mSizes[ wxCBAR_FLOATING ];
+ else
+ return given; // not-fixed bars are resized exactly the way user wants
+ }
}
void cbFloatedBarWindow::OnMiniButtonClicked( int btnIdx )
{
- // #1 - close mini-button
- // #0 - dock mini-button
-
- if ( btnIdx == 0 )
- {
- mpBar->mAlignment = -1; // sepcial "marking" for hidden bars out of floated state
- mpLayout->SetBarState( mpBar, wxCBAR_HIDDEN, TRUE );
- }
- else
- mpLayout->SetBarState( mpBar, wxCBAR_DOCKED_HORIZONTALLY, TRUE );
+ // #1 - close mini-button
+ // #0 - dock mini-button
+
+ if ( btnIdx == 0 )
+ {
+ mpBar->mAlignment = -1; // sepcial "marking" for hidden bars out of floated state
+ mpLayout->SetBarState( mpBar, wxCBAR_HIDDEN, true );
+ }
+ else
+ mpLayout->SetBarState( mpBar, wxCBAR_DOCKED_HORIZONTALLY, true );
}
bool cbFloatedBarWindow::HandleTitleClick( wxMouseEvent& event )
{
- ReleaseMouse();
- mMouseCaptured = FALSE;
+ ReleaseMouse();
+ mMouseCaptured = false;
+
+ wxPoint scrPos;
+ GetScrMousePos( event, scrPos );
- wxPoint scrPos;
- GetScrMousePos( event, scrPos );
+ int msX = scrPos.x,
+ msY = scrPos.y;
- int msX = scrPos.x,
- msY = scrPos.y;
+ mpLayout->GetParentFrame().ScreenToClient( &msX, &msY );
- mpLayout->GetParentFrame().ScreenToClient( &msX, &msY );
+ int x,y;
+ GetPosition(&x,&y);
+ int w,h;
+ GetSize( &w, &h );
- int x,y;
- GetPosition(&x,&y);
- int w,h;
- GetSize( &w, &h );
+ wxSize minDim = GetMinimalWndDim();
- wxSize minDim = GetMinimalWndDim();
+ w -= minDim.x;
+ h -= minDim.y;
- w -= minDim.x;
- h -= minDim.y;
+ x += mWndHorizGap + mClntHorizGap;
+ y += mWndVertGap + mTitleHeight + mClntVertGap;
- x += mWndHorizGap + mClntHorizGap;
- y += mWndVertGap + mTitleHeight + mClntVertGap;
+ mpLayout->GetParentFrame().ScreenToClient( &x, &y );
- mpLayout->GetParentFrame().ScreenToClient( &x, &y );
+ wxRect& bounds = mpBar->mDimInfo.mBounds[ wxCBAR_FLOATING ];
- wxRect& bounds = mpBar->mDimInfo.mBounds[ wxCBAR_FLOATING ];
+ bounds.x = x;
+ bounds.y = y;
+ bounds.width = w;
+ bounds.height = h;
- bounds.x = x;
- bounds.y = y;
- bounds.width = w;
- bounds.height = h;
+ cbStartBarDraggingEvent dragEvt( mpBar, wxPoint(msX,msY),
+ mpLayout->GetPanesArray()[FL_ALIGN_TOP] );
- cbStartBarDraggingEvent dragEvt( mpBar, wxPoint(msX,msY),
- mpLayout->GetPanesArray()[FL_ALIGN_TOP] );
-
- mpLayout->FirePluginEvent( dragEvt );
+ mpLayout->FirePluginEvent( dragEvt );
- return TRUE;
+ return true;
}
void cbFloatedBarWindow::OnDblClick( wxMouseEvent& WXUNUSED(event) )
{
- mpLayout->SetBarState( mpBar, wxCBAR_DOCKED_HORIZONTALLY, TRUE );
+ mpLayout->SetBarState( mpBar, wxCBAR_DOCKED_HORIZONTALLY, true );
- //wxMessageBox("toolWnd - dblClick!");
+ //wxMessageBox("toolWnd - dblClick!");
}
cbDockPane& pane = *panes[n];
// store pane state
pane.mUMgrData.StoreItemState( pane.mBoundsInParent );
- pane.mUMgrData.SetDirty( FALSE );
+ pane.mUMgrData.SetDirty( false );
for( size_t i = 0; i != pane.GetRowList().Count(); ++i )
{
// store row state
row.mUMgrData.StoreItemState( row.mBoundsInParent );
- row.mUMgrData.SetDirty( FALSE );
+ row.mUMgrData.SetDirty( false );
for( size_t k = 0; k != row.mBars.Count(); ++k )
{
// store bar state
bar.mUMgrData.StoreItemState( bar.mBoundsInParent );
- bar.mUMgrData.SetDirty( FALSE );
+ bar.mUMgrData.SetDirty( false );
}
}
}
wxDC* pDc = NULL;
- bool rowChanged = FALSE;
+ bool rowChanged = false;
// FIXME:: the below should not be fixed
cbBarInfo* barsToRepaint[256];
if ( WasChanged( row.mUMgrData, row.mBoundsInParent ) )
- rowChanged = TRUE;
+ rowChanged = true;
else
for( size_t k = 0; k != row.mBars.Count(); ++k )
pBar->mpBarWnd->Refresh();
// FIXME::
- //info.mpBarWnd->Show(FALSE);
- //info.mpBarWnd->Show(TRUE);
+ //info.mpBarWnd->Show(false);
+ //info.mpBarWnd->Show(true);
}
pNode = pNode->GetNext();