Tidied/commented FL header files, regenerated docs and filled out Category section.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-01-21 22:34:42 +00:00
parent 293a0a8677
commit 4cbc57f086
108 changed files with 7384 additions and 5199 deletions

View File

@@ -1,12 +1,13 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: toolwnd.h
// Purpose: wxToolWindow, cbMiniButton, cbCloseBox, cbCollapseBox,
// cbDockBox, cbFloatedBarWindow class declarations.
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 06/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __TOOLWND_G__
@@ -31,184 +32,272 @@ typedef cbMiniButton* cbMinitButtonPtrT;
WX_DEFINE_ARRAY( cbMinitButtonPtrT, cbMiniButtonArrayT );
/*
A tool window is a special kind of frame that paints its own title, and
can be used to implement small floating windows.
*/
class wxToolWindow : public wxFrame
{
DECLARE_DYNAMIC_CLASS( wxToolWindow )
DECLARE_DYNAMIC_CLASS( wxToolWindow )
public: /** protected really, accessed only by serializers **/
public: /** protected really, accessed only by serializers **/
cbMiniButtonArrayT mButtons;
wxWindow* mpClientWnd;
cbMiniButtonArrayT mButtons;
wxWindow* mpClientWnd;
wxFont mTitleFont;
wxFont mTitleFont;
int mTitleHeight;
int mClntHorizGap;
int mClntVertGap;
int mWndVertGap;
int mWndHorizGap;
int mButtonGap;
int mInTitleMargin;
int mHintBorder;
int mTitleHeight;
int mClntHorizGap;
int mClntVertGap;
int mWndVertGap;
int mWndHorizGap;
int mButtonGap;
int mInTitleMargin;
int mHintBorder;
bool mResizeStarted;
bool mRealTimeUpdatesOn;
bool mResizeStarted;
bool mRealTimeUpdatesOn;
int mMTolerance;
int mMTolerance;
int mCursorType;
bool mMouseCaptured;
int mCursorType;
bool mMouseCaptured;
// drag&drop state variables
// drag&drop state variables
wxPoint mDragOrigin;
wxRect mInitialRect;
wxRect mPrevHintRect;
wxScreenDC* mpScrDc;
wxPoint mDragOrigin;
wxRect mInitialRect;
wxRect mPrevHintRect;
wxScreenDC* mpScrDc;
protected:
void GetScrWindowRect( wxRect& r );
void GetScrMousePos ( wxMouseEvent& event, wxPoint& pos );
void SetHintCursor ( int type );
// Maps client coordinates to screen coordinates.
void GetScrWindowRect( wxRect& r );
void CalcResizedRect( wxRect& rect, wxPoint& delta, const wxSize& minDim );
void AdjustRectPos( const wxRect& original, const wxSize& newDim, wxRect& newRect );
wxSize GetMinimalWndDim();
// Gets the mouse position in screen coordinates.
void GetScrMousePos ( wxMouseEvent& event, wxPoint& pos );
void DrawHintRect( const wxRect& r );
// Sets the hint cursor.
void SetHintCursor ( int type );
int HitTestWindow( wxMouseEvent& event );
// Calculate resized rectangle.
void CalcResizedRect( wxRect& rect, wxPoint& delta, const wxSize& minDim );
void LayoutMiniButtons();
// Helper function.
void AdjustRectPos( const wxRect& original, const wxSize& newDim, wxRect& newRect );
// Helper function.
wxSize GetMinimalWndDim();
// Draws the hint rectangle.
void DrawHintRect( const wxRect& r );
// Tests if the mouse position is in this window.
int HitTestWindow( wxMouseEvent& event );
// Lays out the buttons.
void LayoutMiniButtons();
public:
wxToolWindow();
~wxToolWindow();
void SetClient( wxWindow* pWnd );
wxWindow* GetClient();
// Default constructor.
wxToolWindow();
void SetTitleFont( wxFont& font );
// Destructor.
~wxToolWindow();
// buttons are added in right-to-left order
void AddMiniButton( cbMiniButton* pBtn );
// Sets the client for this tool window.
void SetClient( wxWindow* pWnd );
void OnPaint( wxPaintEvent& event );
// Returns the client window.
wxWindow* GetClient();
void OnMotion( wxMouseEvent& event );
void OnLeftDown( wxMouseEvent& event );
void OnLeftUp( wxMouseEvent& event );
void OnSize( wxSizeEvent& event );
// Sets the title font.
void SetTitleFont( wxFont& font );
void OnEraseBackground( wxEraseEvent& event );
// Adds a button. Buttons are added in right-to-left order.
void AddMiniButton( cbMiniButton* pBtn );
// overridables:
// Responds to a paint event.
void OnPaint( wxPaintEvent& event );
virtual wxSize GetPreferredSize( const wxSize& given );
virtual void OnMiniButtonClicked( int btnIdx ) {}
virtual bool HandleTitleClick( wxMouseEvent& event ) { return FALSE; }
// Responds to a mouse move event.
void OnMotion( wxMouseEvent& event );
DECLARE_EVENT_TABLE()
// Responds to a mouse left down event.
void OnLeftDown( wxMouseEvent& event );
// Responds to a mouse left up event.
void OnLeftUp( wxMouseEvent& event );
// Responds to a size event.
void OnSize( wxSizeEvent& event );
// Responds to an erase background event.
void OnEraseBackground( wxEraseEvent& event );
// Returns the preferred size for the window.
virtual wxSize GetPreferredSize( const wxSize& given );
// Called when a mini button is clicked.
// By default, does nothing.
virtual void OnMiniButtonClicked( int btnIdx ) {}
// Handles clicking on the title. By default, does nothing.
virtual bool HandleTitleClick( wxMouseEvent& event ) { return FALSE; }
DECLARE_EVENT_TABLE()
};
// FIXME:: the code below should be moved to a separate file
#include "wx/fl/controlbar.h"
/*
cbMiniButton is the base class for a small button that can be placed in a wxToolWindow
titlebar.
*/
class cbMiniButton : public wxObject
{
public:
wxPoint mPos;
wxSize mDim;
bool mVisible;
bool mEnabled;
wxPoint mPos;
wxSize mDim;
bool mVisible;
bool mEnabled;
wxFrameLayout* mpLayout;
cbDockPane* mpPane;
cbPluginBase* mpPlugin;
wxFrameLayout* mpLayout;
cbDockPane* mpPane;
cbPluginBase* mpPlugin;
wxWindow* mpWnd;
wxWindow* mpWnd;
bool mWasClicked;
bool mDragStarted;
bool mWasClicked;
bool mDragStarted;
bool mPressed;
bool mPressed;
public:
cbMiniButton();
// Default constructor.
cbMiniButton();
void SetPos( const wxPoint& pos );
bool HitTest( const wxPoint& pos );
// Set the position of the button.
void SetPos( const wxPoint& pos );
void OnLeftDown( const wxPoint& pos );
void OnLeftUp( const wxPoint& pos );
void OnMotion( const wxPoint& pos );
// Returns TRUE if the given position was over the button.
bool HitTest( const wxPoint& pos );
void Refresh();
virtual void Draw( wxDC& dc );
// Responds to a left down event.
void OnLeftDown( const wxPoint& pos );
bool WasClicked();
void Reset();
// Responds to a left up event.
void OnLeftUp( const wxPoint& pos );
void Enable( bool enable ) { mEnabled = enable; }
// Responds to a mouse move event.
void OnMotion( const wxPoint& pos );
bool IsPressed() { return mPressed; }
// Refreshes the button.
void Refresh();
// Draws the button. Override this to implement
// the desired appearance.
virtual void Draw( wxDC& dc );
// Returns TRUE if the button was clicked.
bool WasClicked();
// Reset the button.
void Reset();
// Enable or disable the button.
void Enable( bool enable ) { mEnabled = enable; }
// Returns TRUE if this button is pressed.
bool IsPressed() { return mPressed; }
};
// classes specific to wxFrameLayout engine (FOR NOW in here...)
/*
cbCloseBox is a window close button, used in a wxToolWindow titlebar.
*/
class cbCloseBox : public cbMiniButton
{
public:
virtual void Draw( wxDC& dc );
// Draws the close button appearance.
virtual void Draw( wxDC& dc );
};
/*
cbCollapseBox is a window collapse button, used in a wxToolWindow titlebar.
*/
class cbCollapseBox : public cbMiniButton
{
public:
bool mIsAtLeft;
bool mIsAtLeft;
virtual void Draw( wxDC& dc );
// Draws the collapse button appearance.
virtual void Draw( wxDC& dc );
};
/*
cbDockBox is a window dock button, used in a wxToolWindow titlebar.
*/
class cbDockBox : public cbMiniButton
{
public:
virtual void Draw( wxDC& dc );
// Draws the dock button appearance.
virtual void Draw( wxDC& dc );
};
/*
cbFloatedBarWindow is a kind of wxToolWindow,
implementing floating toolbars.
*/
class cbFloatedBarWindow : public wxToolWindow
{
DECLARE_DYNAMIC_CLASS( cbFloatedBarWindow )
DECLARE_DYNAMIC_CLASS( cbFloatedBarWindow )
protected:
cbBarInfo* mpBar;
wxFrameLayout* mpLayout;
cbBarInfo* mpBar;
wxFrameLayout* mpLayout;
friend class cbFloatedBarWindowSerializer;
friend class cbFloatedBarWindowSerializer;
public:
cbFloatedBarWindow();
// Default constructor.
cbFloatedBarWindow();
void SetBar( cbBarInfo* pBar );
void SetLayout( wxFrameLayout* pLayout );
cbBarInfo* GetBar();
// Sets the bar information for this window.
void SetBar( cbBarInfo* pBar );
// given coordinates are those of the bar itself
// floated container window's position and size
// are ajusted accordingly
// Sets the layout for this window.
void SetLayout( wxFrameLayout* pLayout );
void PositionFloatedWnd( int scrX, int scrY,
int width, int height );
// Returns the bar information for this window.
cbBarInfo* GetBar();
// overriden methods of wxToolWindow
// Position the floating window. The given coordinates
// are those of the bar itself; the floated container window's
// position and size are ajusted accordingly.
void PositionFloatedWnd( int scrX, int scrY,
int width, int height );
virtual wxSize GetPreferredSize( const wxSize& given );
virtual void OnMiniButtonClicked( int btnIdx );
virtual bool HandleTitleClick( wxMouseEvent& event );
// Overridden function returning the preferred size.
virtual wxSize GetPreferredSize( const wxSize& given );
void OnDblClick( wxMouseEvent& event );
// Overridden function responding to mouse clicks on mini-buttons.
virtual void OnMiniButtonClicked( int btnIdx );
DECLARE_EVENT_TABLE()
// Overridden function responding to mouse button clicks on the titlebar.
virtual bool HandleTitleClick( wxMouseEvent& event );
// Responds to double-click mouse events.
void OnDblClick( wxMouseEvent& event );
DECLARE_EVENT_TABLE()
};
#endif /* __TOOLWND_G__ */