Added fl (frame layout) to wxWindows, from source tidied by Hans Van Leemputten <Hansvl@softhome.net>.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
13
contrib/configure
vendored
@@ -812,7 +812,6 @@ done
|
|||||||
ac_given_srcdir=$srcdir
|
ac_given_srcdir=$srcdir
|
||||||
|
|
||||||
trap 'rm -fr `echo "
|
trap 'rm -fr `echo "
|
||||||
Makefile
|
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/ogl/Makefile
|
src/ogl/Makefile
|
||||||
src/mmedia/Makefile
|
src/mmedia/Makefile
|
||||||
@@ -822,6 +821,7 @@ trap 'rm -fr `echo "
|
|||||||
src/gizmos/Makefile
|
src/gizmos/Makefile
|
||||||
src/plot/Makefile
|
src/plot/Makefile
|
||||||
src/applet/Makefile
|
src/applet/Makefile
|
||||||
|
src/fl/Makefile
|
||||||
samples/Makefile
|
samples/Makefile
|
||||||
samples/mmedia/Makefile
|
samples/mmedia/Makefile
|
||||||
samples/ogl/Makefile
|
samples/ogl/Makefile
|
||||||
@@ -838,6 +838,11 @@ trap 'rm -fr `echo "
|
|||||||
samples/xrc/Makefile
|
samples/xrc/Makefile
|
||||||
samples/plot/Makefile
|
samples/plot/Makefile
|
||||||
samples/applet/Makefile
|
samples/applet/Makefile
|
||||||
|
samples/fl/fl_demo1
|
||||||
|
samples/fl/fl_demo2
|
||||||
|
samples/fl/fl_sample1
|
||||||
|
samples/fl/fl_sample2
|
||||||
|
samples/fl/fl_sample3
|
||||||
utils/Makefile
|
utils/Makefile
|
||||||
utils/wxrc/Makefile
|
utils/wxrc/Makefile
|
||||||
utils/wxrcedit/Makefile
|
utils/wxrcedit/Makefile
|
||||||
@@ -930,6 +935,7 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile
|
|||||||
src/gizmos/Makefile
|
src/gizmos/Makefile
|
||||||
src/plot/Makefile
|
src/plot/Makefile
|
||||||
src/applet/Makefile
|
src/applet/Makefile
|
||||||
|
src/fl/Makefile
|
||||||
samples/Makefile
|
samples/Makefile
|
||||||
samples/mmedia/Makefile
|
samples/mmedia/Makefile
|
||||||
samples/ogl/Makefile
|
samples/ogl/Makefile
|
||||||
@@ -946,6 +952,11 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile
|
|||||||
samples/xrc/Makefile
|
samples/xrc/Makefile
|
||||||
samples/plot/Makefile
|
samples/plot/Makefile
|
||||||
samples/applet/Makefile
|
samples/applet/Makefile
|
||||||
|
samples/fl/fl_demo1
|
||||||
|
samples/fl/fl_demo2
|
||||||
|
samples/fl/fl_sample1
|
||||||
|
samples/fl/fl_sample2
|
||||||
|
samples/fl/fl_sample3
|
||||||
utils/Makefile
|
utils/Makefile
|
||||||
utils/wxrc/Makefile
|
utils/wxrc/Makefile
|
||||||
utils/wxrcedit/Makefile
|
utils/wxrcedit/Makefile
|
||||||
|
@@ -37,7 +37,6 @@ dnl File output
|
|||||||
|
|
||||||
|
|
||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
Makefile
|
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/ogl/Makefile
|
src/ogl/Makefile
|
||||||
src/mmedia/Makefile
|
src/mmedia/Makefile
|
||||||
@@ -47,6 +46,7 @@ AC_OUTPUT([
|
|||||||
src/gizmos/Makefile
|
src/gizmos/Makefile
|
||||||
src/plot/Makefile
|
src/plot/Makefile
|
||||||
src/applet/Makefile
|
src/applet/Makefile
|
||||||
|
src/fl/Makefile
|
||||||
samples/Makefile
|
samples/Makefile
|
||||||
samples/mmedia/Makefile
|
samples/mmedia/Makefile
|
||||||
samples/ogl/Makefile
|
samples/ogl/Makefile
|
||||||
@@ -63,6 +63,11 @@ AC_OUTPUT([
|
|||||||
samples/xrc/Makefile
|
samples/xrc/Makefile
|
||||||
samples/plot/Makefile
|
samples/plot/Makefile
|
||||||
samples/applet/Makefile
|
samples/applet/Makefile
|
||||||
|
samples/fl/fl_demo1
|
||||||
|
samples/fl/fl_demo2
|
||||||
|
samples/fl/fl_sample1
|
||||||
|
samples/fl/fl_sample2
|
||||||
|
samples/fl/fl_sample3
|
||||||
utils/Makefile
|
utils/Makefile
|
||||||
utils/wxrc/Makefile
|
utils/wxrc/Makefile
|
||||||
utils/wxrcedit/Makefile
|
utils/wxrcedit/Makefile
|
||||||
|
64
contrib/include/wx/fl/antiflickpl.h
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas (@Lithuania)
|
||||||
|
// Modified by:
|
||||||
|
// Created: 23/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __ANTIFLICKPL_G__
|
||||||
|
#define __ANTIFLICKPL_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "antiflickpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
class cbAntiflickerPlugin : public cbPluginBase
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbAntiflickerPlugin )
|
||||||
|
protected:
|
||||||
|
// double-buffers are shared "resource" among all instances of
|
||||||
|
// antiflicker plugin within the application
|
||||||
|
//
|
||||||
|
// TODO:: locking should be implemented, for multithreaded GUIs
|
||||||
|
|
||||||
|
static wxBitmap* mpVertBuf;
|
||||||
|
static wxBitmap* mpHorizBuf;
|
||||||
|
static wxMemoryDC* mpVertBufDc;
|
||||||
|
static wxMemoryDC* mpHorizBufDc;
|
||||||
|
|
||||||
|
static int mRefCount;
|
||||||
|
|
||||||
|
wxDC* mpLRUBufDc; // last-reacently-used buffer
|
||||||
|
wxRect mLRUArea; // last-reacently-used area
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// returns NULL, if sutable buffer is not present
|
||||||
|
wxDC* FindSuitableBuffer( const wxRect& forArea );
|
||||||
|
wxDC* AllocNewBuffer( const wxRect& forArea );
|
||||||
|
wxDC& GetWindowDC();
|
||||||
|
|
||||||
|
wxDC& GetClientDC();
|
||||||
|
public:
|
||||||
|
|
||||||
|
cbAntiflickerPlugin(void);
|
||||||
|
|
||||||
|
cbAntiflickerPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||||
|
|
||||||
|
virtual ~cbAntiflickerPlugin();
|
||||||
|
|
||||||
|
// handlers for plugin events
|
||||||
|
|
||||||
|
void OnStartDrawInArea ( cbStartDrawInAreaEvent& event );
|
||||||
|
void OnFinishDrawInArea( cbFinishDrawInAreaEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __ANTIFLICKPL_G__ */
|
||||||
|
|
122
contrib/include/wx/fl/bardragpl.h
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 23/09/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __BARDRAGPL_G__
|
||||||
|
#define __BARDRAGPL_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "bardragpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
#include "wx/fl/toolwnd.h"
|
||||||
|
|
||||||
|
class cbBarDragPlugin : public cbPluginBase
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbBarDragPlugin )
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// plugin is active only in bar-dragging state
|
||||||
|
bool mBarDragStarted;
|
||||||
|
bool mCanStick; // flag used to prevent "bouncing" of hint-rectangle
|
||||||
|
wxScreenDC* mpScrDc; // created while tracking hint-rect
|
||||||
|
wxCursor* mpCurCursor;
|
||||||
|
|
||||||
|
// rectnagle shows the position/dimensions of the bar,
|
||||||
|
// if it would be docked now
|
||||||
|
|
||||||
|
wxRect mPrevHintRect;
|
||||||
|
wxRect mHintRect;
|
||||||
|
|
||||||
|
|
||||||
|
int mMouseInRectX;
|
||||||
|
int mMouseInRectY;
|
||||||
|
|
||||||
|
cbDockPane* mpSrcPane; // pane, from which the bar was originally taken
|
||||||
|
int mBarWidthInSrcPane;
|
||||||
|
|
||||||
|
cbDockPane* mpCurPane;
|
||||||
|
|
||||||
|
cbBarInfo* mpDraggedBar; // bar, which is being dragged
|
||||||
|
bool mBarWasFloating;
|
||||||
|
wxRect mFloatedBarBounds;
|
||||||
|
|
||||||
|
public: /*** public properties ***/
|
||||||
|
|
||||||
|
int mInClientHintBorder; // when hint-rect moves within client window area,
|
||||||
|
// the thicker rectangle is drawn using hatched brush,
|
||||||
|
// the default border width for this rectangle is 8 pix.
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
void AdjustHintRect( wxPoint& mousePos );
|
||||||
|
|
||||||
|
void ClipRectInFrame( wxRect& rect );
|
||||||
|
void ClipPosInFrame( wxPoint& pos );
|
||||||
|
|
||||||
|
cbDockPane* HitTestPanes( wxRect& rect );
|
||||||
|
cbDockPane* HitTestPanes( wxPoint& pos );
|
||||||
|
bool HitsPane( cbDockPane* pPane, wxRect& rect );
|
||||||
|
|
||||||
|
void CalcOnScreenDims( wxRect& rect );
|
||||||
|
|
||||||
|
int GetDistanceToPane( cbDockPane* pPane, wxPoint& mousePos );
|
||||||
|
|
||||||
|
bool IsInOtherPane ( wxPoint& mousePos );
|
||||||
|
bool IsInClientArea( wxPoint& mousePos );
|
||||||
|
bool IsInClientArea( wxRect& rect );
|
||||||
|
|
||||||
|
void StickToPane( cbDockPane* pPane, wxPoint& mousePos );
|
||||||
|
void UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos );
|
||||||
|
|
||||||
|
int GetBarWidthInPane( cbDockPane* pPane );
|
||||||
|
int GetBarHeightInPane( cbDockPane* pPane );
|
||||||
|
|
||||||
|
// on-screen hint-tracking related methods
|
||||||
|
|
||||||
|
void StartTracking();
|
||||||
|
|
||||||
|
void DrawHintRect ( wxRect& rect, bool isInClientRect);
|
||||||
|
void EraseHintRect( wxRect& rect, bool isInClientRect);
|
||||||
|
|
||||||
|
void FinishTracking();
|
||||||
|
|
||||||
|
void DoDrawHintRect( wxRect& rect, bool isInClientRect);
|
||||||
|
|
||||||
|
void RectToScr( wxRect& frameRect, wxRect& scrRect );
|
||||||
|
|
||||||
|
void ShowHint( bool prevWasInClient );
|
||||||
|
|
||||||
|
public:
|
||||||
|
cbBarDragPlugin(void);
|
||||||
|
|
||||||
|
cbBarDragPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||||
|
|
||||||
|
virtual ~cbBarDragPlugin();
|
||||||
|
|
||||||
|
// handlers for plugin events
|
||||||
|
|
||||||
|
void OnMouseMove( cbMotionEvent& event );
|
||||||
|
void OnLButtonUp( cbLeftUpEvent& event );
|
||||||
|
void OnLButtonDown( cbLeftDownEvent& event );
|
||||||
|
void OnLDblClick( cbLeftDClickEvent& event );
|
||||||
|
|
||||||
|
// handles event, which oriniates from itself
|
||||||
|
void OnDrawHintRect( cbDrawHintRectEvent& event );
|
||||||
|
|
||||||
|
void OnStartBarDragging( cbStartBarDraggingEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __BARDRAGPL_G__ */
|
||||||
|
|
96
contrib/include/wx/fl/barhintspl.h
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 30/11/98 (my 22th birthday :-)
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __DRAGHINTSPL_G__
|
||||||
|
#define __DRAGHINTSPL_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "barhintspl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
#include "wx/fl/toolwnd.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Intercepts bar-decoration and sizing events, draws 3d-hints
|
||||||
|
* around fixed and flexible bars, similar to those in Microsoft DevStudio 6.x
|
||||||
|
*/
|
||||||
|
|
||||||
|
class cbBarHintsPlugin : public cbPluginBase
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbBarHintsPlugin )
|
||||||
|
|
||||||
|
protected:
|
||||||
|
cbDockPane* mpPane; // is set up temorarely, while handling event
|
||||||
|
|
||||||
|
cbMiniButton* mBoxes[2];
|
||||||
|
|
||||||
|
bool mBtnPressed;
|
||||||
|
bool mClosePressed;
|
||||||
|
cbBarInfo* mpClickedBar;
|
||||||
|
bool mDepressed;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// drawing helpers
|
||||||
|
|
||||||
|
void Draw3DBox ( wxDC& dc, const wxPoint& pos, bool pressed );
|
||||||
|
void DrawCloseBox ( wxDC& dc, const wxPoint& pos, bool pressed );
|
||||||
|
void DrawCollapseBox( wxDC& dc, const wxPoint& pos,
|
||||||
|
bool atLeft, bool disabled, bool pressed );
|
||||||
|
|
||||||
|
void DrawGrooves ( wxDC& dc, const wxPoint& pos, int length );
|
||||||
|
|
||||||
|
void DoDrawHint( wxDC& dc, wxRect& rect, int pos, int boxOfs, int grooveOfs, bool isFixed );
|
||||||
|
|
||||||
|
void GetHintsLayout( wxRect& rect, cbBarInfo& info,
|
||||||
|
int& boxOfs, int& grooveOfs, int& pos );
|
||||||
|
|
||||||
|
int HitTestHints( cbBarInfo& info, const wxPoint& pos );
|
||||||
|
|
||||||
|
void ExcludeHints( wxRect& rect, cbBarInfo& info );
|
||||||
|
|
||||||
|
void CreateBoxes();
|
||||||
|
|
||||||
|
public:
|
||||||
|
/* public properties */
|
||||||
|
|
||||||
|
bool mCloseBoxOn; // default: ON
|
||||||
|
bool mCollapseBoxOn; // default: ON
|
||||||
|
int mGrooveCount; // default: 2 (two shaded bars)
|
||||||
|
int mHintGap; // default: 5 (pixels from above, below, right and left)
|
||||||
|
int mXWeight; // default: 2 (width in pixels of lines which used for drawing cross)
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
cbBarHintsPlugin(void);
|
||||||
|
|
||||||
|
cbBarHintsPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
|
||||||
|
|
||||||
|
~cbBarHintsPlugin();
|
||||||
|
|
||||||
|
void SetGrooveCount( int nGrooves );
|
||||||
|
|
||||||
|
void OnInitPlugin();
|
||||||
|
|
||||||
|
// handlers of plugin-events
|
||||||
|
|
||||||
|
void OnSizeBarWindow( cbSizeBarWndEvent& event );
|
||||||
|
void OnDrawBarDecorations( cbDrawBarDecorEvent& event );
|
||||||
|
|
||||||
|
void OnLeftDown( cbLeftDownEvent& event );
|
||||||
|
void OnLeftUp ( cbLeftUpEvent& event );
|
||||||
|
void OnMotion ( cbMotionEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __DRAGHINTSPL_G__ */
|
||||||
|
|
47
contrib/include/wx/fl/cbcustom.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 28/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __CBCUSTOM_G__
|
||||||
|
#define __CBCUSTOM_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "cbcustom.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
class cbSimpleCustomizationPlugin : public cbPluginBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbSimpleCustomizationPlugin )
|
||||||
|
|
||||||
|
int mCustMenuItemId;
|
||||||
|
public:
|
||||||
|
|
||||||
|
cbSimpleCustomizationPlugin(void);
|
||||||
|
|
||||||
|
cbSimpleCustomizationPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||||
|
|
||||||
|
// plugin-event handlers
|
||||||
|
|
||||||
|
void OnCustomizeBar( cbCustomizeBarEvent& event );
|
||||||
|
|
||||||
|
void OnCustomizeLayout( cbCustomizeLayoutEvent& event );
|
||||||
|
|
||||||
|
// menu-event handler
|
||||||
|
|
||||||
|
void OnMenuItemSelected( wxCommandEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __CBCUSTOM_G__ */
|
||||||
|
|
1740
contrib/include/wx/fl/controlbar.h
Normal file
22
contrib/include/wx/fl/dynbarhnd.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 23/01/99
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __DYNBARHND_G__
|
||||||
|
#define __DYNBARHND_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "dynbarhnd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
#endif /* __DYNBARHND_G__ */
|
||||||
|
|
204
contrib/include/wx/fl/dyntbar.h
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: ??/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __DYNTBAR_G__
|
||||||
|
#define __DYNTBAR_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "dyntbar.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/tbarbase.h"
|
||||||
|
#include "wx/dynarray.h"
|
||||||
|
|
||||||
|
// layout item
|
||||||
|
|
||||||
|
class wxToolLayoutItem : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxRect mRect;
|
||||||
|
bool mIsSeparator;
|
||||||
|
};
|
||||||
|
|
||||||
|
class wxDynToolInfo;
|
||||||
|
|
||||||
|
typedef wxToolLayoutItem* wxToolLayoutItemPtrT;
|
||||||
|
typedef wxDynToolInfo* wxDynToolInfoPtrT;
|
||||||
|
|
||||||
|
|
||||||
|
WX_DEFINE_ARRAY( wxToolLayoutItemPtrT, wxLayoutItemArrayT );
|
||||||
|
WX_DEFINE_ARRAY( wxDynToolInfoPtrT, wxDynToolInfoArrayT );
|
||||||
|
|
||||||
|
// base class for layouting algorithm implementations
|
||||||
|
|
||||||
|
class LayoutManagerBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void Layout( const wxSize& parentDim,
|
||||||
|
wxSize& resultingDim,
|
||||||
|
wxLayoutItemArrayT& items,
|
||||||
|
int horizGap,
|
||||||
|
int vertGap ) = 0;
|
||||||
|
|
||||||
|
virtual ~LayoutManagerBase() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
// layouts items in left-to-right order from
|
||||||
|
// top towards bottom
|
||||||
|
|
||||||
|
class BagLayout : public LayoutManagerBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void Layout( const wxSize& parentDim,
|
||||||
|
wxSize& resultingDim,
|
||||||
|
wxLayoutItemArrayT& items,
|
||||||
|
int horizGap,
|
||||||
|
int vertGap );
|
||||||
|
};
|
||||||
|
|
||||||
|
class wxDynToolInfo : public wxToolLayoutItem
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxDynToolInfo)
|
||||||
|
|
||||||
|
public:
|
||||||
|
wxWindow* mpToolWnd;
|
||||||
|
int mIndex;
|
||||||
|
wxSize mRealSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
// layouting orientations for tools
|
||||||
|
|
||||||
|
#define LO_HORIZONTAL 0
|
||||||
|
#define LO_VERTICAL 1
|
||||||
|
#define LO_FIT_TO_WINDOW 2
|
||||||
|
|
||||||
|
// class manages containment and layouting of tool-windows
|
||||||
|
|
||||||
|
class wxDynamicToolBar : public wxToolBarBase
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxDynamicToolBar)
|
||||||
|
protected:
|
||||||
|
|
||||||
|
friend class wxDynamicToolBarSerializer;
|
||||||
|
|
||||||
|
wxDynToolInfoArrayT mTools;
|
||||||
|
LayoutManagerBase* mpLayoutMan;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void SizeToolWindows();
|
||||||
|
|
||||||
|
public: /* public properties */
|
||||||
|
|
||||||
|
int mSepartorSize; // default: 8
|
||||||
|
int mVertGap; // default: 0
|
||||||
|
int mHorizGap; // default: 0
|
||||||
|
|
||||||
|
public:
|
||||||
|
wxDynamicToolBar();
|
||||||
|
|
||||||
|
wxDynamicToolBar(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
|
const long style = wxNO_BORDER, const int orientation = wxVERTICAL,
|
||||||
|
const int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
|
||||||
|
|
||||||
|
~wxDynamicToolBar(void);
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
|
const long style = wxNO_BORDER, const int orientation = wxVERTICAL, const int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
|
||||||
|
|
||||||
|
// overridables
|
||||||
|
|
||||||
|
virtual void AddTool( int toolIndex,
|
||||||
|
wxWindow* pToolWindow,
|
||||||
|
const wxSize& size = wxDefaultSize );
|
||||||
|
|
||||||
|
virtual void AddTool( int toolIndex,
|
||||||
|
const wxString& imageFileName,
|
||||||
|
int imageFileType = wxBITMAP_TYPE_BMP,
|
||||||
|
const wxString& labelText = "", bool alignTextRight = FALSE,
|
||||||
|
bool isFlat = TRUE );
|
||||||
|
virtual void AddTool( int toolIndex, wxBitmap labelBmp,
|
||||||
|
const wxString& labelText = "", bool alignTextRight = FALSE,
|
||||||
|
bool isFlat = TRUE );
|
||||||
|
|
||||||
|
// method from wxToolBarBase (for compatibility), only
|
||||||
|
// first two arguments are valid
|
||||||
|
|
||||||
|
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 wxString& helpString1 = "", const wxString& helpString2 = "");
|
||||||
|
|
||||||
|
virtual void AddSeparator( wxWindow* pSepartorWnd = NULL );
|
||||||
|
|
||||||
|
wxDynToolInfo* GetToolInfo( int toolIndex );
|
||||||
|
|
||||||
|
void RemveTool( int toolIndex );
|
||||||
|
|
||||||
|
// the default implementation draws shaded line
|
||||||
|
virtual void DrawSeparator( wxDynToolInfo& info, wxDC& dc );
|
||||||
|
|
||||||
|
// see definitions of orientation types
|
||||||
|
virtual bool Layout();
|
||||||
|
|
||||||
|
virtual void GetPreferredDim( const wxSize& givenDim, wxSize& prefDim );
|
||||||
|
|
||||||
|
virtual LayoutManagerBase* CreateDefaulLayout() { return new BagLayout(); }
|
||||||
|
|
||||||
|
virtual void SetLayout( LayoutManagerBase* pLayout );
|
||||||
|
|
||||||
|
virtual void EnableTool(const int toolIndex, const bool enable = TRUE);
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
|
||||||
|
void OnSize( wxSizeEvent& event );
|
||||||
|
void OnPaint( wxPaintEvent& event );
|
||||||
|
void OnEraseBackground( wxEraseEvent& event );
|
||||||
|
|
||||||
|
// overriden from wxToolBarBase
|
||||||
|
|
||||||
|
virtual bool Realize(void);
|
||||||
|
|
||||||
|
// stuff from the 2.1.15
|
||||||
|
|
||||||
|
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x,
|
||||||
|
wxCoord y) const;
|
||||||
|
|
||||||
|
|
||||||
|
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
|
||||||
|
|
||||||
|
// the tool is still in m_tools list when this function is called, it will
|
||||||
|
// only be deleted from it if it succeeds
|
||||||
|
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
|
||||||
|
|
||||||
|
// called when the tools enabled flag changes
|
||||||
|
virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
|
||||||
|
|
||||||
|
// called when the tool is toggled
|
||||||
|
virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
|
||||||
|
|
||||||
|
// called when the tools "can be toggled" flag changes
|
||||||
|
virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
|
||||||
|
|
||||||
|
// the functions to create toolbar tools
|
||||||
|
virtual wxToolBarToolBase *CreateTool(int id,
|
||||||
|
const wxBitmap& bitmap1,
|
||||||
|
const wxBitmap& bitmap2,
|
||||||
|
bool toggle,
|
||||||
|
wxObject *clientData,
|
||||||
|
const wxString& shortHelpString,
|
||||||
|
const wxString& longHelpString);
|
||||||
|
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
||||||
|
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __DYNTBAR_G__ */
|
||||||
|
|
31
contrib/include/wx/fl/dyntbarhnd.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 23/01/99
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __DYNTBARHND_G__
|
||||||
|
#define __DYNTBARHND_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "dyntbarhnd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
#include "wx/fl/dyntbar.h"
|
||||||
|
|
||||||
|
class cbDynToolBarDimHandler : public cbBarDimHandlerBase
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbDynToolBarDimHandler )
|
||||||
|
public:
|
||||||
|
void OnChangeBarState(cbBarInfo* pBar, int newState );
|
||||||
|
void OnResizeBar( cbBarInfo* pBar, const wxSize& given, wxSize& preferred );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __DYNTBARHND_G__ */
|
||||||
|
|
140
contrib/include/wx/fl/frmview.h
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 02/01/99
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __FRMVIEW_G__
|
||||||
|
#define __FRMVIEW_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "frmview.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/module.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#include "wx/fl/objstore.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class wxObjectStorage;
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
class wxFrameManager;
|
||||||
|
|
||||||
|
class wxFrameView : public wxEvtHandler
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
wxStringList mTopMenus;
|
||||||
|
wxFrameLayout* mpLayout;
|
||||||
|
wxFrameManager* mpFrameMgr;
|
||||||
|
bool mDoToolUpdates;
|
||||||
|
|
||||||
|
friend class wxFrameManager;
|
||||||
|
friend class wxFrameViewSerializer;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void OnIdle( wxIdleEvent& event);
|
||||||
|
|
||||||
|
public:
|
||||||
|
wxFrameView();
|
||||||
|
~wxFrameView();
|
||||||
|
|
||||||
|
virtual void Activate();
|
||||||
|
virtual void Deactivate();
|
||||||
|
|
||||||
|
wxFrame* GetParentFrame();
|
||||||
|
wxWindow* GetClientWindow();
|
||||||
|
|
||||||
|
wxFrameManager& GetFrameManager();
|
||||||
|
|
||||||
|
void RegisterMenu( const wxString& topMenuName );
|
||||||
|
|
||||||
|
void CreateLayout();
|
||||||
|
wxFrameLayout* GetLayout();
|
||||||
|
void SetLayout( wxFrameLayout* pLayout );
|
||||||
|
void SetToolUpdates( bool doToolUpdates = TRUE );
|
||||||
|
|
||||||
|
|
||||||
|
// hooks for specific frame-views
|
||||||
|
|
||||||
|
virtual void OnInit() {}
|
||||||
|
|
||||||
|
virtual void OnSerialize( wxObjectStorage& store ) {}
|
||||||
|
virtual void OnActiveate() {}
|
||||||
|
virtual void OnDeactivate() {}
|
||||||
|
|
||||||
|
// imp. is mandatory
|
||||||
|
virtual void OnRecreate() {}
|
||||||
|
virtual void OnInitMenus() {}
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
class wxFrame;
|
||||||
|
|
||||||
|
class wxFrameManager : wxObject
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
wxList mViews;
|
||||||
|
wxWindow* mpFrameWnd;
|
||||||
|
int mActiveViewNo;
|
||||||
|
wxWindow* mpClientWnd;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
wxObjectStorage mStore;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wxString mSettingsFile;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void DoSerialize( wxObjectStorage& store );
|
||||||
|
void DestroyViews();
|
||||||
|
int GetViewNo( wxFrameView* pView );
|
||||||
|
void EnableMenusForView( wxFrameView* pView, bool enable );
|
||||||
|
void SyncAllMenus();
|
||||||
|
|
||||||
|
public:
|
||||||
|
wxFrameManager();
|
||||||
|
~wxFrameManager();
|
||||||
|
|
||||||
|
// if file name is empty, views are are not saved/loaded
|
||||||
|
|
||||||
|
virtual void Init( wxWindow* pMainFrame, const wxString& settingsFile = "" );
|
||||||
|
|
||||||
|
// synonyms
|
||||||
|
wxFrame* GetParentFrame();
|
||||||
|
wxWindow* GetParentWindow();
|
||||||
|
|
||||||
|
int GetActiveViewNo();
|
||||||
|
wxFrameView* GetActiveView();
|
||||||
|
wxNode* GetActiveViewNode();
|
||||||
|
|
||||||
|
wxFrameView* GetView( int viewNo );
|
||||||
|
|
||||||
|
void SetClinetWindow( wxWindow* pFrameClient );
|
||||||
|
wxWindow* GetClientWindow();
|
||||||
|
|
||||||
|
void AddView( wxFrameView* pFrmView );
|
||||||
|
void RemoveView( wxFrameView* pFrmView );
|
||||||
|
|
||||||
|
void ActivateView( int viewNo );
|
||||||
|
void ActivateView( wxFrameView* pFrmView );
|
||||||
|
void DeactivateCurrentView();
|
||||||
|
|
||||||
|
wxObjectStorage& GetObjectStore();
|
||||||
|
|
||||||
|
void SaveViewsNow();
|
||||||
|
bool ReloadViews();
|
||||||
|
|
||||||
|
bool ViewsAreLoaded();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __FRMVIEW_G__ */
|
||||||
|
|
74
contrib/include/wx/fl/garbagec.h
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas (@Lithuania)
|
||||||
|
// Modified by:
|
||||||
|
// Created: ??/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __GARBAGEC_G__
|
||||||
|
#define __GARBAGEC_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "garbagec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/list.h"
|
||||||
|
|
||||||
|
struct GCItem
|
||||||
|
{
|
||||||
|
void* mpObj;
|
||||||
|
wxList mRefs; // references to other nodes
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void* gc_node_to_obj( wxNode* pGCNode )
|
||||||
|
{
|
||||||
|
return ( (GCItem*) (pGCNode->Data()) )->mpObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// class implements extremely slow, but probably one of the most simple GC algorithms
|
||||||
|
|
||||||
|
class GarbageCollector
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
wxList mAllNodes;
|
||||||
|
wxList mRegularLst;
|
||||||
|
wxList mCycledLst;
|
||||||
|
|
||||||
|
wxNode* FindItemNode( void* pForObj );
|
||||||
|
void ResolveReferences();
|
||||||
|
|
||||||
|
wxNode* FindReferenceFreeItemNode();
|
||||||
|
void RemoveReferencesToNode( wxNode* pItemNode );
|
||||||
|
void DestroyItemList( wxList& lst );
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GarbageCollector() {}
|
||||||
|
|
||||||
|
virtual ~GarbageCollector();
|
||||||
|
|
||||||
|
// prepare data for GC alg.
|
||||||
|
|
||||||
|
virtual void AddObject( void* pObj, int refCnt = 1 );
|
||||||
|
virtual void AddDependency( void* pObj, void* pDependsOnObj );
|
||||||
|
|
||||||
|
// executes GC alg.
|
||||||
|
|
||||||
|
virtual void ArrangeCollection();
|
||||||
|
|
||||||
|
// access results of the alg.
|
||||||
|
|
||||||
|
wxList& GetRegularObjects();
|
||||||
|
wxList& GetCycledObjects();
|
||||||
|
|
||||||
|
// removes all data from GC
|
||||||
|
|
||||||
|
void Reset();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __GARBAGEC_G__ */
|
||||||
|
|
123
contrib/include/wx/fl/gcupdatesmgr.h
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 19/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __GCUPDATESMGR_G__
|
||||||
|
#define __GCUPDATESMGR_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "gcupdatesmgr.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
#include "wx/fl/updatesmgr.h"
|
||||||
|
|
||||||
|
#include "wx/fl/garbagec.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* class implements optimized logic for refreshing
|
||||||
|
* areas of frame layout - which actually need to be updated.
|
||||||
|
* Is used as default updates-manager by wxFrameLayout.
|
||||||
|
*
|
||||||
|
* it is called "Garbage Collecting" u.mgr for it's implementation
|
||||||
|
* tries to find out dependencies between bars, and to order
|
||||||
|
* them ito "hierarchy", this hierarchical sorting resembles
|
||||||
|
* implemenation of heap-garbage collectors, which resolve
|
||||||
|
* dependencies between references.
|
||||||
|
*
|
||||||
|
* Example: there are situations where the order of moving
|
||||||
|
* the windows does matter:
|
||||||
|
*
|
||||||
|
* case 1)
|
||||||
|
* ------ ---
|
||||||
|
* | A | |B|
|
||||||
|
* ------ ---> | |
|
||||||
|
* --- --- ------
|
||||||
|
* |B| | A |
|
||||||
|
* | | ------
|
||||||
|
* ---
|
||||||
|
* (future)
|
||||||
|
* (past)
|
||||||
|
*
|
||||||
|
* past/future positions of A and B windows completely overlapp, i.e.
|
||||||
|
* depend on each other, and there is not solution for
|
||||||
|
* moving the windows witout refreshing both of them,
|
||||||
|
* -- we have cyclic dependency here. The gc. alg will
|
||||||
|
* find this cyclic dependecy and will force "refresh"
|
||||||
|
* after movement.
|
||||||
|
*
|
||||||
|
* case 2)
|
||||||
|
*
|
||||||
|
* ------
|
||||||
|
* | A |
|
||||||
|
* ------ --->
|
||||||
|
* ---
|
||||||
|
* |B| ------
|
||||||
|
* | | | A |
|
||||||
|
* --- ------
|
||||||
|
* ---
|
||||||
|
* |B|
|
||||||
|
* | |
|
||||||
|
* ---
|
||||||
|
*
|
||||||
|
* (future)
|
||||||
|
* (past)
|
||||||
|
*
|
||||||
|
* in this case past/future positions do not overlapp, thus
|
||||||
|
* it's enough only to move windows, without refreshing them.
|
||||||
|
* GC will "notice" it.
|
||||||
|
*
|
||||||
|
* there is also third case, when overlapping is partial
|
||||||
|
* in this case the refershing can be also avoided by
|
||||||
|
* moving windows in the order of "most-dependant" towards the
|
||||||
|
* "least-dependent". GC handles this automatically, by
|
||||||
|
* sorting windows by their dependency-level (or "hierarchy")
|
||||||
|
*
|
||||||
|
* See garbagec.h for more details of this method, garbagec.h/cpp
|
||||||
|
* implement sorting of generic-dependencies (does not deal
|
||||||
|
* with graphical objects directly)
|
||||||
|
*
|
||||||
|
* Summary: improves performance when complex/large windows are
|
||||||
|
* moved around, by reducing number of repaints. Also helps
|
||||||
|
* to avoid dirty non-client areas of moved windows
|
||||||
|
* in some special cases of "overlapping anomalies"
|
||||||
|
*/
|
||||||
|
|
||||||
|
class cbGCUpdatesMgr : public cbSimpleUpdatesMgr
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbGCUpdatesMgr )
|
||||||
|
protected:
|
||||||
|
|
||||||
|
GarbageCollector mGC;
|
||||||
|
|
||||||
|
void DoRepositionItems( wxList& items );
|
||||||
|
|
||||||
|
void AddItem( wxList& itemList,
|
||||||
|
cbBarInfo* pBar,
|
||||||
|
cbDockPane* pPane,
|
||||||
|
wxRect& curBounds,
|
||||||
|
wxRect& prevBounds );
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
cbGCUpdatesMgr(void) {}
|
||||||
|
|
||||||
|
cbGCUpdatesMgr( wxFrameLayout* pPanel );
|
||||||
|
|
||||||
|
// notificiactions received from Frame Layout :
|
||||||
|
|
||||||
|
virtual void OnStartChanges();
|
||||||
|
|
||||||
|
// refreshes parts of the frame layout, which need an update
|
||||||
|
virtual void UpdateNow();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __GCUPDATESMGR_G__ */
|
||||||
|
|
120
contrib/include/wx/fl/hintanimpl.h
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 9/11/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __HINTANIMPL_G__
|
||||||
|
#define __HINTANIMPL_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "hintanimpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
#include "wx/timer.h"
|
||||||
|
|
||||||
|
class cbHintAnimTimer;
|
||||||
|
|
||||||
|
class cbHintAnimationPlugin : public cbPluginBase
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbHintAnimationPlugin )
|
||||||
|
protected:
|
||||||
|
friend class cbHintAnimTimer;
|
||||||
|
|
||||||
|
wxScreenDC* mpScrDc; // created while tracking hint-rect
|
||||||
|
cbHintAnimTimer* mpAnimTimer;
|
||||||
|
|
||||||
|
// FOR NOW:: try it without mutually exculisve locks
|
||||||
|
volatile wxRect mCurRect;
|
||||||
|
|
||||||
|
// state variables
|
||||||
|
|
||||||
|
bool mAnimStarted;
|
||||||
|
bool mStopPending;
|
||||||
|
|
||||||
|
bool mPrevInClient;
|
||||||
|
bool mCurInClient;
|
||||||
|
|
||||||
|
wxRect mPrevRect;
|
||||||
|
|
||||||
|
public:
|
||||||
|
int mMorphDelay; // delay between frames in miliseconds, default: 20
|
||||||
|
int mMaxFrames; // number of iterations for hint morphing, default: 30
|
||||||
|
// (morph duration = mMorphDelay * mMaxFrames msec)
|
||||||
|
|
||||||
|
int mInClientHintBorder; // default: 4 pixels
|
||||||
|
|
||||||
|
bool mAccelerationOn; // TRUE, if morph accelerates, otherwise morph
|
||||||
|
// speed is constant. Default: TRUE
|
||||||
|
|
||||||
|
// TBD:: get/set methods for above members
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void StartTracking();
|
||||||
|
|
||||||
|
void DrawHintRect ( wxRect& rect, bool isInClientRect);
|
||||||
|
void EraseHintRect( wxRect& rect, bool isInClientRect);
|
||||||
|
|
||||||
|
void FinishTracking();
|
||||||
|
|
||||||
|
void DoDrawHintRect( wxRect& rect, bool isInClientRect);
|
||||||
|
|
||||||
|
void RectToScr( wxRect& frameRect, wxRect& scrRect );
|
||||||
|
|
||||||
|
public:
|
||||||
|
cbHintAnimationPlugin(void);
|
||||||
|
|
||||||
|
~cbHintAnimationPlugin();
|
||||||
|
|
||||||
|
cbHintAnimationPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||||
|
|
||||||
|
void OnDrawHintRect( cbDrawHintRectEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// helper classes
|
||||||
|
|
||||||
|
struct MorphInfoT
|
||||||
|
{
|
||||||
|
wxPoint mFrom;
|
||||||
|
wxPoint mTill;
|
||||||
|
};
|
||||||
|
|
||||||
|
class cbHintAnimTimer : public wxTimer
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
friend class cbHintAnimationPlugin;
|
||||||
|
|
||||||
|
wxRect mPrevMorphed;
|
||||||
|
|
||||||
|
MorphInfoT mUpperLeft;
|
||||||
|
MorphInfoT mLowerRight;
|
||||||
|
int mCurIter;
|
||||||
|
|
||||||
|
long mLock;
|
||||||
|
|
||||||
|
cbHintAnimationPlugin* mpPl;
|
||||||
|
|
||||||
|
void MorphPoint( wxPoint& origin, MorphInfoT& info, wxPoint& point );
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
cbHintAnimTimer(void);
|
||||||
|
|
||||||
|
virtual void Notify(void);
|
||||||
|
|
||||||
|
virtual bool Init( cbHintAnimationPlugin* pAnimPl, bool reinit );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __HINTANIMPL_G__ */
|
||||||
|
|
165
contrib/include/wx/fl/newbmpbtn.h
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: ??/09/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __NEWBMPBTN_G__
|
||||||
|
#define __NEWBMPBTN_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "newbmpbtn.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/button.h"
|
||||||
|
#include "wx/string.h"
|
||||||
|
|
||||||
|
// button lable-text alignment types
|
||||||
|
|
||||||
|
#define NB_ALIGN_TEXT_RIGHT 0
|
||||||
|
#define NB_ALIGN_TEXT_BOTTOM 1
|
||||||
|
#define NB_NO_TEXT 2
|
||||||
|
#define NB_NO_IMAGE 3
|
||||||
|
|
||||||
|
// classes declared in this header file
|
||||||
|
|
||||||
|
class wxNewBitmapButton;
|
||||||
|
class wxBorderLessBitmapButton;
|
||||||
|
|
||||||
|
// alternative class for wxBmpButton
|
||||||
|
|
||||||
|
class wxNewBitmapButton: public wxPanel
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxNewBitmapButton)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
friend class wxNewBitmapButtonSerializer;
|
||||||
|
|
||||||
|
int mTextToLabelGap;
|
||||||
|
int mMarginX;
|
||||||
|
int mMarginY;
|
||||||
|
int mTextAlignment;
|
||||||
|
bool mIsSticky;
|
||||||
|
bool mIsFlat;
|
||||||
|
|
||||||
|
wxString mLabelText;
|
||||||
|
wxString mImageFileName;
|
||||||
|
int mImageFileType;
|
||||||
|
|
||||||
|
wxBitmap mDepressedBmp; // source image for rendering
|
||||||
|
// labels for particular state
|
||||||
|
|
||||||
|
wxBitmap mFocusedBmp; // may not be always present -
|
||||||
|
// only if mHasFocusedBmp is TRUE
|
||||||
|
|
||||||
|
wxBitmap* mpDepressedImg;
|
||||||
|
wxBitmap* mpPressedImg;
|
||||||
|
wxBitmap* mpDisabledImg;
|
||||||
|
wxBitmap* mpFocusedImg;
|
||||||
|
|
||||||
|
// button state variables;
|
||||||
|
bool mDragStarted;
|
||||||
|
bool mIsPressed;
|
||||||
|
bool mIsInFocus;
|
||||||
|
bool mPrevPressedState;
|
||||||
|
bool mPrevInFocusState;
|
||||||
|
|
||||||
|
bool mHasFocusedBmp;
|
||||||
|
|
||||||
|
// type of event which is fired upon depression of this button
|
||||||
|
int mFiredEventType;
|
||||||
|
|
||||||
|
// pens for drawing decorations (borders)
|
||||||
|
wxPen mBlackPen;
|
||||||
|
wxPen mDarkPen;
|
||||||
|
wxPen mGrayPen;
|
||||||
|
wxPen mLightPen;
|
||||||
|
|
||||||
|
bool mIsCreated;
|
||||||
|
int mSizeIsSet;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void DestroyLabels();
|
||||||
|
|
||||||
|
// returns the label which match the current button state
|
||||||
|
virtual wxBitmap* GetStateLabel();
|
||||||
|
|
||||||
|
virtual void DrawShade( int outerLevel,
|
||||||
|
wxDC& dc,
|
||||||
|
wxPen& upperLeftSidePen,
|
||||||
|
wxPen& lowerRightSidePen );
|
||||||
|
|
||||||
|
bool IsInWindow( int x,int y );
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxNewBitmapButton( const wxBitmap& labelBitmap = wxNullBitmap,
|
||||||
|
const wxString& labelText = "",
|
||||||
|
int alignText = NB_ALIGN_TEXT_BOTTOM,
|
||||||
|
bool isFlat = TRUE,
|
||||||
|
// this is the default type of fired events
|
||||||
|
int firedEventType = wxEVT_COMMAND_MENU_SELECTED,
|
||||||
|
int marginX = 2,
|
||||||
|
int marginY = 2,
|
||||||
|
int textToLabelGap = 2,
|
||||||
|
bool isSticky = FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
// use this constructor if buttons have to be persistant
|
||||||
|
|
||||||
|
wxNewBitmapButton( const wxString& bitmapFileName,
|
||||||
|
const int bitmapFileType = wxBITMAP_TYPE_BMP,
|
||||||
|
const wxString& labelText = "",
|
||||||
|
int alignText = NB_ALIGN_TEXT_BOTTOM,
|
||||||
|
bool isFlat = TRUE,
|
||||||
|
// this is the default type of fired events
|
||||||
|
int firedEventType = wxEVT_COMMAND_MENU_SELECTED,
|
||||||
|
int marginX = 2,
|
||||||
|
int marginY = 2,
|
||||||
|
int textToLabelGap = 2,
|
||||||
|
bool isSticky = FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
~wxNewBitmapButton();
|
||||||
|
|
||||||
|
// should be called after Create();
|
||||||
|
virtual void Reshape();
|
||||||
|
|
||||||
|
// overridables
|
||||||
|
virtual void SetLabel(const wxBitmap& labelBitmap, const wxString& labelText = "" );
|
||||||
|
|
||||||
|
virtual void SetAlignments( int alignText = NB_ALIGN_TEXT_BOTTOM,
|
||||||
|
int marginX = 2,
|
||||||
|
int marginY = 2,
|
||||||
|
int textToLabelGap = 2);
|
||||||
|
|
||||||
|
virtual void DrawDecorations( wxDC& dc );
|
||||||
|
virtual void DrawLabel( wxDC& dc );
|
||||||
|
|
||||||
|
virtual void RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
|
||||||
|
bool isEnabled = TRUE,
|
||||||
|
bool isPressed = FALSE);
|
||||||
|
|
||||||
|
virtual void RenderLabelImages();
|
||||||
|
virtual void RenderAllLabelImages();
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
void OnLButtonDown( wxMouseEvent& event );
|
||||||
|
void OnLButtonUp( wxMouseEvent& event );
|
||||||
|
void OnMouseMove( wxMouseEvent& event );
|
||||||
|
void OnSize( wxSizeEvent& event );
|
||||||
|
void OnPaint( wxPaintEvent& event );
|
||||||
|
void OnEraseBackground( wxEraseEvent& event );
|
||||||
|
void OnKillFocus( wxFocusEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __NEWBMPBTN_G__ */
|
||||||
|
|
119
contrib/include/wx/fl/panedrawpl.h
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Central header file for control-bar related classes
|
||||||
|
//
|
||||||
|
// Author: Aleksandras Gluchovas <mailto:alex@soften.ktu.lt>
|
||||||
|
// Modified by:
|
||||||
|
// Created: 06/09/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __PANEDRAWPL_G__
|
||||||
|
#define __PANEDRAWPL_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "panedrawpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Simple, but all-in-one plugin implementation. Resembles look & feel of
|
||||||
|
* to MFC control-bars. Handles painting of pane and items in it.
|
||||||
|
* Fires bar/layout customization event, when user right-clicks bar/pane.
|
||||||
|
* Hooking an instance of this and row-layouting plugins per each pane,
|
||||||
|
* would be enough for the frame layout to function properly.
|
||||||
|
* (they are plugged in autimatically by wxFrameLayout class)
|
||||||
|
*/
|
||||||
|
|
||||||
|
class cbPaneDrawPlugin : public cbPluginBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbPaneDrawPlugin )
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// resizing bars/rows state variables
|
||||||
|
bool mResizeStarted;
|
||||||
|
bool mResizeCursorOn;
|
||||||
|
wxPoint mDragOrigin;
|
||||||
|
|
||||||
|
cbBarInfo* mpDraggedBar; // also used when in bar-drag action
|
||||||
|
cbRowInfo* mpResizedRow;
|
||||||
|
|
||||||
|
bool mRowHandleHitted;
|
||||||
|
bool mIsUpperHandle;
|
||||||
|
bool mBarHandleHitted;
|
||||||
|
bool mIsLeftHandle;
|
||||||
|
bool mBarContentHitted;
|
||||||
|
|
||||||
|
// contstraints for dragging the handle
|
||||||
|
wxRect mHandleDragArea;
|
||||||
|
bool mHandleIsVertical;
|
||||||
|
int mHandleOfs;
|
||||||
|
int mDraggedDelta;
|
||||||
|
wxPoint mPrevPos;
|
||||||
|
|
||||||
|
// used for handling, start-draw-in-area events
|
||||||
|
wxClientDC* mpClntDc;
|
||||||
|
|
||||||
|
cbDockPane* mpPane; // is set up temorary short-cut, while handling event
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// helpers
|
||||||
|
void DrawDraggedHandle( const wxPoint& pos, cbDockPane& pane );
|
||||||
|
|
||||||
|
virtual void DrawPaneShade( wxDC& dc, int alignment );
|
||||||
|
virtual void DrawPaneShadeForRow( cbRowInfo* pRow, wxDC& dc );
|
||||||
|
|
||||||
|
virtual void DrawUpperRowHandle( cbRowInfo* pRow, wxDC& dc );
|
||||||
|
virtual void DrawLowerRowHandle( cbRowInfo* pRow, wxDC& dc );
|
||||||
|
|
||||||
|
virtual void DrawUpperRowShades( cbRowInfo* pRow, wxDC& dc, int level );
|
||||||
|
virtual void DrawLowerRowShades( cbRowInfo* pRow, wxDC& dc, int level );
|
||||||
|
|
||||||
|
virtual void DrawBarInnerShadeRect( cbBarInfo* pBar, wxDC& dc );
|
||||||
|
|
||||||
|
virtual void DrawShade( int level, wxRect& rect, int alignment, wxDC& dc );
|
||||||
|
virtual void DrawShade1( int level, wxRect& rect, int alignment, wxDC& dc );
|
||||||
|
|
||||||
|
inline void SetLightPixel( int x, int y, wxDC& dc );
|
||||||
|
inline void SetDarkPixel ( int x, int y, wxDC& dc );
|
||||||
|
|
||||||
|
public:
|
||||||
|
cbPaneDrawPlugin(void);
|
||||||
|
|
||||||
|
cbPaneDrawPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||||
|
|
||||||
|
virtual ~cbPaneDrawPlugin();
|
||||||
|
|
||||||
|
virtual cbPluginBase* Clone() { return new cbPaneDrawPlugin(0,0); }
|
||||||
|
|
||||||
|
// handlers for plugin-events
|
||||||
|
|
||||||
|
void OnLButtonDown( cbLeftDownEvent& event );
|
||||||
|
void OnLDblClick ( cbLeftDClickEvent& event );
|
||||||
|
void OnLButtonUp ( cbLeftUpEvent& event );
|
||||||
|
void OnRButtonUp ( cbRightUpEvent& event );
|
||||||
|
void OnMouseMove ( cbMotionEvent& event );
|
||||||
|
|
||||||
|
void OnDrawPaneBackground ( cbDrawPaneBkGroundEvent& event );
|
||||||
|
void OnDrawPaneDecorations( cbDrawPaneDecorEvent& event );
|
||||||
|
|
||||||
|
void OnDrawRowDecorations ( cbDrawRowDecorEvent& event );
|
||||||
|
void OnDrawRowHandles ( cbDrawRowHandlesEvent& event );
|
||||||
|
void OnDrawRowBackground ( cbDrawRowBkGroundEvent& event );
|
||||||
|
|
||||||
|
void OnSizeBarWindow ( cbSizeBarWndEvent& event );
|
||||||
|
void OnDrawBarDecorations ( cbDrawBarDecorEvent& event );
|
||||||
|
void OnDrawBarHandles ( cbDrawBarHandlesEvent& event );
|
||||||
|
|
||||||
|
void OnStartDrawInArea ( cbStartDrawInAreaEvent& event );
|
||||||
|
void OnFinishDrawInArea ( cbFinishDrawInAreaEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __PANEDRAWPL_G__ */
|
||||||
|
|
164
contrib/include/wx/fl/rowdragpl.h
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 06/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __ROWDRAGPL_G__
|
||||||
|
#define __ROWDRAGPL_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "rowdragpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Plugin adds row-dragging fuctionality to the pane.
|
||||||
|
* Handles mouse/movement and pane-background erasing plugin-events.
|
||||||
|
* Behaviour and appearence resembles drag & drop posotioning
|
||||||
|
* of the toolbar-rows int Netscape Comunicator 4.xx.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class cbRowDragPlugin : public cbPluginBase
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbRowDragPlugin )
|
||||||
|
public:
|
||||||
|
// background colours for the highlighted/unhighlighted icons
|
||||||
|
|
||||||
|
wxColour mHightColor; // light-blue for NC-look
|
||||||
|
wxColour mLowColor; // light-gray -/-
|
||||||
|
wxColour mTrianInnerColor; // blue -/-
|
||||||
|
wxPen mTrianInnerPen; // black -/-
|
||||||
|
|
||||||
|
protected:
|
||||||
|
friend class cbRowDragPluginSerializer;
|
||||||
|
|
||||||
|
// drag & drop state variables
|
||||||
|
bool mDragStarted;
|
||||||
|
bool mDecisionMode;
|
||||||
|
wxPoint mDragOrigin;
|
||||||
|
int mCurDragOfs;
|
||||||
|
bool mCaptureIsOn;
|
||||||
|
|
||||||
|
// saved margins of the pane
|
||||||
|
int mSvTopMargin;
|
||||||
|
int mSvBottomMargin;
|
||||||
|
int mSvLeftMargin;
|
||||||
|
int mSvRightMargin;
|
||||||
|
|
||||||
|
//on-screen drawing state variables
|
||||||
|
wxBitmap* mpPaneImage;
|
||||||
|
wxBitmap* mpRowImage;
|
||||||
|
wxBitmap* mpCombinedImage;
|
||||||
|
|
||||||
|
wxScreenDC* mpScrDc;
|
||||||
|
wxRect mCombRect;
|
||||||
|
wxSize mRowImgDim;
|
||||||
|
int mInitialRowOfs;
|
||||||
|
|
||||||
|
// NOTE:: if mpRowInFocus is not NULL, then mCollapsedIconInFocus is -1,
|
||||||
|
// and v.v. (two different items cannot be in focus at the same time)
|
||||||
|
|
||||||
|
cbRowInfo* mpRowInFocus;
|
||||||
|
int mCollapsedIconInFocus;
|
||||||
|
|
||||||
|
cbDockPane* mpPane; // is set up temorarely, while handling event
|
||||||
|
|
||||||
|
wxList mHiddenBars;
|
||||||
|
|
||||||
|
wxBitmap* CaptureDCArea( wxDC& dc, wxRect& area );
|
||||||
|
|
||||||
|
// helpers for drag&drop
|
||||||
|
|
||||||
|
int GetHRowsCountForPane( cbDockPane* pPane );
|
||||||
|
|
||||||
|
void SetMouseCapture( bool captureOn );
|
||||||
|
void PrepareForRowDrag();
|
||||||
|
void ShowDraggedRow( int offset );
|
||||||
|
void ShowPaneImage();
|
||||||
|
void FinishOnScreenDraw();
|
||||||
|
void CollapseRow( cbRowInfo* pRow );
|
||||||
|
void ExpandRow( int collapsedIconIdx );
|
||||||
|
void InsertDraggedRowBefore( cbRowInfo* pBeforeRow );
|
||||||
|
bool ItemIsInFocus();
|
||||||
|
void CheckPrevItemInFocus( cbRowInfo* pRow, int iconIdx );
|
||||||
|
void UnhiglightItemInFocus();
|
||||||
|
|
||||||
|
cbRowInfo* GetFirstRow();
|
||||||
|
|
||||||
|
// "hard-coded metafile" for NN-look
|
||||||
|
|
||||||
|
virtual void DrawTrianUp( wxRect& inRect, wxDC& dc );
|
||||||
|
virtual void DrawTrianDown( wxRect& inRect, wxDC& dc );
|
||||||
|
virtual void DrawTrianRight( wxRect& inRect, wxDC& dc );
|
||||||
|
virtual void Draw3DPattern( wxRect& inRect, wxDC& dc );
|
||||||
|
virtual void DrawRombShades( wxPoint& p1, wxPoint& p2, wxPoint& p3, wxPoint& p4, wxDC& dc );
|
||||||
|
virtual void DrawOrtoRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
||||||
|
virtual void DrawRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
||||||
|
virtual void Draw3DRect( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
||||||
|
virtual void DrawRectShade( wxRect& inRect, wxDC& dc,
|
||||||
|
int level, wxPen& upperPen, wxPen& lowerPen );
|
||||||
|
|
||||||
|
virtual void GetRowHintRect( cbRowInfo* pRow, wxRect& rect );
|
||||||
|
virtual void GetCollapsedInconRect( int iconIdx, wxRect& rect );
|
||||||
|
|
||||||
|
virtual int GetCollapsedIconsPos();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
cbRowDragPlugin(void);
|
||||||
|
|
||||||
|
cbRowDragPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
|
||||||
|
virtual ~cbRowDragPlugin();
|
||||||
|
|
||||||
|
virtual cbPluginBase* Clone() { return new cbRowDragPlugin(NULL,0); }
|
||||||
|
|
||||||
|
virtual void OnInitPlugin();
|
||||||
|
|
||||||
|
// handlers for plugin events (appearence-independent logic)
|
||||||
|
|
||||||
|
void OnMouseMove ( cbMotionEvent& event );
|
||||||
|
void OnLButtonDown( cbLeftDownEvent& event );
|
||||||
|
void OnLButtonUp ( cbLeftUpEvent& event );
|
||||||
|
void OnDrawPaneBackground( cbDrawPaneDecorEvent& event );
|
||||||
|
|
||||||
|
// overridables (appearence-depedent)
|
||||||
|
|
||||||
|
virtual void DrawCollapsedRowIcon( int index, wxDC& dc, bool isHighlighted );
|
||||||
|
virtual void DrawCollapsedRowsBorder( wxDC& dc );
|
||||||
|
virtual void DrawRowsDragHintsBorder( wxDC& dc );
|
||||||
|
virtual void DrawRowDragHint( cbRowInfo* pRow, wxDC& dc, bool isHighlighted );
|
||||||
|
virtual void DrawEmptyRow( wxDC& dc, wxRect& rowBounds );
|
||||||
|
|
||||||
|
virtual int GetCollapsedRowIconHeight();
|
||||||
|
virtual int GetRowDragHintWidth();
|
||||||
|
|
||||||
|
virtual void SetPaneMargins();
|
||||||
|
|
||||||
|
|
||||||
|
virtual bool HitTestCollapsedRowIcon( int iconIdx, const wxPoint& pos );
|
||||||
|
virtual bool HitTestRowDragHint( cbRowInfo* pRow, const wxPoint& pos );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
// internal helper-class
|
||||||
|
|
||||||
|
class cbHiddenBarInfo : public wxObject
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbHiddenBarInfo )
|
||||||
|
public:
|
||||||
|
cbBarInfo* mpBar;
|
||||||
|
int mRowNo;
|
||||||
|
int mIconNo;
|
||||||
|
int mAlignment;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __ROWDRAGPL_G__ */
|
||||||
|
|
87
contrib/include/wx/fl/rowlayoutpl.h
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 02/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __ROWLAYOUTPL_G__
|
||||||
|
#define __ROWLAYOUTPL_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "rowlayoutpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Simple implementation of plugin, which handles row-layouting
|
||||||
|
* requests sent from Frame Layout
|
||||||
|
*/
|
||||||
|
|
||||||
|
class cbRowLayoutPlugin : public cbPluginBase
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbRowLayoutPlugin )
|
||||||
|
protected:
|
||||||
|
cbDockPane* mpPane; // is set up temorarely, while handling event
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// not-fixed-bars layouting related helpers
|
||||||
|
|
||||||
|
void FitBarsToRange( int from, int till, cbBarInfo* pTheBar, cbRowInfo* pRow );
|
||||||
|
void RelayoutNotFixedBarsAround( cbBarInfo* pTheBar, cbRowInfo* pRow );
|
||||||
|
void MinimzeNotFixedBars( cbRowInfo* pRow, cbBarInfo* pBarToPreserve );
|
||||||
|
int GetRowFreeSpace( cbRowInfo* pRow );
|
||||||
|
|
||||||
|
void RecalcLengthRatios( cbRowInfo* pRow );
|
||||||
|
void ApplyLengthRatios( cbRowInfo* pRow );
|
||||||
|
void ExpandNotFixedBars( cbRowInfo* pRow );
|
||||||
|
void AdjustLengthOfInserted( cbRowInfo* pRow, cbBarInfo* pTheBar );
|
||||||
|
|
||||||
|
void DetectBarHandles( cbRowInfo* pRow );
|
||||||
|
void CheckIfAtTheBoundary( cbBarInfo* pTheBar, cbRowInfo& rowInfo );
|
||||||
|
|
||||||
|
|
||||||
|
// row-layouting helpers (simulate "bar-friction")
|
||||||
|
|
||||||
|
int CalcRowHeight( cbRowInfo& row );
|
||||||
|
void LayoutItemsVertically( cbRowInfo& row );
|
||||||
|
|
||||||
|
void StickRightSideBars( cbBarInfo* pToBar );
|
||||||
|
|
||||||
|
void SlideLeftSideBars ( cbBarInfo* pTheBar );
|
||||||
|
void SlideRightSideBars( cbBarInfo* pTheBar );
|
||||||
|
|
||||||
|
void ShiftLeftTrashold ( cbBarInfo* pTheBar, cbRowInfo& row );
|
||||||
|
void ShiftRightTrashold( cbBarInfo* pTheBar, cbRowInfo& row );
|
||||||
|
|
||||||
|
void InsertBefore( cbBarInfo* pBeforeBar,
|
||||||
|
cbBarInfo* pTheBar,
|
||||||
|
cbRowInfo& row
|
||||||
|
);
|
||||||
|
|
||||||
|
void DoInsertBar( cbBarInfo* pTheBar, cbRowInfo& row );
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
cbRowLayoutPlugin(void);
|
||||||
|
|
||||||
|
cbRowLayoutPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
|
||||||
|
void OnResizeRow ( cbResizeRowEvent& event );
|
||||||
|
void OnInsertBar ( cbInsertBarEvent& event );
|
||||||
|
void OnRemoveBar ( cbRemoveBarEvent& event );
|
||||||
|
void OnLayoutRow ( cbLayoutRowEvent& event );
|
||||||
|
void OnLayoutRows( cbLayoutRowsEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __ROWLAYOUTPL_G__ */
|
||||||
|
|
216
contrib/include/wx/fl/toolwnd.h
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 06/09/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __TOOLWND_G__
|
||||||
|
#define __TOOLWND_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "toolwnd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/frame.h"
|
||||||
|
#include "wx/dynarray.h"
|
||||||
|
|
||||||
|
// fixed settings
|
||||||
|
|
||||||
|
#define BTN_BOX_HEIGHT 12
|
||||||
|
#define BTN_BOX_WIDTH 12
|
||||||
|
#define BTN_X_WIEGHT 2
|
||||||
|
|
||||||
|
class cbMiniButton;
|
||||||
|
|
||||||
|
typedef cbMiniButton* cbMinitButtonPtrT;
|
||||||
|
|
||||||
|
WX_DEFINE_ARRAY( cbMinitButtonPtrT, cbMiniButtonArrayT );
|
||||||
|
|
||||||
|
class wxToolWindow : public wxFrame
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( wxToolWindow )
|
||||||
|
|
||||||
|
public: /** protected really, accessed only by serializers **/
|
||||||
|
|
||||||
|
cbMiniButtonArrayT mButtons;
|
||||||
|
wxWindow* mpClientWnd;
|
||||||
|
|
||||||
|
wxFont mTitleFont;
|
||||||
|
|
||||||
|
int mTitleHeight;
|
||||||
|
int mClntHorizGap;
|
||||||
|
int mClntVertGap;
|
||||||
|
int mWndVertGap;
|
||||||
|
int mWndHorizGap;
|
||||||
|
int mButtonGap;
|
||||||
|
int mInTitleMargin;
|
||||||
|
int mHintBorder;
|
||||||
|
|
||||||
|
bool mResizeStarted;
|
||||||
|
bool mRealTimeUpdatesOn;
|
||||||
|
|
||||||
|
int mMTolerance;
|
||||||
|
|
||||||
|
int mCursorType;
|
||||||
|
bool mMouseCaptured;
|
||||||
|
|
||||||
|
// drag&drop state variables
|
||||||
|
|
||||||
|
wxPoint mDragOrigin;
|
||||||
|
wxRect mInitialRect;
|
||||||
|
wxRect mPrevHintRect;
|
||||||
|
wxScreenDC* mpScrDc;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void GetScrWindowRect( wxRect& r );
|
||||||
|
void GetScrMousePos ( wxMouseEvent& event, wxPoint& pos );
|
||||||
|
void SetHintCursor ( int type );
|
||||||
|
|
||||||
|
void CalcResizedRect( wxRect& rect, wxPoint& delta, const wxSize& minDim );
|
||||||
|
void AdjustRectPos( const wxRect& original, const wxSize& newDim, wxRect& newRect );
|
||||||
|
wxSize GetMinimalWndDim();
|
||||||
|
|
||||||
|
void DrawHintRect( const wxRect& r );
|
||||||
|
|
||||||
|
int HitTestWindow( wxMouseEvent& event );
|
||||||
|
|
||||||
|
void LayoutMiniButtons();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxToolWindow();
|
||||||
|
~wxToolWindow();
|
||||||
|
|
||||||
|
void SetClient( wxWindow* pWnd );
|
||||||
|
wxWindow* GetClient();
|
||||||
|
|
||||||
|
void SetTitleFont( wxFont& font );
|
||||||
|
|
||||||
|
// buttons are added in right-to-left order
|
||||||
|
void AddMiniButton( cbMiniButton* pBtn );
|
||||||
|
|
||||||
|
void OnPaint( wxPaintEvent& event );
|
||||||
|
|
||||||
|
void OnMotion( wxMouseEvent& event );
|
||||||
|
void OnLeftDown( wxMouseEvent& event );
|
||||||
|
void OnLeftUp( wxMouseEvent& event );
|
||||||
|
void OnSize( wxSizeEvent& event );
|
||||||
|
|
||||||
|
void OnEraseBackground( wxEraseEvent& event );
|
||||||
|
|
||||||
|
// overridables:
|
||||||
|
|
||||||
|
virtual wxSize GetPreferredSize( const wxSize& given );
|
||||||
|
virtual void OnMiniButtonClicked( int btnIdx ) {}
|
||||||
|
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"
|
||||||
|
|
||||||
|
class cbMiniButton : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxPoint mPos;
|
||||||
|
wxSize mDim;
|
||||||
|
bool mVisible;
|
||||||
|
bool mEnabled;
|
||||||
|
|
||||||
|
wxFrameLayout* mpLayout;
|
||||||
|
cbDockPane* mpPane;
|
||||||
|
cbPluginBase* mpPlugin;
|
||||||
|
|
||||||
|
wxWindow* mpWnd;
|
||||||
|
|
||||||
|
bool mWasClicked;
|
||||||
|
bool mDragStarted;
|
||||||
|
|
||||||
|
bool mPressed;
|
||||||
|
public:
|
||||||
|
cbMiniButton();
|
||||||
|
|
||||||
|
void SetPos( const wxPoint& pos );
|
||||||
|
bool HitTest( const wxPoint& pos );
|
||||||
|
|
||||||
|
void OnLeftDown( const wxPoint& pos );
|
||||||
|
void OnLeftUp( const wxPoint& pos );
|
||||||
|
void OnMotion( const wxPoint& pos );
|
||||||
|
|
||||||
|
void Refresh();
|
||||||
|
virtual void Draw( wxDC& dc );
|
||||||
|
|
||||||
|
bool WasClicked();
|
||||||
|
void Reset();
|
||||||
|
|
||||||
|
void Enable( bool enable ) { mEnabled = enable; }
|
||||||
|
|
||||||
|
bool IsPressed() { return mPressed; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// classes specific to wxFrameLayout engine (FOR NOW in here...)
|
||||||
|
|
||||||
|
class cbCloseBox : public cbMiniButton
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void Draw( wxDC& dc );
|
||||||
|
};
|
||||||
|
|
||||||
|
class cbCollapseBox : public cbMiniButton
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool mIsAtLeft;
|
||||||
|
|
||||||
|
virtual void Draw( wxDC& dc );
|
||||||
|
};
|
||||||
|
|
||||||
|
class cbDockBox : public cbMiniButton
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void Draw( wxDC& dc );
|
||||||
|
};
|
||||||
|
|
||||||
|
class cbFloatedBarWindow : public wxToolWindow
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbFloatedBarWindow )
|
||||||
|
protected:
|
||||||
|
cbBarInfo* mpBar;
|
||||||
|
wxFrameLayout* mpLayout;
|
||||||
|
|
||||||
|
friend class cbFloatedBarWindowSerializer;
|
||||||
|
|
||||||
|
public:
|
||||||
|
cbFloatedBarWindow();
|
||||||
|
|
||||||
|
void SetBar( cbBarInfo* pBar );
|
||||||
|
void SetLayout( wxFrameLayout* pLayout );
|
||||||
|
cbBarInfo* GetBar();
|
||||||
|
|
||||||
|
// given coordinates are those of the bar itself
|
||||||
|
// floated container window's position and size
|
||||||
|
// are ajusted accordingly
|
||||||
|
|
||||||
|
void PositionFloatedWnd( int scrX, int scrY,
|
||||||
|
int width, int height );
|
||||||
|
|
||||||
|
// overriden methods of wxToolWindow
|
||||||
|
|
||||||
|
virtual wxSize GetPreferredSize( const wxSize& given );
|
||||||
|
virtual void OnMiniButtonClicked( int btnIdx );
|
||||||
|
virtual bool HandleTitleClick( wxMouseEvent& event );
|
||||||
|
|
||||||
|
void OnDblClick( wxMouseEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __TOOLWND_G__ */
|
||||||
|
|
||||||
|
|
56
contrib/include/wx/fl/updatesmgr.h
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas (@Lithuania)
|
||||||
|
// Modified by:
|
||||||
|
// Created: 19/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __UPDATESMGR_G__
|
||||||
|
#define __UPDATESMGR_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "updatesmgr.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* class implements slightly optimized logic for refreshing
|
||||||
|
* areas of frame layout - which actually need to be updated.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class cbSimpleUpdatesMgr : public cbUpdatesManagerBase
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( cbSimpleUpdatesMgr )
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool WasChanged( cbUpdateMgrData& data, wxRect& currentBounds );
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
cbSimpleUpdatesMgr(void) {}
|
||||||
|
|
||||||
|
cbSimpleUpdatesMgr( wxFrameLayout* pPanel );
|
||||||
|
|
||||||
|
// notificiactions received from Frame Layout (in the order, in which
|
||||||
|
// they usually would be invoked)
|
||||||
|
|
||||||
|
virtual void OnStartChanges();
|
||||||
|
|
||||||
|
virtual void OnRowWillChange( cbRowInfo* pRow, cbDockPane* pInPane );
|
||||||
|
virtual void OnBarWillChange( cbBarInfo* pBar, cbRowInfo* pInRow, cbDockPane* pInPane );
|
||||||
|
virtual void OnPaneMarginsWillChange( cbDockPane* pPane );
|
||||||
|
virtual void OnPaneWillChange( cbDockPane* pPane );
|
||||||
|
|
||||||
|
virtual void OnFinishChanges();
|
||||||
|
|
||||||
|
// refreshes parts of the frame layout, which need an update
|
||||||
|
virtual void UpdateNow();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __UPDATESMGR_G__ */
|
||||||
|
|
@@ -1,6 +1,6 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
CONTRIB_SAMPLES=mmedia ogl stc gizmos canvas xrc plot applet
|
CONTRIB_SAMPLES=mmedia ogl stc gizmos canvas xrc plot applet fl
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@for d in $(CONTRIB_SAMPLES); do (cd $$d && $(MAKE)); done
|
@for d in $(CONTRIB_SAMPLES); do (cd $$d && $(MAKE)); done
|
||||||
|
10
contrib/samples/fl/Makefile.in
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# $Id$
|
||||||
|
|
||||||
|
CONTRIB_SAMPLES=fl_demo1 fl_demo2 fl_sample1 fl_sample2 fl_sample3
|
||||||
|
|
||||||
|
all:
|
||||||
|
@for d in $(CONTRIB_SAMPLES); do (cd $$d && $(MAKE)); done
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@for d in $(CONTRIB_SAMPLES); do (cd $$d && $(MAKE) clean); done
|
||||||
|
|
BIN
contrib/samples/fl/bitmaps/bookmarks.bmp
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
contrib/samples/fl/bitmaps/class_icon.bmp
Normal file
After Width: | Height: | Size: 214 B |
BIN
contrib/samples/fl/bitmaps/class_icon1.bmp
Normal file
After Width: | Height: | Size: 822 B |
BIN
contrib/samples/fl/bitmaps/copy.bmp
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/samples/fl/bitmaps/cut.bmp
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/samples/fl/bitmaps/file_icon.bmp
Normal file
After Width: | Height: | Size: 214 B |
BIN
contrib/samples/fl/bitmaps/folder_icon.bmp
Normal file
After Width: | Height: | Size: 822 B |
BIN
contrib/samples/fl/bitmaps/help_icon.bmp
Normal file
After Width: | Height: | Size: 214 B |
BIN
contrib/samples/fl/bitmaps/new.bmp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
contrib/samples/fl/bitmaps/nextmark.bmp
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
contrib/samples/fl/bitmaps/open.bmp
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
contrib/samples/fl/bitmaps/paste.bmp
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/samples/fl/bitmaps/prevmark.bmp
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
contrib/samples/fl/bitmaps/res_icon.bmp
Normal file
After Width: | Height: | Size: 214 B |
BIN
contrib/samples/fl/bitmaps/save.bmp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
contrib/samples/fl/bitmaps/saveall.bmp
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/samples/fl/bitmaps/search.bmp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
contrib/samples/fl/bitmaps/start95_dp.bmp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
contrib/samples/fl/bitmaps/start95_pr.bmp
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
contrib/samples/fl/bitmaps/tile.bmp
Normal file
After Width: | Height: | Size: 1.8 KiB |
25
contrib/samples/fl/fl_demo1/Makefile.in
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample on UNIX/Linux.
|
||||||
|
|
||||||
|
top_srcdir = @top_srcdir@/..
|
||||||
|
top_builddir = ../../../..
|
||||||
|
|
||||||
|
TARGET = fl_demo1
|
||||||
|
|
||||||
|
program_dir = contrib/samples/fl/$(TARGET)
|
||||||
|
|
||||||
|
APPEXTRADEFS = -I$(top_srcdir)/contrib/include -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
APPEXTRALIBS = $(top_builddir)/lib/libfl.@WX_TARGET_LIBRARY_TYPE@
|
||||||
|
|
||||||
|
PROGRAM = $(TARGET)
|
||||||
|
OBJECTS = $(TARGET).o
|
||||||
|
|
||||||
|
include $(top_builddir)/src/makeprog.env
|
108
contrib/samples/fl/fl_demo1/fl_demo.dsp
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="fl_demo1" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||||
|
|
||||||
|
CFG=fl_demo1 - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "fl_demo.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "fl_demo.mak" CFG="fl_demo1 - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "fl_demo1 - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE "fl_demo1 - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "fl_demo1 - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../../include" /I "../../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /D BMP_DIR=\"../bitmaps/\" /c
|
||||||
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib png.lib zlib.lib jpeg.lib tiff.lib fl.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "fl_demo1 - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../../include" /I "../../../../contrib/include" /D "_DEBUG" /D DEBUG=1 /D "__WXDEBUG__" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /D BMP_DIR=\"../bitmaps/\" /c
|
||||||
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib fld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "fl_demo1 - Win32 Release"
|
||||||
|
# Name "fl_demo1 - Win32 Debug"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\fl_demo1.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "fl_demo1 - Win32 Release"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "fl_demo1 - Win32 Debug"
|
||||||
|
|
||||||
|
# ADD CPP /Yc"wx/wxprec.h"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\fl_demo1.rc
|
||||||
|
# End Source File
|
||||||
|
# End Target
|
||||||
|
# End Project
|
29
contrib/samples/fl/fl_demo1/fl_demo.dsw
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "fl_demo1"=.\fl_demo.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
241
contrib/samples/fl/fl_demo1/fl_demo1.cpp
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by: Sebastian Haase (June 21, 2001)
|
||||||
|
// Created: 04/11/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "fl_demo1.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/textctrl.h"
|
||||||
|
|
||||||
|
// fl headers
|
||||||
|
#include "wx/fl/controlbar.h" // core API
|
||||||
|
|
||||||
|
// extra plugins
|
||||||
|
#include "wx/fl/barhintspl.h" // beveal for bars with "X"s and grooves
|
||||||
|
#include "wx/fl/rowdragpl.h" // NC-look with dragable rows
|
||||||
|
#include "wx/fl/cbcustom.h" // customization plugin
|
||||||
|
#include "wx/fl/hintanimpl.h"
|
||||||
|
|
||||||
|
// beuty-care
|
||||||
|
#include "wx/fl/gcupdatesmgr.h" // smooth d&d
|
||||||
|
#include "wx/fl/antiflickpl.h" // double-buffered repaint of decorations
|
||||||
|
#include "wx/fl/dyntbar.h" // auto-layouting toolbar
|
||||||
|
#include "wx/fl/dyntbarhnd.h" // control-bar dimension handler for it
|
||||||
|
|
||||||
|
#include "fl_demo1.h"
|
||||||
|
|
||||||
|
// comment it out if it breaks, (this is my workaround for MSDev 4.0 linker)
|
||||||
|
|
||||||
|
char wxDummyChar;
|
||||||
|
|
||||||
|
|
||||||
|
IMPLEMENT_APP (MyApp)
|
||||||
|
|
||||||
|
bool MyApp::OnInit(void)
|
||||||
|
{
|
||||||
|
MyFrame *frame = new MyFrame(NULL);
|
||||||
|
|
||||||
|
frame->SetBackgroundColour( wxColour(192,192,192) );
|
||||||
|
|
||||||
|
wxMenu *file_menu = new wxMenu;
|
||||||
|
|
||||||
|
file_menu->Append( NEW_TEST_LOAD, "&Load layouts" );
|
||||||
|
file_menu->Append( NEW_TEST_SAVE, "&Store layouts" );
|
||||||
|
file_menu->Append( NEW_TEST_EXIT, "E&xit" );
|
||||||
|
|
||||||
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
|
|
||||||
|
menu_bar->Append(file_menu, "&File");
|
||||||
|
|
||||||
|
frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
|
frame->CreateStatusBar(3);
|
||||||
|
|
||||||
|
frame->Show(TRUE);
|
||||||
|
|
||||||
|
frame->mpClientWnd->Refresh();
|
||||||
|
|
||||||
|
SetTopWindow(frame);
|
||||||
|
|
||||||
|
|
||||||
|
wxMessageBox("Hello, this demo has a bunch of yet-not-fixed-bugs and misssing functionality\n" \
|
||||||
|
"The ONLY purpose is to demostrate self-layouting toolbars,\nflat-bitmapped-buttons and 2-new FL-plugins" \
|
||||||
|
"(cbRowDragPlugin & cbBarHintsPlugin)\n\n" \
|
||||||
|
"BTW, disabled images and label-text are rendered at run-time" );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Implementation for class MyFrame *****/
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( MyFrame, wxFrame )
|
||||||
|
// EVT_CHAR_HOOK(MyFrame::OnKeyDown)
|
||||||
|
// EVT_PAINT( MyFrame::OnPaint )
|
||||||
|
EVT_MENU( NEW_TEST_SAVE, MyFrame::OnSave )
|
||||||
|
EVT_MENU( NEW_TEST_LOAD, MyFrame::OnLoad )
|
||||||
|
EVT_MENU( NEW_TEST_EXIT, MyFrame::OnExit )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
void MyFrame::OnLoad( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("Hey - you found a BIG question-mark !!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnSave( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("Hey - you found another BIG question-mark !!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnExit( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
|
||||||
|
{
|
||||||
|
wxTextCtrl* pCtrl =
|
||||||
|
|
||||||
|
new wxTextCtrl( this, -1, value,
|
||||||
|
wxDefaultPosition, wxSize(0,0), wxTE_MULTILINE );
|
||||||
|
|
||||||
|
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
|
||||||
|
|
||||||
|
return pCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyFrame::MyFrame(wxFrame *frame)
|
||||||
|
: wxFrame( frame, -1, "wxWindows 2.0 wxFrameLayout Test Application", wxDefaultPosition,
|
||||||
|
wxSize( 700, 500 ),
|
||||||
|
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
|
||||||
|
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
|
||||||
|
"freimas" )
|
||||||
|
{
|
||||||
|
mpClientWnd = CreateTextCtrl( "Client window" );
|
||||||
|
|
||||||
|
mpLayout = new wxFrameLayout( this, mpClientWnd );
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
cbCommonPaneProperties props;
|
||||||
|
mpLayout->GetPaneProperties( props );
|
||||||
|
|
||||||
|
props.mRealTimeUpdatesOn = FALSE; // real-time OFF!!!
|
||||||
|
|
||||||
|
mpLayout->SetPaneProperties( props, wxALL_PANES );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mpLayout->SetUpdatesManager( new cbGCUpdatesMgr() );
|
||||||
|
|
||||||
|
// this is now default...
|
||||||
|
//mpLayout->SetMargins( 1,1,1,1 ); // gaps for vertical/horizontal/right/left panes
|
||||||
|
|
||||||
|
// setup plugins for testing
|
||||||
|
mpLayout->PushDefaultPlugins();
|
||||||
|
|
||||||
|
mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for bars
|
||||||
|
mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
|
||||||
|
mpLayout->AddPlugin( CLASSINFO( cbRowDragPlugin ) );
|
||||||
|
mpLayout->AddPlugin( CLASSINFO( cbAntiflickerPlugin ) );
|
||||||
|
mpLayout->AddPlugin( CLASSINFO( cbSimpleCustomizationPlugin ) );
|
||||||
|
|
||||||
|
// drop in some bars
|
||||||
|
cbDimInfo sizes0( 200,45, // when docked horizontally
|
||||||
|
200,85, // when docked vertically
|
||||||
|
175,35, // when floated
|
||||||
|
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
|
||||||
|
4, // vertical gap (bar border)
|
||||||
|
4 // horizontal gap (bar border)
|
||||||
|
);
|
||||||
|
|
||||||
|
cbDimInfo sizes2( 175,45, // when docked horizontally
|
||||||
|
175,37, // when docked vertically
|
||||||
|
170,35, // when floated
|
||||||
|
TRUE, // the bar is not fixed-size
|
||||||
|
4, // vertical gap (bar border)
|
||||||
|
4, // horizontal gap (bar border)
|
||||||
|
new cbDynToolBarDimHandler()
|
||||||
|
);
|
||||||
|
|
||||||
|
mpLayout->AddBar( CreateTextCtrl("Hello"), // bar window
|
||||||
|
sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
|
||||||
|
0, // insert into 0th row (vert. position)
|
||||||
|
0, // offset from the start of row (in pixels)
|
||||||
|
"InfoViewer1", // name to refere in customization pop-ups
|
||||||
|
TRUE
|
||||||
|
);
|
||||||
|
|
||||||
|
mpLayout->AddBar( CreateTextCtrl("Bye"), // bar window
|
||||||
|
sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
|
||||||
|
1, // insert into 0th row (vert. position)
|
||||||
|
0, // offset from the start of row (in pixels)
|
||||||
|
"InfoViewer2", // name to refere in customization pop-ups
|
||||||
|
TRUE
|
||||||
|
);
|
||||||
|
|
||||||
|
mpLayout->AddBar( CreateTextCtrl("Fixed0"), // bar window
|
||||||
|
sizes1, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
|
||||||
|
0, // insert into 0th row (vert. position)
|
||||||
|
0, // offset from the start of row (in pixels)
|
||||||
|
"ToolBar1", // name to refere in customization pop-ups
|
||||||
|
TRUE
|
||||||
|
);
|
||||||
|
|
||||||
|
wxDynamicToolBar* pToolBar = new wxDynamicToolBar();
|
||||||
|
|
||||||
|
pToolBar->Create( this, -1 );
|
||||||
|
|
||||||
|
// 1001-1006 ids of command events fired by added tool-buttons
|
||||||
|
|
||||||
|
pToolBar->AddTool( 1001, BMP_DIR "new.bmp" );
|
||||||
|
pToolBar->AddTool( 1002, BMP_DIR "open.bmp" );
|
||||||
|
pToolBar->AddTool( 1003, BMP_DIR "save.bmp" );
|
||||||
|
|
||||||
|
pToolBar->AddTool( 1004, BMP_DIR "cut.bmp" );
|
||||||
|
pToolBar->AddTool( 1005, BMP_DIR "copy.bmp" );
|
||||||
|
pToolBar->AddTool( 1006, BMP_DIR "paste.bmp" );
|
||||||
|
|
||||||
|
|
||||||
|
mpLayout->AddBar( pToolBar, // bar window (can be NULL)
|
||||||
|
sizes2, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
|
||||||
|
0, // insert into 0th row (vert. position)
|
||||||
|
0, // offset from the start of row (in pixels)
|
||||||
|
"ToolBar2", // name to refere in customization pop-ups
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
mpLayout->EnableFloating( TRUE ); // off, thinking bout wxGtk...
|
||||||
|
}
|
||||||
|
|
||||||
|
MyFrame::~MyFrame()
|
||||||
|
{
|
||||||
|
if ( mpLayout)
|
||||||
|
delete mpLayout; // should be destroyed manually
|
||||||
|
}
|
||||||
|
|
55
contrib/samples/fl/fl_demo1/fl_demo1.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by: Sebastian Haase (June 21, 2001)
|
||||||
|
// Created: 04/11/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __NEW_TEST_G__
|
||||||
|
#define __NEW_TEST_G__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "fl_demo1.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NEW_TEST_SAVE 1101
|
||||||
|
#define NEW_TEST_LOAD 1102
|
||||||
|
#define NEW_TEST_EXIT 1103
|
||||||
|
|
||||||
|
#include "wx/panel.h"
|
||||||
|
|
||||||
|
// Define a new application type
|
||||||
|
class MyApp: public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool OnInit(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define a new frame type
|
||||||
|
class MyFrame: public wxFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxFrameLayout* mpLayout;
|
||||||
|
wxTextCtrl* mpClientWnd;
|
||||||
|
|
||||||
|
wxTextCtrl* CreateTextCtrl( const wxString& value );
|
||||||
|
|
||||||
|
public:
|
||||||
|
MyFrame(wxFrame *frame);
|
||||||
|
virtual ~MyFrame();
|
||||||
|
|
||||||
|
bool OnClose(void) { Show(FALSE); return TRUE; }
|
||||||
|
|
||||||
|
void OnLoad( wxCommandEvent& event );
|
||||||
|
void OnSave( wxCommandEvent& event );
|
||||||
|
void OnExit( wxCommandEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
3
contrib/samples/fl/fl_demo1/fl_demo1.rc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/* mondrian ICON "mondrian.ico" */
|
||||||
|
#include "wx/msw/wx.rc"
|
||||||
|
|
23
contrib/samples/fl/fl_demo1/makefile.b32
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample for 32-bit BC++
|
||||||
|
|
||||||
|
WXDIR = ..\..\..\..
|
||||||
|
TARGET = fl_demo1
|
||||||
|
|
||||||
|
EXTRACPPFLAGS =-DBMP_DIR=\"../bitmaps/\"
|
||||||
|
!if "$(FINAL)" == "1"
|
||||||
|
EXTRALIBS = $(WSLIBDIR)\fl.lib
|
||||||
|
!else
|
||||||
|
EXTRALIBS = $(WSLIBDIR)\fld.lib
|
||||||
|
!endif
|
||||||
|
|
||||||
|
OBJECTS = $(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.b32
|
||||||
|
|
18
contrib/samples/fl/fl_demo1/makefile.g95
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile for wxWorkshop for mingw & cygwin.
|
||||||
|
|
||||||
|
WXDIR = ../../../..
|
||||||
|
TARGET = fl_demo1
|
||||||
|
|
||||||
|
EXTRACPPFLAGS = -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
EXTRALIBS = $(WXDIR)/lib/libfl.a
|
||||||
|
|
||||||
|
OBJECTS = $(TARGET).o
|
||||||
|
|
||||||
|
include $(WXDIR)/src/makeprog.g95
|
24
contrib/samples/fl/fl_demo1/makefile.vc
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile : Builds fl sample (VC++, WIN32)
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debug info.
|
||||||
|
|
||||||
|
WXDIR = ..\..\..\..
|
||||||
|
TARGET = fl_demo1
|
||||||
|
|
||||||
|
EXTRAINC = -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
!if "$(FINAL)" == "1"
|
||||||
|
EXTRALIBS = $(WXDIR)\lib\fl.lib
|
||||||
|
!else
|
||||||
|
EXTRALIBS = $(WXDIR)\lib\fld.lib
|
||||||
|
!endif
|
||||||
|
|
||||||
|
PROGRAM = $(TARGET)
|
||||||
|
OBJECTS = $(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.vc
|
25
contrib/samples/fl/fl_demo2/Makefile.in
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample on UNIX/Linux.
|
||||||
|
|
||||||
|
top_srcdir = @top_srcdir@/..
|
||||||
|
top_builddir = ../../../..
|
||||||
|
|
||||||
|
TARGET = fl_demo2
|
||||||
|
|
||||||
|
program_dir = contrib/samples/fl/$(TARGET)
|
||||||
|
|
||||||
|
APPEXTRADEFS = -I$(top_srcdir)/contrib/include -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
APPEXTRALIBS = $(top_builddir)/lib/libfl.@WX_TARGET_LIBRARY_TYPE@
|
||||||
|
|
||||||
|
PROGRAM = $(TARGET)
|
||||||
|
OBJECTS = $(TARGET).o
|
||||||
|
|
||||||
|
include $(top_builddir)/src/makeprog.env
|
108
contrib/samples/fl/fl_demo2/fl_demo.dsp
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="fl_demo2" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||||
|
|
||||||
|
CFG=fl_demo2 - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "fl_demo.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "fl_demo.mak" CFG="fl_demo2 - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "fl_demo2 - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE "fl_demo2 - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "fl_demo2 - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../../include" /I "../../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /D BMP_DIR=\"../bitmaps/\" /c
|
||||||
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib png.lib zlib.lib jpeg.lib tiff.lib fl.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "fl_demo2 - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../../include" /I "../../../../contrib/include" /D "_DEBUG" /D DEBUG=1 /D "__WXDEBUG__" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /D BMP_DIR=\"../bitmaps/\" /c
|
||||||
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib fld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "fl_demo2 - Win32 Release"
|
||||||
|
# Name "fl_demo2 - Win32 Debug"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\fl_demo2.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "fl_demo2 - Win32 Release"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "fl_demo2 - Win32 Debug"
|
||||||
|
|
||||||
|
# ADD CPP /Yc"wx/wxprec.h"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\fl_demo2.rc
|
||||||
|
# End Source File
|
||||||
|
# End Target
|
||||||
|
# End Project
|
29
contrib/samples/fl/fl_demo2/fl_demo.dsw
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "fl_demo2"=.\fl_demo.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
986
contrib/samples/fl/fl_demo2/fl_demo2.cpp
Normal file
@@ -0,0 +1,986 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by: Sebastian Haase (June 21, 2001)
|
||||||
|
// Created: 04/11/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "fl_demo2.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// wxWindows headers.
|
||||||
|
#include "wx/treectrl.h"
|
||||||
|
#include "wx/imaglist.h"
|
||||||
|
#include "wx/notebook.h"
|
||||||
|
|
||||||
|
// fl headers.
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
#include "wx/fl/rowlayoutpl.h"
|
||||||
|
#include "wx/fl/antiflickpl.h"
|
||||||
|
#include "wx/fl/bardragpl.h"
|
||||||
|
#include "wx/fl/cbcustom.h"
|
||||||
|
#include "wx/fl/rowdragpl.h"
|
||||||
|
|
||||||
|
// some extra fl plugins.
|
||||||
|
#include "wx/fl/barhintspl.h"
|
||||||
|
#include "wx/fl/hintanimpl.h"
|
||||||
|
|
||||||
|
#include "wx/fl/dyntbar.h"
|
||||||
|
#include "wx/fl/dyntbarhnd.h" // fl-dimension-handler for dynamic toolbar
|
||||||
|
|
||||||
|
#include "fl_demo2.h"
|
||||||
|
|
||||||
|
/***** Implementation for class MyApp *****/
|
||||||
|
|
||||||
|
// Create a new application object
|
||||||
|
IMPLEMENT_APP (MyApp)
|
||||||
|
|
||||||
|
// `Main program' equivalent, creating windows and returning main app frame
|
||||||
|
bool MyApp::OnInit(void)
|
||||||
|
{
|
||||||
|
// Create the main frame window
|
||||||
|
MyFrame *frame = new MyFrame(NULL, "wxWindows 2.0 wxFrameLayout demo", 50, 50, 650, 540);
|
||||||
|
|
||||||
|
// Give it an icon
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
frame->SetIcon(wxIcon("mondrian"));
|
||||||
|
#endif
|
||||||
|
#ifdef __X__
|
||||||
|
frame->SetIcon(wxIcon("aiai.xbm"));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Make a menubar
|
||||||
|
wxMenu *file_menu = new wxMenu;
|
||||||
|
wxMenu *active_menu = new wxMenu;
|
||||||
|
|
||||||
|
file_menu->Append( ID_LOAD, "&Load layouts" );
|
||||||
|
file_menu->Append( ID_STORE, "&Store layouts" );
|
||||||
|
file_menu->AppendSeparator();
|
||||||
|
|
||||||
|
file_menu->Append( ID_AUTOSAVE, "&Auto Save Layouts", "save layouts on exit", TRUE );
|
||||||
|
file_menu->AppendSeparator();
|
||||||
|
|
||||||
|
file_menu->Append(MINIMAL_ABOUT, "A&bout !");
|
||||||
|
file_menu->Append(MINIMAL_QUIT, "E&xit\tTab");
|
||||||
|
|
||||||
|
//active_menu->Append( ID_SETTINGS, "&Settings...\tCtrl" );
|
||||||
|
//active_menu->AppendSeparator();
|
||||||
|
|
||||||
|
active_menu->Append( ID_REMOVE, "&Remove Active" );
|
||||||
|
active_menu->Append( ID_REMOVEALL, "Remove &All" );
|
||||||
|
active_menu->Append( ID_RECREATE, "Re&create" );
|
||||||
|
active_menu->AppendSeparator();
|
||||||
|
|
||||||
|
active_menu->Append( ID_FIRST, "Activate f&irst layout \tF1", "activate it", TRUE );
|
||||||
|
active_menu->Append( ID_SECOND, "Activate &second layout\tF2","activate it", TRUE );
|
||||||
|
active_menu->Append( ID_THIRD, "Activate &third layout\tF3","activate it", TRUE );
|
||||||
|
|
||||||
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
|
|
||||||
|
menu_bar->Append(file_menu, "&File");
|
||||||
|
menu_bar->Append(active_menu, "Active &Layout");
|
||||||
|
|
||||||
|
frame->CreateStatusBar(3);
|
||||||
|
|
||||||
|
frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
|
frame->SyncMenuBarItems();
|
||||||
|
|
||||||
|
// Show the frame
|
||||||
|
frame->Show(TRUE);
|
||||||
|
|
||||||
|
SetTopWindow(frame);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyFrame::~MyFrame()
|
||||||
|
{
|
||||||
|
// frame-layouts is not a windows (objects), thus should
|
||||||
|
// be cleaned up manually
|
||||||
|
|
||||||
|
for( int i = 0; i != MAX_LAYOUTS; ++i )
|
||||||
|
{
|
||||||
|
if ( mLayouts[i] )
|
||||||
|
delete mLayouts[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mpNestedLayout )
|
||||||
|
delete mpNestedLayout;
|
||||||
|
if ( mpAboutBoxLayout )
|
||||||
|
delete mpAboutBoxLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Implementation for class MyFrame *****/
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
|
EVT_MENU( MINIMAL_QUIT, MyFrame::OnQuit )
|
||||||
|
EVT_MENU( MINIMAL_ABOUT, MyFrame::OnAbout )
|
||||||
|
|
||||||
|
EVT_MENU( ID_LOAD, MyFrame::OnLoad )
|
||||||
|
EVT_MENU( ID_STORE, MyFrame::OnStore )
|
||||||
|
EVT_MENU( ID_AUTOSAVE, MyFrame::OnAutoSave )
|
||||||
|
//EVT_MENU( ID_SETTINGS, MyFrame::OnSettings )
|
||||||
|
EVT_MENU( ID_REMOVE, MyFrame::OnRemove )
|
||||||
|
EVT_MENU( ID_REMOVEALL, MyFrame::OnRemoveAll )
|
||||||
|
EVT_MENU( ID_RECREATE, MyFrame::OnRecreate )
|
||||||
|
EVT_MENU( ID_FIRST, MyFrame::OnFirst )
|
||||||
|
EVT_MENU( ID_SECOND, MyFrame::OnSecond )
|
||||||
|
EVT_MENU( ID_THIRD, MyFrame::OnThird )
|
||||||
|
|
||||||
|
EVT_BUTTON( ID_SAY_ITSOK, MyFrame::OnSayItsOk )
|
||||||
|
EVT_BUTTON( ID_BTN_YES, MyFrame::OnBtnYes )
|
||||||
|
EVT_BUTTON( ID_BTN_NO, MyFrame::OnBtnNo )
|
||||||
|
EVT_BUTTON( ID_BTN_ESC, MyFrame::OnBtnEsc )
|
||||||
|
|
||||||
|
EVT_CHAR_HOOK( MyFrame::OnChar )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
// My frame constructor
|
||||||
|
|
||||||
|
MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
||||||
|
: wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)),
|
||||||
|
mpNestedLayout( NULL ),
|
||||||
|
mpAboutBoxLayout( NULL ),
|
||||||
|
|
||||||
|
mActiveLayoutNo( FIRST_LAYOUT ),
|
||||||
|
mAutoSave( TRUE ),
|
||||||
|
mSavedAlready( FALSE ),
|
||||||
|
mpClntWindow( NULL ),
|
||||||
|
|
||||||
|
mImageList( 16,16, FALSE, 2 )
|
||||||
|
{
|
||||||
|
mpInternalFrm = (wxPanel*)this;
|
||||||
|
|
||||||
|
mAboutBox.Create( this, -1, "About box in wxWindows style...",
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxSize( 385,220),
|
||||||
|
wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL );
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for( i = 0; i != MAX_LAYOUTS; ++i )
|
||||||
|
mLayouts[i] = NULL;
|
||||||
|
|
||||||
|
// image-list is one of the few objects which
|
||||||
|
// currently cannot be serialized, create it first
|
||||||
|
// and use it as initial reference (IR)
|
||||||
|
|
||||||
|
wxBitmap bmp1,bmp2;
|
||||||
|
|
||||||
|
if ( wxFileExists( BMP_DIR "folder_icon.bmp" ) )
|
||||||
|
bmp1.LoadFile( BMP_DIR "folder_icon.bmp", wxBITMAP_TYPE_BMP );
|
||||||
|
|
||||||
|
if ( wxFileExists( BMP_DIR "class_icon1.bmp" ) )
|
||||||
|
bmp2.LoadFile( BMP_DIR "class_icon1.bmp", wxBITMAP_TYPE_BMP );
|
||||||
|
|
||||||
|
mImageList.Add( bmp1 );
|
||||||
|
mImageList.Add( bmp2 );
|
||||||
|
|
||||||
|
InitAboutBox();
|
||||||
|
|
||||||
|
// create multiple layouts
|
||||||
|
|
||||||
|
mpNestedLayout = 0;
|
||||||
|
|
||||||
|
mpClntWindow = CreateTxtCtrl("client window");
|
||||||
|
|
||||||
|
// Create all layouts
|
||||||
|
for( i = 0; i != MAX_LAYOUTS; ++i )
|
||||||
|
{
|
||||||
|
CreateLayout( i );
|
||||||
|
}
|
||||||
|
// hide others
|
||||||
|
for( i = SECOND_LAYOUT; i != MAX_LAYOUTS; ++i )
|
||||||
|
{
|
||||||
|
mLayouts[i]->HideBarWindows();
|
||||||
|
}
|
||||||
|
|
||||||
|
// activate first one
|
||||||
|
mLayouts[FIRST_LAYOUT]->Activate();
|
||||||
|
mActiveLayoutNo = FIRST_LAYOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** event handlers ***/
|
||||||
|
|
||||||
|
bool MyFrame::OnClose(void)
|
||||||
|
{
|
||||||
|
// USEFUL TRICK:: avoids flickering of application's frame
|
||||||
|
// when closing NN windows on exit:
|
||||||
|
|
||||||
|
this->Show(FALSE);
|
||||||
|
|
||||||
|
if ( (mAutoSave && mSavedAlready) || !mAutoSave )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxCommandEvent evt;
|
||||||
|
this->OnStore(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
mAboutBox.Destroy();
|
||||||
|
this->Destroy();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnLoad( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("Hey - you found a BIG question-mark !!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnStore( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("Hey - you found another BIG question-mark !!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnAutoSave( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
mAutoSave = !mAutoSave;
|
||||||
|
|
||||||
|
wxCommandEvent evt;
|
||||||
|
this->OnStore(evt);
|
||||||
|
|
||||||
|
SyncMenuBarItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnRemove( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
RemoveLayout( mActiveLayoutNo );
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnRemoveAll( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
for( int i = 0; i != MAX_LAYOUTS; ++i )
|
||||||
|
{
|
||||||
|
RemoveLayout( i );
|
||||||
|
}
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MyFrame::OnRecreate( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
OnRemove( event ); // first destroy active layout
|
||||||
|
|
||||||
|
CreateLayout( mActiveLayoutNo );
|
||||||
|
|
||||||
|
mLayouts[mActiveLayoutNo]->Activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnFirst( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
ActivateLayout( FIRST_LAYOUT );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnSecond( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
ActivateLayout( SECOND_LAYOUT );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnThird( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
ActivateLayout( THIRD_LAYOUT );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnQuit( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
// USEFUL TRICK:: avoids flickering of application's frame
|
||||||
|
// when closing NN windows on exit:
|
||||||
|
|
||||||
|
this->Show(FALSE);
|
||||||
|
|
||||||
|
if ( (mAutoSave && mSavedAlready) || !mAutoSave )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxCommandEvent evt;
|
||||||
|
this->OnStore(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnAbout( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxFont font;
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
font.SetFaceName("MS Sans Serif");
|
||||||
|
#else
|
||||||
|
font.SetFamily( wxSWISS );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
font.SetStyle( wxSLANT );
|
||||||
|
font.SetWeight( wxNORMAL );
|
||||||
|
font.SetPointSize( 8 );
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
font.RealizeResource();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mAboutBox.Center( wxBOTH );
|
||||||
|
mAboutBox.Show(TRUE);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnChar( wxKeyEvent& event )
|
||||||
|
{
|
||||||
|
wxCommandEvent evt;
|
||||||
|
|
||||||
|
if ( event.m_keyCode == WXK_F1 )
|
||||||
|
{
|
||||||
|
this->OnFirst( evt );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( event.m_keyCode == WXK_F2 )
|
||||||
|
{
|
||||||
|
this->OnSecond( evt );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( event.m_keyCode == WXK_F3 )
|
||||||
|
{
|
||||||
|
this->OnThird( evt );
|
||||||
|
}
|
||||||
|
if ( event.m_keyCode == WXK_F4 && !event.AltDown() )
|
||||||
|
{
|
||||||
|
// "AI" :-)
|
||||||
|
wxMessageBox("There are only 3 layouts in this demo :-(");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( event.m_keyCode == WXK_TAB )
|
||||||
|
{
|
||||||
|
// USEFUL TRICK:: avoids flickering of application's frame
|
||||||
|
// when closing NN windows on exit:
|
||||||
|
|
||||||
|
this->Show(FALSE);
|
||||||
|
|
||||||
|
if ( (mAutoSave && mSavedAlready) || !mAutoSave )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxCommandEvent evt;
|
||||||
|
this->OnStore(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnSayItsOk( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("It's OK :-)\n\n now click on the border around the button\n and try dragging it!" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnBtnYes( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
mAboutBox.Show(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnBtnNo( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
mAboutBox.Show(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnBtnEsc( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
mAboutBox.Show(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** helper methods ***/
|
||||||
|
|
||||||
|
void MyFrame::InitAboutBox()
|
||||||
|
{
|
||||||
|
wxPanel* pArea = new wxPanel();
|
||||||
|
|
||||||
|
pArea->Create( &mAboutBox, -1 );
|
||||||
|
|
||||||
|
new wxStaticText(pArea, -1, "This is wxFrameLayout contribution demo.",
|
||||||
|
wxPoint(10, 10) );
|
||||||
|
|
||||||
|
new wxStaticText(pArea, -1, "Aleksandras Gluchovas (c) 1998",
|
||||||
|
wxPoint(10, 30) );
|
||||||
|
|
||||||
|
new wxStaticText(pArea, -1, "<mailto:alex@soften.ktu.lt>",
|
||||||
|
wxPoint(10, 50) );
|
||||||
|
|
||||||
|
mpAboutBoxLayout = new wxFrameLayout( &mAboutBox, pArea, TRUE );
|
||||||
|
|
||||||
|
wxFrameLayout& layout = *mpAboutBoxLayout;
|
||||||
|
|
||||||
|
cbDimInfo sizes( 90,40, // when docked horizontally
|
||||||
|
45,55, // when docked vertically
|
||||||
|
90,40, // when floated
|
||||||
|
TRUE, 4, 4 // true - bar is fixed-size
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
wxButton* pYes = CreateButton("&Yes", &mAboutBox, ID_SAY_ITSOK );
|
||||||
|
wxButton* pNo = CreateButton("&No", &mAboutBox, ID_BTN_NO );
|
||||||
|
wxButton* pEsc = CreateButton("Cancel", &mAboutBox, ID_BTN_ESC );
|
||||||
|
|
||||||
|
layout.AddBar( pEsc, sizes, FL_ALIGN_BOTTOM, 0, 20, "cancel button");
|
||||||
|
layout.AddBar( pNo, sizes, FL_ALIGN_BOTTOM, 0, 20, "no button");
|
||||||
|
layout.AddBar( pYes, sizes, FL_ALIGN_BOTTOM, 0, 20, "yes button");
|
||||||
|
|
||||||
|
layout.mBorderPen.SetColour( 192, 192, 192 );
|
||||||
|
layout.SetMargins( 15, 15, 15, 15, wxALL_PANES );
|
||||||
|
|
||||||
|
cbCommonPaneProperties props;
|
||||||
|
|
||||||
|
layout.GetPaneProperties( props, FL_ALIGN_TOP );
|
||||||
|
|
||||||
|
props.mShow3DPaneBorderOn = FALSE;
|
||||||
|
|
||||||
|
layout.SetPaneProperties( props, wxALL_PANES );
|
||||||
|
|
||||||
|
layout.Activate();
|
||||||
|
|
||||||
|
pYes->SetDefault();
|
||||||
|
pYes->SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxTextCtrl* MyFrame::CreateTxtCtrl( const wxString& txt, wxWindow* parent )
|
||||||
|
{
|
||||||
|
return new wxTextCtrl( (parent != NULL ) ? parent : mpInternalFrm,
|
||||||
|
-1, txt, wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxTE_MULTILINE );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxButton* MyFrame::CreateButton( const wxString& label,
|
||||||
|
wxWindow* pParent, long id )
|
||||||
|
{
|
||||||
|
return new wxButton( (pParent)?pParent : mpInternalFrm, id,
|
||||||
|
label, wxPoint( 0,0 ), wxSize( 0,0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxTreeCtrl* MyFrame::CreateTreeCtrl( const wxString& label )
|
||||||
|
{
|
||||||
|
wxTreeCtrl* pTree = new wxTreeCtrl( mpInternalFrm, -1 );
|
||||||
|
|
||||||
|
int rootid = pTree->AppendItem( (long)0, label, 0);
|
||||||
|
|
||||||
|
if ( label[0] != 'X' )
|
||||||
|
{
|
||||||
|
pTree->AppendItem(rootid, "Leaf1", 0);
|
||||||
|
pTree->AppendItem(rootid, "Leaf2", 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pTree->AppendItem(rootid, "Scully", 0);
|
||||||
|
pTree->AppendItem(rootid, "Mulder", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pTree;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxChoice* MyFrame::CreateChoice( const wxString& txt )
|
||||||
|
{
|
||||||
|
wxString choice_strings[5];
|
||||||
|
|
||||||
|
choice_strings[0] = txt;
|
||||||
|
choice_strings[1] = "Julian";
|
||||||
|
choice_strings[2] = "Hattie";
|
||||||
|
choice_strings[3] = "Ken";
|
||||||
|
choice_strings[4] = "Dick";
|
||||||
|
|
||||||
|
wxChoice *choice = new wxChoice( mpInternalFrm, 301, wxDefaultPosition,
|
||||||
|
wxDefaultSize, 5, choice_strings);
|
||||||
|
|
||||||
|
choice->SetSelection(0);
|
||||||
|
|
||||||
|
return choice;
|
||||||
|
}
|
||||||
|
|
||||||
|
// helper
|
||||||
|
|
||||||
|
void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent )
|
||||||
|
{
|
||||||
|
cbDimInfo sizes2( 275,38, // when docked horizontally
|
||||||
|
45,275, // when docked vertically
|
||||||
|
80,30, // when floated
|
||||||
|
TRUE, // the bar is fixed-size
|
||||||
|
4, // vertical gap (bar border)
|
||||||
|
4, // horizontal gap (bar border)
|
||||||
|
new cbDynToolBarDimHandler()
|
||||||
|
);
|
||||||
|
|
||||||
|
cbDimInfo sizes3( 275,55, // when docked horizontally
|
||||||
|
275,60, // when docked vertically
|
||||||
|
45,130, // when floated
|
||||||
|
TRUE, // the bar is fixed-size
|
||||||
|
4, // vertical gap (bar border)
|
||||||
|
4, // horizontal gap (bar border)
|
||||||
|
new cbDynToolBarDimHandler()
|
||||||
|
);
|
||||||
|
|
||||||
|
cbDimInfo sizes4( 430,35, // when docked horizontally
|
||||||
|
44,375, // when docked vertically
|
||||||
|
80,100, // when floated
|
||||||
|
TRUE, // the bar is fixed-size
|
||||||
|
4, // vertical gap (bar border)
|
||||||
|
4, // horizontal gap (bar border)
|
||||||
|
new cbDynToolBarDimHandler()
|
||||||
|
);
|
||||||
|
|
||||||
|
wxDynamicToolBar* pTBar2 = new wxDynamicToolBar( mpInternalFrm, -1 );
|
||||||
|
|
||||||
|
wxChoice* pChoice = new wxChoice( pTBar2, -1, wxDefaultPosition, wxSize( 140,25 ) );
|
||||||
|
|
||||||
|
pTBar2->AddTool( 1, pChoice );
|
||||||
|
pTBar2->AddTool( 2, BMP_DIR "search.bmp" );
|
||||||
|
//pTBar2->AddSeparator();
|
||||||
|
pTBar2->AddTool( 3, BMP_DIR "bookmarks.bmp" );
|
||||||
|
pTBar2->AddTool( 4, BMP_DIR "nextmark.bmp" );
|
||||||
|
pTBar2->AddTool( 5, BMP_DIR "prevmark.bmp" );
|
||||||
|
|
||||||
|
wxDynamicToolBar* pTBar3 = new wxDynamicToolBar( mpInternalFrm, -1 );
|
||||||
|
|
||||||
|
pTBar3->AddTool( 1, BMP_DIR "open.bmp", wxBITMAP_TYPE_BMP, " Open " );
|
||||||
|
pTBar3->AddTool( 2, BMP_DIR "save.bmp", wxBITMAP_TYPE_BMP, " Save " );
|
||||||
|
pTBar3->AddTool( 3, BMP_DIR "saveall.bmp", wxBITMAP_TYPE_BMP, " Save All " );
|
||||||
|
//pTBar3->AddSeparator();
|
||||||
|
pTBar3->AddTool( 4, BMP_DIR "cut.bmp", wxBITMAP_TYPE_BMP, " Open " );
|
||||||
|
pTBar3->AddTool( 5, BMP_DIR "copy.bmp", wxBITMAP_TYPE_BMP, " Copy " );
|
||||||
|
pTBar3->AddTool( 6, BMP_DIR "paste.bmp", wxBITMAP_TYPE_BMP, " Paste " );
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
pTBar3->EnableTool( 2, FALSE );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wxDynamicToolBar* pTBar4 = new wxDynamicToolBar( mpInternalFrm, -1 );
|
||||||
|
|
||||||
|
pTBar4->AddTool( 1, BMP_DIR "bookmarks.bmp", wxBITMAP_TYPE_BMP, "Bookmarks ", TRUE );
|
||||||
|
pTBar4->AddTool( 2, BMP_DIR "nextmark.bmp", wxBITMAP_TYPE_BMP, "Next bookmark ", TRUE );
|
||||||
|
pTBar4->AddTool( 3, BMP_DIR "prevmark.bmp", wxBITMAP_TYPE_BMP, "Prev bookmark ", TRUE );
|
||||||
|
//pTBar4->AddSeparator();
|
||||||
|
pTBar4->AddTool( 4, BMP_DIR "search.bmp", wxBITMAP_TYPE_BMP, "Search ", TRUE );
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
pTBar4->EnableTool( 4, FALSE );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
layout.AddBar( pTBar2,
|
||||||
|
sizes2, FL_ALIGN_TOP,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
"Search",
|
||||||
|
TRUE
|
||||||
|
);
|
||||||
|
|
||||||
|
layout.AddBar( pTBar3,
|
||||||
|
sizes3, FL_ALIGN_BOTTOM,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
"Titled",
|
||||||
|
TRUE
|
||||||
|
);
|
||||||
|
|
||||||
|
layout.AddBar( pTBar4,
|
||||||
|
sizes4, FL_ALIGN_BOTTOM,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
"Bookmarks",
|
||||||
|
TRUE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxWindow* MyFrame::CreateDevLayout( wxFrameLayout& layout, wxWindow* pParent )
|
||||||
|
{
|
||||||
|
bool isNested = (pParent != mpInternalFrm);
|
||||||
|
|
||||||
|
// check if we're craeting nested layout
|
||||||
|
if ( isNested )
|
||||||
|
{
|
||||||
|
layout.mBorderPen.SetColour( 128,255,128 );
|
||||||
|
|
||||||
|
// if so, than make border smaller
|
||||||
|
for( int i = 0; i != MAX_PANES; ++i )
|
||||||
|
{
|
||||||
|
cbDockPane& pane = *layout.GetPane( i );
|
||||||
|
|
||||||
|
pane.mTopMargin = 5;
|
||||||
|
pane.mBottomMargin = 5;
|
||||||
|
pane.mLeftMargin = 5;
|
||||||
|
pane.mRightMargin = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int cbWidth = 200;
|
||||||
|
int cbHeight = ( isNested ) ? 50 : 150;
|
||||||
|
|
||||||
|
cbDimInfo sizes4( cbWidth,cbHeight,
|
||||||
|
cbWidth,cbHeight,
|
||||||
|
cbWidth,cbHeight, FALSE );
|
||||||
|
|
||||||
|
cbWidth = 75;
|
||||||
|
cbHeight = 31;
|
||||||
|
|
||||||
|
cbDimInfo sizes5( cbWidth,cbHeight,
|
||||||
|
42,65,
|
||||||
|
cbWidth,cbHeight, TRUE,
|
||||||
|
3, // vertical gap (bar border)
|
||||||
|
3 // horizontal gap (bar border)
|
||||||
|
);
|
||||||
|
|
||||||
|
// create "workplace" window in the third layout
|
||||||
|
// SEB: originally here was a wxpp (wxWorkshop) class demotrated
|
||||||
|
// wxTabbedWindow* pMiniTabArea = new wxTabbedWindow();
|
||||||
|
// pMiniTabArea->Create( pParent, -1 );
|
||||||
|
|
||||||
|
|
||||||
|
wxTreeCtrl* pClassView = new wxTreeCtrl( pParent, -1,
|
||||||
|
wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS );
|
||||||
|
|
||||||
|
pClassView->SetImageList( &mImageList );
|
||||||
|
|
||||||
|
wxTreeItemId rootId = pClassView->AddRoot( "wxWindows 2.0 classes", 0 );
|
||||||
|
|
||||||
|
pClassView->AppendItem( rootId, "wxWin Dynamic classes (grabbed at run-time)", 0 );
|
||||||
|
pClassView->AppendItem( rootId, "serializer-classes (grabbed at run-time)", 0 );
|
||||||
|
|
||||||
|
// now create "output" window
|
||||||
|
wxNotebook* pTabbedArea = new wxNotebook(pParent, -1);
|
||||||
|
// SEB: originally here was a wxpp (wxWorkshop) class used
|
||||||
|
// wxPaggedWindow* pTabbedArea = new wxPaggedWindow();
|
||||||
|
// pTabbedArea->Create( pParent, -1 );
|
||||||
|
|
||||||
|
wxPanel* pSheet3 = new wxPanel();
|
||||||
|
pSheet3->Create( pTabbedArea, -1 );
|
||||||
|
pSheet3->Show(FALSE);
|
||||||
|
|
||||||
|
pTabbedArea->AddPage( CreateTxtCtrl("build", pTabbedArea), "Build");
|
||||||
|
pTabbedArea->AddPage( CreateTxtCtrl("debug", pTabbedArea), "Debug");
|
||||||
|
pTabbedArea->AddPage( pSheet3, "is THIS recursive - or what !?");
|
||||||
|
pTabbedArea->AddPage( CreateTxtCtrl("profile", pTabbedArea), "Profile");
|
||||||
|
|
||||||
|
layout.AddBar( new StartButton95(pParent), sizes5, FL_ALIGN_TOP, 0, 0, "Start..." );
|
||||||
|
layout.AddBar( pClassView, sizes4, FL_ALIGN_LEFT, 0, 0, "Project Workplace" );
|
||||||
|
layout.AddBar( pTabbedArea, sizes4, FL_ALIGN_BOTTOM, 0, 50, "Output" );
|
||||||
|
|
||||||
|
return pSheet3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::DropInSomeBars( int layoutNo )
|
||||||
|
{
|
||||||
|
/* create once... and forget! */
|
||||||
|
|
||||||
|
// setup dimension infos for various bar shapes
|
||||||
|
|
||||||
|
int cbWidth = 90;
|
||||||
|
int cbHeight = 30;
|
||||||
|
|
||||||
|
if ( layoutNo == SECOND_LAYOUT )
|
||||||
|
cbHeight = 60;
|
||||||
|
|
||||||
|
wxFrameLayout& layout = *mLayouts[layoutNo];
|
||||||
|
|
||||||
|
cbDimInfo sizes( cbWidth,cbHeight, // when docked horizontally
|
||||||
|
cbWidth,cbHeight, // when docked vertically
|
||||||
|
cbWidth,cbHeight, // when floated
|
||||||
|
TRUE // true - bar is fixed-size
|
||||||
|
);
|
||||||
|
|
||||||
|
cbWidth = 120;
|
||||||
|
|
||||||
|
cbDimInfo sizes1( cbWidth,cbHeight,
|
||||||
|
cbWidth,cbHeight,
|
||||||
|
cbWidth,cbHeight, FALSE ); // false - bar is "flexible"
|
||||||
|
|
||||||
|
cbWidth = 120;
|
||||||
|
cbHeight = 40;
|
||||||
|
|
||||||
|
cbDimInfo sizes3( cbWidth,cbHeight,
|
||||||
|
cbWidth,cbHeight,
|
||||||
|
cbWidth,cbHeight, TRUE ); // -/-
|
||||||
|
|
||||||
|
cbWidth = 200;
|
||||||
|
cbHeight = 150;
|
||||||
|
|
||||||
|
cbDimInfo sizes4( cbWidth,cbHeight,
|
||||||
|
cbWidth,cbHeight,
|
||||||
|
cbWidth,cbHeight, FALSE ); // -/-
|
||||||
|
|
||||||
|
cbWidth = 63;
|
||||||
|
cbHeight = 31;
|
||||||
|
|
||||||
|
cbDimInfo sizes5( cbWidth,cbHeight,
|
||||||
|
cbHeight,cbWidth,
|
||||||
|
cbWidth,cbHeight, TRUE,
|
||||||
|
3, // vertical gap (bar border)
|
||||||
|
3 // horizontal gap (bar border)
|
||||||
|
); // -/-
|
||||||
|
|
||||||
|
|
||||||
|
if ( layoutNo == FIRST_LAYOUT )
|
||||||
|
{
|
||||||
|
// add 4 fixed-size bars (`sizes' dim-info) and one "flexible" (with `sizes1' dim-info)
|
||||||
|
|
||||||
|
wxWindow* pGreenOne = new MyTestPanel(mpInternalFrm);
|
||||||
|
|
||||||
|
pGreenOne->SetBackgroundColour( wxColour(128,255,128) );
|
||||||
|
|
||||||
|
layout.AddBar( pGreenOne, sizes, FL_ALIGN_TOP, 0, 50, "Bar1", TRUE );
|
||||||
|
layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_TOP, 2, 50, "Bar2", TRUE );
|
||||||
|
layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_BOTTOM, 2, 50, "Bar3", TRUE );
|
||||||
|
layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_LEFT, 2, 50, "Bar4", TRUE );
|
||||||
|
layout.AddBar( new MyTestPanel(mpInternalFrm), sizes1, wxCBAR_HIDDEN, 2, 50, "Super-Bar", TRUE );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( layoutNo == SECOND_LAYOUT )
|
||||||
|
{
|
||||||
|
// show off various wx-controls in the second layout
|
||||||
|
|
||||||
|
layout.AddBar( CreateTxtCtrl(), sizes, FL_ALIGN_TOP, 0, 50, "Fixed text Area&0" );
|
||||||
|
layout.AddBar( CreateButton("OK"), sizes, FL_ALIGN_TOP, 0, 100, "First Button" );
|
||||||
|
layout.AddBar( CreateTxtCtrl(), sizes1, FL_ALIGN_BOTTOM, 0, 50, "First Tree" );
|
||||||
|
layout.AddBar( CreateTreeCtrl("Root"), sizes1, FL_ALIGN_LEFT, 0, 0, "TreeCtrl Window" );
|
||||||
|
layout.AddBar( CreateChoice("Choice 1"), sizes3, FL_ALIGN_TOP, 0, 0, "Choice 1 (buggy)", FALSE, wxCBAR_HIDDEN );
|
||||||
|
layout.AddBar( CreateChoice("Choice 2"), sizes3, FL_ALIGN_TOP, 0, 0, "Choice 2 (buggy)", FALSE, wxCBAR_HIDDEN );
|
||||||
|
layout.AddBar( CreateTreeCtrl("X-Files"), sizes1, FL_ALIGN_RIGHT, 0, 100, "X-Files" );
|
||||||
|
layout.AddBar( CreateTxtCtrl("smaller1"), sizes3, FL_ALIGN_TOP, 0, 50, "smaller Area1" );
|
||||||
|
layout.AddBar( CreateTxtCtrl("smaller2"), sizes3, FL_ALIGN_TOP, 0, 50, "sm&ller Area2" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( layoutNo == THIRD_LAYOUT )
|
||||||
|
{
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
cbCommonPaneProperties props;
|
||||||
|
layout.GetPaneProperties( props );
|
||||||
|
props.mRealTimeUpdatesOn = FALSE; // real-time OFF for gtk!!!
|
||||||
|
layout.SetPaneProperties( props, wxALL_PANES );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
layout.AddBar( CreateTxtCtrl("Tool1"), sizes3, FL_ALIGN_TOP, 0, 50, "Fixed text Area1" );
|
||||||
|
layout.AddBar( CreateTxtCtrl("Tool2"), sizes3, FL_ALIGN_TOP, 0, 50, "Fixed text Area2" );
|
||||||
|
layout.AddBar( CreateTxtCtrl("Tool3"), sizes3, FL_ALIGN_TOP, 0, 50, "Fixed text Area3" );
|
||||||
|
layout.AddBar( CreateTxtCtrl("Tool4"), sizes3, FL_ALIGN_TOP, 1, 50, "Fixed text Area4" );
|
||||||
|
layout.AddBar( CreateTxtCtrl("Tool5"), sizes3, FL_ALIGN_TOP, 1, 50, "Fixed text Area5" );
|
||||||
|
layout.AddBar( CreateTxtCtrl("Tool6"), sizes3, FL_ALIGN_TOP, 1, 50, "Fixed text Area6" );
|
||||||
|
layout.AddBar( CreateTxtCtrl("Tool7"), sizes3, FL_ALIGN_TOP, 2,250, "Fixed text Area7" );
|
||||||
|
|
||||||
|
cbDimInfo sizes10( 175,35, // when docked horizontally
|
||||||
|
175,38, // when docked vertically
|
||||||
|
170,35, // when floated
|
||||||
|
TRUE, // the bar is not fixed-size
|
||||||
|
4, // vertical gap (bar border)
|
||||||
|
4, // horizontal gap (bar border)
|
||||||
|
new cbDynToolBarDimHandler()
|
||||||
|
);
|
||||||
|
|
||||||
|
wxDynamicToolBar* pToolBar = new wxDynamicToolBar();
|
||||||
|
|
||||||
|
pToolBar->Create( mpInternalFrm, -1 );
|
||||||
|
|
||||||
|
// 1001-1006 ids of command events fired by added tool-buttons
|
||||||
|
|
||||||
|
pToolBar->AddTool( 1001, BMP_DIR "new.bmp" );
|
||||||
|
pToolBar->AddTool( 1002, BMP_DIR "open.bmp" );
|
||||||
|
pToolBar->AddTool( 1003, BMP_DIR "save.bmp" );
|
||||||
|
|
||||||
|
pToolBar->AddTool( 1004, BMP_DIR "cut.bmp" );
|
||||||
|
pToolBar->AddTool( 1005, BMP_DIR "copy.bmp" );
|
||||||
|
pToolBar->AddTool( 1006, BMP_DIR "paste.bmp" );
|
||||||
|
|
||||||
|
layout.AddBar( pToolBar, // bar window (can be NULL)
|
||||||
|
sizes10, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
|
||||||
|
0, // insert into 0th row (vert. position)
|
||||||
|
0, // offset from the start of row (in pixels)
|
||||||
|
"Real-Toolbar", // name to refere in customization pop-ups
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
// create first "developement" layout
|
||||||
|
AddSearchToolbars( layout, mpInternalFrm);
|
||||||
|
|
||||||
|
wxWindow* pSheet3 = CreateDevLayout( layout, mpInternalFrm);
|
||||||
|
|
||||||
|
// create another ***secreat developement*** layout inside
|
||||||
|
// the third sheet of the outter one's output bar
|
||||||
|
|
||||||
|
mpNestedLayout = new wxFrameLayout( pSheet3,
|
||||||
|
CreateTxtCtrl("\"Mobils in Mobile\" --C.Nemo",pSheet3), FALSE );
|
||||||
|
|
||||||
|
CreateDevLayout( *mpNestedLayout, pSheet3 );
|
||||||
|
|
||||||
|
mpNestedLayout->Activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::CreateLayout( int layoutNo )
|
||||||
|
{
|
||||||
|
wxFrameLayout* pLayout = new wxFrameLayout( mpInternalFrm, mpClntWindow, FALSE );
|
||||||
|
|
||||||
|
if ( layoutNo == THIRD_LAYOUT )
|
||||||
|
{
|
||||||
|
pLayout->PushDefaultPlugins();
|
||||||
|
pLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for bars
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
pLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
|
||||||
|
#endif
|
||||||
|
pLayout->AddPlugin( CLASSINFO( cbRowDragPlugin ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
mLayouts[layoutNo] = pLayout;
|
||||||
|
|
||||||
|
DropInSomeBars( layoutNo );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::RemoveLayout( int layoutNo )
|
||||||
|
{
|
||||||
|
wxFrameLayout* pLayout = mLayouts[layoutNo];
|
||||||
|
|
||||||
|
if ( !pLayout )
|
||||||
|
return;
|
||||||
|
|
||||||
|
pLayout->HideBarWindows();
|
||||||
|
|
||||||
|
// destroy nested layout first
|
||||||
|
|
||||||
|
if ( layoutNo == THIRD_LAYOUT )
|
||||||
|
{
|
||||||
|
if ( mpNestedLayout )
|
||||||
|
delete mpNestedLayout;
|
||||||
|
mpNestedLayout = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE:: bar windows are NOT destroyed automatically by frame-layout
|
||||||
|
|
||||||
|
pLayout->DestroyBarWindows();
|
||||||
|
|
||||||
|
delete pLayout;
|
||||||
|
|
||||||
|
mLayouts[layoutNo] = NULL;
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::SyncMenuBarItems()
|
||||||
|
{
|
||||||
|
for( int i = 0; i != MAX_LAYOUTS; ++i )
|
||||||
|
{
|
||||||
|
GetMenuBar()->Check( ID_FIRST+i, mActiveLayoutNo == FIRST_LAYOUT+i );
|
||||||
|
}
|
||||||
|
|
||||||
|
GetMenuBar()->Check( ID_AUTOSAVE, mAutoSave );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::ActivateLayout( int layoutNo )
|
||||||
|
{
|
||||||
|
if ( layoutNo == mActiveLayoutNo )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( mLayouts[mActiveLayoutNo] )
|
||||||
|
mLayouts[mActiveLayoutNo]->Deactivate();
|
||||||
|
|
||||||
|
mActiveLayoutNo = layoutNo;
|
||||||
|
|
||||||
|
if ( mLayouts[mActiveLayoutNo] )
|
||||||
|
mLayouts[mActiveLayoutNo]->Activate();
|
||||||
|
else
|
||||||
|
Refresh();
|
||||||
|
|
||||||
|
SyncMenuBarItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Implementation for class StartButton95 (just for fun) *****/
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS( StartButton95, wxPanel )
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( StartButton95, wxPanel )
|
||||||
|
EVT_LEFT_DOWN( StartButton95::OnMouseDown )
|
||||||
|
EVT_LEFT_UP ( StartButton95::OnMouseUp )
|
||||||
|
EVT_PAINT ( StartButton95::OnPaint )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
void StartButton95::OnMouseDown( wxMouseEvent& event )
|
||||||
|
{
|
||||||
|
m_bPressed = TRUE;
|
||||||
|
Refresh();
|
||||||
|
CaptureMouse();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartButton95::OnMouseUp( wxMouseEvent& event )
|
||||||
|
{
|
||||||
|
// "this is not a bug"
|
||||||
|
|
||||||
|
SetCursor( wxCURSOR_WAIT );
|
||||||
|
GetParent()->SetCursor( wxCURSOR_WAIT );
|
||||||
|
::wxSetCursor( wxCURSOR_WAIT );
|
||||||
|
wxSleep(1);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for( i = 1; i != 6; ++i )
|
||||||
|
{
|
||||||
|
m_bPressed = (i % 2) != 0;
|
||||||
|
Refresh();
|
||||||
|
wxSleep(1);
|
||||||
|
}
|
||||||
|
GetParent()->Close();
|
||||||
|
//*((char*)(i)-3) = 'X'; // Aleks what's the meaning of this???
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartButton95::OnPaint( wxPaintEvent& event )
|
||||||
|
{
|
||||||
|
wxBitmap* pBmp = 0;
|
||||||
|
|
||||||
|
if ( m_bPressed )
|
||||||
|
{
|
||||||
|
if ( !m_PBmp.Ok() && wxFileExists( BMP_DIR "start95_pr.bmp" ) )
|
||||||
|
|
||||||
|
m_PBmp.LoadFile( BMP_DIR "start95_pr.bmp", wxBITMAP_TYPE_BMP );
|
||||||
|
|
||||||
|
pBmp = &m_PBmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !m_DBmp.Ok() && wxFileExists( BMP_DIR "start95_dp.bmp" ) )
|
||||||
|
|
||||||
|
m_DBmp.LoadFile( BMP_DIR "start95_dp.bmp", wxBITMAP_TYPE_BMP );
|
||||||
|
|
||||||
|
pBmp = &m_DBmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pBmp) return;
|
||||||
|
wxMemoryDC mdc;
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
mdc.SelectObject( *pBmp );
|
||||||
|
|
||||||
|
dc.Blit( 0,0, pBmp->GetWidth(), pBmp->GetHeight(), &mdc, 0,0, wxCOPY );
|
||||||
|
|
||||||
|
mdc.SelectObject( wxNullBitmap );
|
||||||
|
}
|
160
contrib/samples/fl/fl_demo2/fl_demo2.h
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 04/11/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __FLDEMO_G__
|
||||||
|
#define __FLDEMO_G__
|
||||||
|
|
||||||
|
// ID for the menu commands
|
||||||
|
|
||||||
|
#define MINIMAL_QUIT 1
|
||||||
|
#define MINIMAL_ABOUT 102
|
||||||
|
|
||||||
|
#define ID_LOAD 103
|
||||||
|
#define ID_STORE 104
|
||||||
|
#define ID_AUTOSAVE 105
|
||||||
|
//#define ID_SETTINGS 106
|
||||||
|
#define ID_REMOVE 107
|
||||||
|
#define ID_REMOVEALL 108
|
||||||
|
#define ID_RECREATE 109
|
||||||
|
#define ID_ACTIVATE 110
|
||||||
|
#define ID_FIRST 111
|
||||||
|
#define ID_SECOND 112
|
||||||
|
#define ID_THIRD 113
|
||||||
|
|
||||||
|
#define ID_SAY_ITSOK 114
|
||||||
|
#define ID_BTN_YES 115
|
||||||
|
#define ID_BTN_NO 116
|
||||||
|
#define ID_BTN_ESC 117
|
||||||
|
|
||||||
|
#define MAX_LAYOUTS 3
|
||||||
|
|
||||||
|
#define FIRST_LAYOUT 0
|
||||||
|
#define SECOND_LAYOUT 1
|
||||||
|
#define THIRD_LAYOUT 2
|
||||||
|
|
||||||
|
class wxFrameLayout;
|
||||||
|
class wxObjectStorage;
|
||||||
|
|
||||||
|
// FOR NOW::
|
||||||
|
typedef wxPanel MyTestPanel;
|
||||||
|
|
||||||
|
// Define a new application type
|
||||||
|
|
||||||
|
class MyApp: public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool OnInit(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define a new frame type
|
||||||
|
|
||||||
|
class MyFrame: public wxFrame
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
wxFrameLayout* mLayouts[MAX_LAYOUTS];
|
||||||
|
|
||||||
|
wxFrameLayout* mpNestedLayout;
|
||||||
|
wxFrameLayout* mpAboutBoxLayout;
|
||||||
|
|
||||||
|
int mActiveLayoutNo;
|
||||||
|
bool mAutoSave;
|
||||||
|
bool mSavedAlready;
|
||||||
|
|
||||||
|
// container windows:
|
||||||
|
|
||||||
|
wxTextCtrl* mpClntWindow;
|
||||||
|
wxPanel* mpInternalFrm;
|
||||||
|
|
||||||
|
wxImageList mImageList;
|
||||||
|
|
||||||
|
wxFrame mAboutBox;
|
||||||
|
|
||||||
|
// helpers for control-creation
|
||||||
|
|
||||||
|
wxTextCtrl* CreateTxtCtrl ( const wxString& txt = "wxTextCtrl", wxWindow* parent = NULL );
|
||||||
|
wxTreeCtrl* CreateTreeCtrl( const wxString& label = "TreeCtrl" );
|
||||||
|
wxChoice* CreateChoice ( const wxString& txt = "Choice1" );
|
||||||
|
wxButton* CreateButton ( const wxString& label = "wxButton", wxWindow* pParent = NULL, long id = ID_SAY_ITSOK );
|
||||||
|
|
||||||
|
// helpers for layout-creation
|
||||||
|
|
||||||
|
void AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent );
|
||||||
|
wxWindow* CreateDevLayout( wxFrameLayout& layout, wxWindow* pParent );
|
||||||
|
|
||||||
|
void DropInSomeBars( int layoutNo );
|
||||||
|
void CreateLayout( int layoutNo );
|
||||||
|
void RemoveLayout( int layoutNo );
|
||||||
|
|
||||||
|
void InitAboutBox();
|
||||||
|
|
||||||
|
void ActivateLayout( int layoutNo );
|
||||||
|
|
||||||
|
public: /* public */
|
||||||
|
|
||||||
|
MyFrame( wxFrame *frame, char *title, int x, int y, int w, int h);
|
||||||
|
|
||||||
|
~MyFrame();
|
||||||
|
|
||||||
|
void SyncMenuBarItems();
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
|
||||||
|
bool OnClose(void);
|
||||||
|
|
||||||
|
void OnLoad( wxCommandEvent& event );
|
||||||
|
void OnStore( wxCommandEvent& event );
|
||||||
|
void OnAutoSave( wxCommandEvent& event );
|
||||||
|
void OnQuit(wxCommandEvent& event);
|
||||||
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
//void OnSettings( wxCommandEvent& event );
|
||||||
|
void OnRemove( wxCommandEvent& event );
|
||||||
|
void OnRemoveAll( wxCommandEvent& event );
|
||||||
|
void OnRecreate( wxCommandEvent& event );
|
||||||
|
void OnFirst( wxCommandEvent& event );
|
||||||
|
void OnSecond( wxCommandEvent& event );
|
||||||
|
void OnThird( wxCommandEvent& event );
|
||||||
|
|
||||||
|
void OnSayItsOk( wxCommandEvent& event );
|
||||||
|
void OnBtnYes( wxCommandEvent& event );
|
||||||
|
void OnBtnNo( wxCommandEvent& event );
|
||||||
|
void OnBtnEsc( wxCommandEvent& event );
|
||||||
|
|
||||||
|
void OnChar( wxKeyEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define a new button type, StartButton95 (Just for fun)
|
||||||
|
|
||||||
|
class StartButton95 : public wxPanel
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS( StartButton95 )
|
||||||
|
|
||||||
|
bool m_bPressed;
|
||||||
|
wxBitmap m_PBmp;
|
||||||
|
wxBitmap m_DBmp;
|
||||||
|
|
||||||
|
public:
|
||||||
|
StartButton95(void) : m_bPressed(FALSE) {}
|
||||||
|
|
||||||
|
StartButton95(wxWindow* parent)
|
||||||
|
: m_bPressed(FALSE) { wxPanel::Create(parent,-1); }
|
||||||
|
|
||||||
|
void OnMouseDown( wxMouseEvent& event );
|
||||||
|
void OnMouseUp( wxMouseEvent& event );
|
||||||
|
void OnPaint( wxPaintEvent& event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
3
contrib/samples/fl/fl_demo2/fl_demo2.rc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/* mondrian ICON "mondrian.ico" */
|
||||||
|
#include "wx/msw/wx.rc"
|
||||||
|
|
23
contrib/samples/fl/fl_demo2/makefile.b32
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample for 32-bit BC++
|
||||||
|
|
||||||
|
WXDIR = ..\..\..\..
|
||||||
|
TARGET = fl_demo2
|
||||||
|
|
||||||
|
EXTRACPPFLAGS =-DBMP_DIR=\"../bitmaps/\"
|
||||||
|
!if "$(FINAL)" == "1"
|
||||||
|
EXTRALIBS = $(WSLIBDIR)\fl.lib
|
||||||
|
!else
|
||||||
|
EXTRALIBS = $(WSLIBDIR)\fld.lib
|
||||||
|
!endif
|
||||||
|
|
||||||
|
OBJECTS = $(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.b32
|
||||||
|
|
18
contrib/samples/fl/fl_demo2/makefile.g95
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile for wxWorkshop for mingw & cygwin.
|
||||||
|
|
||||||
|
WXDIR = ../../../..
|
||||||
|
TARGET = fl_demo2
|
||||||
|
|
||||||
|
EXTRACPPFLAGS = -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
EXTRALIBS = $(WXDIR)/lib/libfl.a
|
||||||
|
|
||||||
|
OBJECTS = $(TARGET).o
|
||||||
|
|
||||||
|
include $(WXDIR)/src/makeprog.g95
|
24
contrib/samples/fl/fl_demo2/makefile.vc
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile : Builds fl sample (VC++, WIN32)
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debug info.
|
||||||
|
|
||||||
|
WXDIR = ..\..\..\..
|
||||||
|
TARGET = fl_demo2
|
||||||
|
|
||||||
|
EXTRAINC = -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
!if "$(FINAL)" == "1"
|
||||||
|
EXTRALIBS = $(WXDIR)\lib\fl.lib
|
||||||
|
!else
|
||||||
|
EXTRALIBS = $(WXDIR)\lib\fld.lib
|
||||||
|
!endif
|
||||||
|
|
||||||
|
PROGRAM = $(TARGET)
|
||||||
|
OBJECTS = $(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.vc
|
25
contrib/samples/fl/fl_sample1/Makefile.in
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample on UNIX/Linux.
|
||||||
|
|
||||||
|
top_srcdir = @top_srcdir@/..
|
||||||
|
top_builddir = ../../../..
|
||||||
|
|
||||||
|
TARGET = fl_sample1
|
||||||
|
|
||||||
|
program_dir = contrib/samples/fl/$(TARGET)
|
||||||
|
|
||||||
|
APPEXTRADEFS = -I$(top_srcdir)/contrib/include -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
APPEXTRALIBS = $(top_builddir)/lib/libfl.@WX_TARGET_LIBRARY_TYPE@
|
||||||
|
|
||||||
|
PROGRAM = $(TARGET)
|
||||||
|
OBJECTS = $(TARGET).o
|
||||||
|
|
||||||
|
include $(top_builddir)/src/makeprog.env
|
108
contrib/samples/fl/fl_sample1/fl_demo.dsp
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="fl_sample1" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||||
|
|
||||||
|
CFG=fl_sample1 - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "fl_demo.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "fl_demo.mak" CFG="fl_sample1 - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "fl_sample1 - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE "fl_sample1 - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "fl_sample1 - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../../include" /I "../../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /D BMP_DIR=\"../bitmaps/\" /c
|
||||||
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib png.lib zlib.lib jpeg.lib tiff.lib fl.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "fl_sample1 - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../../include" /I "../../../../contrib/include" /D "_DEBUG" /D DEBUG=1 /D "__WXDEBUG__" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /D BMP_DIR=\"../bitmaps/\" /c
|
||||||
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib fld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "fl_sample1 - Win32 Release"
|
||||||
|
# Name "fl_sample1 - Win32 Debug"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\fl_sample1.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "fl_sample1 - Win32 Release"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "fl_sample1 - Win32 Debug"
|
||||||
|
|
||||||
|
# ADD CPP /Yc"wx/wxprec.h"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\fl_sample1.rc
|
||||||
|
# End Source File
|
||||||
|
# End Target
|
||||||
|
# End Project
|
29
contrib/samples/fl/fl_sample1/fl_demo.dsw
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "fl_sample1"=.\fl_demo.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
196
contrib/samples/fl/fl_sample1/fl_sample1.cpp
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fl_sample1.cpp
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by: Sebastian Haase (June 21, 2001)
|
||||||
|
// Created: 24/11/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/textctrl.h"
|
||||||
|
|
||||||
|
// fl headers
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
// plugins used
|
||||||
|
#include "wx/fl/barhintspl.h"
|
||||||
|
#include "wx/fl/hintanimpl.h"
|
||||||
|
|
||||||
|
#define ID_LOAD 102
|
||||||
|
#define ID_STORE 103
|
||||||
|
#define ID_QUIT 104
|
||||||
|
|
||||||
|
class MyApp: public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool OnInit(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
class MyFrame: public wxFrame
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
wxFrameLayout* mpLayout;
|
||||||
|
wxWindow* mpClientWnd;
|
||||||
|
wxPanel* mpInternalFrm;
|
||||||
|
|
||||||
|
wxTextCtrl* CreateTextCtrl( const wxString& value );
|
||||||
|
|
||||||
|
public:
|
||||||
|
MyFrame( wxWindow* parent, char *title );
|
||||||
|
~MyFrame();
|
||||||
|
|
||||||
|
void OnLoad( wxCommandEvent& event );
|
||||||
|
void OnStore( wxCommandEvent& event );
|
||||||
|
void OnQuit( wxCommandEvent& event );
|
||||||
|
|
||||||
|
bool OnClose(void) { return TRUE; }
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
/***** Implementation for class MyApp *****/
|
||||||
|
|
||||||
|
IMPLEMENT_APP (MyApp)
|
||||||
|
|
||||||
|
bool MyApp::OnInit(void)
|
||||||
|
{
|
||||||
|
// wxWindows boiler-plate:
|
||||||
|
|
||||||
|
MyFrame *frame = new MyFrame(NULL, "wxFrameLayout sample");
|
||||||
|
|
||||||
|
wxMenu *file_menu = new wxMenu;
|
||||||
|
|
||||||
|
file_menu->Append( ID_LOAD, "&Load layout" );
|
||||||
|
file_menu->Append( ID_STORE, "&Store layout" );
|
||||||
|
file_menu->AppendSeparator();
|
||||||
|
|
||||||
|
file_menu->Append( ID_QUIT, "E&xit" );
|
||||||
|
|
||||||
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
|
|
||||||
|
menu_bar->Append(file_menu, "&File");
|
||||||
|
|
||||||
|
frame->CreateStatusBar(3);
|
||||||
|
frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
|
frame->Show(TRUE);
|
||||||
|
|
||||||
|
SetTopWindow(frame);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Immlementation for class MyFrame *****/
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
|
EVT_MENU( ID_LOAD, MyFrame::OnLoad )
|
||||||
|
EVT_MENU( ID_STORE, MyFrame::OnStore )
|
||||||
|
EVT_MENU( ID_QUIT, MyFrame::OnQuit )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
MyFrame::MyFrame( wxWindow* parent, char *title )
|
||||||
|
: wxFrame( parent, -1, "NewTest-II", wxDefaultPosition,
|
||||||
|
wxSize( 700, 500 ),
|
||||||
|
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
|
||||||
|
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
|
||||||
|
"freimas" )
|
||||||
|
{
|
||||||
|
mpInternalFrm = (wxPanel*)this;
|
||||||
|
|
||||||
|
mpClientWnd = CreateTextCtrl( "Client window" );
|
||||||
|
|
||||||
|
// btw, creation of internal frame is needed for wxGtk version
|
||||||
|
// to act correctly (since menu-bar is a separate window there..)
|
||||||
|
|
||||||
|
mpLayout = new wxFrameLayout( mpInternalFrm, mpClientWnd );
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
// real-time dosn't work well under wxGtk yet
|
||||||
|
cbCommonPaneProperties props;
|
||||||
|
mpLayout->GetPaneProperties( props );
|
||||||
|
|
||||||
|
props.mRealTimeUpdatesOn = FALSE; // off
|
||||||
|
|
||||||
|
mpLayout->SetPaneProperties( props, wxALL_PANES );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mpLayout->PushDefaultPlugins();
|
||||||
|
mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for barso
|
||||||
|
//mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
|
||||||
|
|
||||||
|
cbDimInfo sizes( 80,65, // when docked horizontally
|
||||||
|
80,65, // when docked vertically
|
||||||
|
80,30, // when floated
|
||||||
|
TRUE, // the bar is fixed-size
|
||||||
|
5, // vertical gap (bar border)
|
||||||
|
5 // horizontal gap (bar border)
|
||||||
|
);
|
||||||
|
|
||||||
|
// drop-in 20 bars
|
||||||
|
for( int i = 1; i <= 20; ++i )
|
||||||
|
{
|
||||||
|
char buf[4];
|
||||||
|
sprintf( buf, "%d", i );
|
||||||
|
wxString name = wxString("Bar-");
|
||||||
|
name += buf;
|
||||||
|
|
||||||
|
sizes.mIsFixed = i % 5 > 0; // every fifth bar is not fixed-size
|
||||||
|
|
||||||
|
if ( !sizes.mIsFixed ) name += " (flexible)";
|
||||||
|
|
||||||
|
mpLayout->AddBar( CreateTextCtrl(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)
|
||||||
|
name // name to refere in customization pop-ups
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MyFrame::~MyFrame()
|
||||||
|
{
|
||||||
|
// layout is not a window, should be released manually
|
||||||
|
if ( mpLayout )
|
||||||
|
delete mpLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
|
||||||
|
{
|
||||||
|
wxTextCtrl* pCtrl = new wxTextCtrl( mpInternalFrm, -1, value,
|
||||||
|
wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE );
|
||||||
|
|
||||||
|
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
|
||||||
|
|
||||||
|
return pCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnLoad( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("Hey - you found a BIG question-mark !!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnStore( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("Hey - you found another BIG question-mark !!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnQuit( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
Show( FALSE ); // TRICK:: hide it, to avoid flickered destruction
|
||||||
|
|
||||||
|
Close(TRUE);
|
||||||
|
}
|
||||||
|
|
3
contrib/samples/fl/fl_sample1/fl_sample1.rc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/* mondrian ICON "mondrian.ico" */
|
||||||
|
#include "wx/msw/wx.rc"
|
||||||
|
|
23
contrib/samples/fl/fl_sample1/makefile.b32
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample for 32-bit BC++
|
||||||
|
|
||||||
|
WXDIR = ..\..\..\..
|
||||||
|
TARGET = fl_sample1
|
||||||
|
|
||||||
|
EXTRACPPFLAGS =-DBMP_DIR=\"../bitmaps/\"
|
||||||
|
!if "$(FINAL)" == "1"
|
||||||
|
EXTRALIBS = $(WSLIBDIR)\fl.lib
|
||||||
|
!else
|
||||||
|
EXTRALIBS = $(WSLIBDIR)\fld.lib
|
||||||
|
!endif
|
||||||
|
|
||||||
|
OBJECTS = $(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.b32
|
||||||
|
|
18
contrib/samples/fl/fl_sample1/makefile.g95
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile for wxWorkshop for mingw & cygwin.
|
||||||
|
|
||||||
|
WXDIR = ../../../..
|
||||||
|
TARGET = fl_sample1
|
||||||
|
|
||||||
|
EXTRACPPFLAGS = -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
EXTRALIBS = $(WXDIR)/lib/libfl.a
|
||||||
|
|
||||||
|
OBJECTS = $(TARGET).o
|
||||||
|
|
||||||
|
include $(WXDIR)/src/makeprog.g95
|
24
contrib/samples/fl/fl_sample1/makefile.vc
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile : Builds fl sample (VC++, WIN32)
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debug info.
|
||||||
|
|
||||||
|
WXDIR = ..\..\..\..
|
||||||
|
TARGET = fl_sample1
|
||||||
|
|
||||||
|
EXTRAINC = -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
!if "$(FINAL)" == "1"
|
||||||
|
EXTRALIBS = $(WXDIR)\lib\fl.lib
|
||||||
|
!else
|
||||||
|
EXTRALIBS = $(WXDIR)\lib\fld.lib
|
||||||
|
!endif
|
||||||
|
|
||||||
|
PROGRAM = $(TARGET)
|
||||||
|
OBJECTS = $(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.vc
|
25
contrib/samples/fl/fl_sample2/Makefile.in
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample on UNIX/Linux.
|
||||||
|
|
||||||
|
top_srcdir = @top_srcdir@/..
|
||||||
|
top_builddir = ../../../..
|
||||||
|
|
||||||
|
TARGET = fl_sample2
|
||||||
|
|
||||||
|
program_dir = contrib/samples/fl/$(TARGET)
|
||||||
|
|
||||||
|
APPEXTRADEFS = -I$(top_srcdir)/contrib/include -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
APPEXTRALIBS = $(top_builddir)/lib/libfl.@WX_TARGET_LIBRARY_TYPE@
|
||||||
|
|
||||||
|
PROGRAM = $(TARGET)
|
||||||
|
OBJECTS = $(TARGET).o
|
||||||
|
|
||||||
|
include $(top_builddir)/src/makeprog.env
|
108
contrib/samples/fl/fl_sample2/fl_demo.dsp
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="fl_sample2" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||||
|
|
||||||
|
CFG=fl_sample2 - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "fl_demo.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "fl_demo.mak" CFG="fl_sample2 - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "fl_sample2 - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE "fl_sample2 - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "fl_sample2 - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../../include" /I "../../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /D BMP_DIR=\"../bitmaps/\" /c
|
||||||
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib png.lib zlib.lib jpeg.lib tiff.lib fl.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "fl_sample2 - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../../include" /I "../../../../contrib/include" /D "_DEBUG" /D DEBUG=1 /D "__WXDEBUG__" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /D BMP_DIR=\"../bitmaps/\" /c
|
||||||
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib fld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "fl_sample2 - Win32 Release"
|
||||||
|
# Name "fl_sample2 - Win32 Debug"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\fl_sample2.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "fl_sample2 - Win32 Release"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "fl_sample2 - Win32 Debug"
|
||||||
|
|
||||||
|
# ADD CPP /Yc"wx/wxprec.h"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\fl_sample2.rc
|
||||||
|
# End Source File
|
||||||
|
# End Target
|
||||||
|
# End Project
|
29
contrib/samples/fl/fl_sample2/fl_demo.dsw
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "fl_sample2"=.\fl_demo.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
194
contrib/samples/fl/fl_sample2/fl_sample2.cpp
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fl_sample2.cpp
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by: Sebastian Haase (June 21, 2001)
|
||||||
|
// Created: 24/11/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/textctrl.h"
|
||||||
|
|
||||||
|
// fl headers
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
// plugins used
|
||||||
|
#include "wx/fl/barhintspl.h"
|
||||||
|
#include "wx/fl/hintanimpl.h"
|
||||||
|
|
||||||
|
#define ID_LOAD 102
|
||||||
|
#define ID_STORE 103
|
||||||
|
#define ID_QUIT 104
|
||||||
|
|
||||||
|
|
||||||
|
class MyApp: public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool OnInit(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
class MyFrame: public wxFrame
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
wxFrameLayout* mpLayout;
|
||||||
|
wxWindow* mpClientWnd;
|
||||||
|
|
||||||
|
wxTextCtrl* CreateTextCtrl( const wxString& value );
|
||||||
|
|
||||||
|
public:
|
||||||
|
MyFrame( wxWindow* parent, char *title );
|
||||||
|
~MyFrame();
|
||||||
|
|
||||||
|
void populateMyFrame();
|
||||||
|
void OnLoad( wxCommandEvent& event );
|
||||||
|
void OnStore( wxCommandEvent& event );
|
||||||
|
void OnQuit( wxCommandEvent& event );
|
||||||
|
|
||||||
|
bool OnClose(void) { return TRUE; }
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
/***** Implementation for class MyApp *****/
|
||||||
|
|
||||||
|
IMPLEMENT_APP (MyApp)
|
||||||
|
|
||||||
|
bool MyApp::OnInit(void)
|
||||||
|
{
|
||||||
|
// wxWindows boiler-plate:
|
||||||
|
|
||||||
|
MyFrame *frame = new MyFrame(NULL, "wxFrameLayout sample");
|
||||||
|
|
||||||
|
wxMenu *file_menu = new wxMenu;
|
||||||
|
|
||||||
|
file_menu->Append( ID_LOAD, "&Load layout" );
|
||||||
|
file_menu->Append( ID_STORE, "&Store layout" );
|
||||||
|
file_menu->AppendSeparator();
|
||||||
|
|
||||||
|
file_menu->Append( ID_QUIT, "E&xit" );
|
||||||
|
|
||||||
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
|
|
||||||
|
menu_bar->Append(file_menu, "&File");
|
||||||
|
|
||||||
|
frame->CreateStatusBar(3);
|
||||||
|
frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
|
frame->Show(TRUE);
|
||||||
|
SetTopWindow(frame);
|
||||||
|
frame->populateMyFrame();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Immlementation for class MyFrame *****/
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
|
EVT_MENU( ID_LOAD, MyFrame::OnLoad )
|
||||||
|
EVT_MENU( ID_STORE, MyFrame::OnStore )
|
||||||
|
EVT_MENU( ID_QUIT, MyFrame::OnQuit )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
MyFrame::MyFrame( wxWindow* parent, char *title )
|
||||||
|
: wxFrame( parent, -1, "NewTest-II", wxDefaultPosition,
|
||||||
|
wxSize( 700, 500 ),
|
||||||
|
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
|
||||||
|
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
|
||||||
|
"freimas" )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::populateMyFrame()
|
||||||
|
{
|
||||||
|
mpClientWnd = CreateTextCtrl( "Client window" );
|
||||||
|
|
||||||
|
mpLayout = new wxFrameLayout( this, mpClientWnd );
|
||||||
|
|
||||||
|
/// mpLayout->PushDefaultPlugins();
|
||||||
|
/// mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for barso
|
||||||
|
/// //mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
|
||||||
|
|
||||||
|
cbDimInfo sizes( 80,65, // when docked horizontally
|
||||||
|
80,165, // when docked vertically
|
||||||
|
180,30, // when floated
|
||||||
|
TRUE, // the bar is fixed-size
|
||||||
|
5, // vertical gap (bar border)
|
||||||
|
5 // horizontal gap (bar border)
|
||||||
|
);
|
||||||
|
|
||||||
|
// drop-in 20 bars
|
||||||
|
for( int i = 1; i <= 10; ++i )
|
||||||
|
{
|
||||||
|
wxSleep(1);
|
||||||
|
wxYield(); // CHECK!
|
||||||
|
|
||||||
|
char buf[4];
|
||||||
|
sprintf( buf, "%d", i );
|
||||||
|
wxString name = wxString("Bar-");
|
||||||
|
name += buf;
|
||||||
|
|
||||||
|
//sizes.mIsFixed = i % 2 > 0; // every fifth bar is not fixed-size
|
||||||
|
|
||||||
|
if ( !sizes.mIsFixed ) name += " (flexible)";
|
||||||
|
// mpLayout->AddBar( CreateTextCtrl(name),// bar window
|
||||||
|
mpLayout->AddBar( new wxTextCtrl(this, -1, 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)
|
||||||
|
name // name to refere in customization pop-ups
|
||||||
|
);
|
||||||
|
|
||||||
|
mpLayout->RecalcLayout(true);
|
||||||
|
|
||||||
|
// Layout();
|
||||||
|
// Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MyFrame::~MyFrame()
|
||||||
|
{
|
||||||
|
// layout is not a window, should be released manually
|
||||||
|
if ( mpLayout )
|
||||||
|
delete mpLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
|
||||||
|
{
|
||||||
|
wxTextCtrl* pCtrl = new wxTextCtrl( this, -1, value,
|
||||||
|
wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE );
|
||||||
|
|
||||||
|
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
|
||||||
|
|
||||||
|
return pCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnLoad( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("Hey - you found a BIG question-mark !!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnStore( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("Hey - you found another BIG question-mark !!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnQuit( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
Show( FALSE ); // TRICK:: hide it, to avoid flickered destruction
|
||||||
|
|
||||||
|
Close(TRUE);
|
||||||
|
}
|
||||||
|
|
3
contrib/samples/fl/fl_sample2/fl_sample2.rc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/* mondrian ICON "mondrian.ico" */
|
||||||
|
#include "wx/msw/wx.rc"
|
||||||
|
|
23
contrib/samples/fl/fl_sample2/makefile.b32
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample for 32-bit BC++
|
||||||
|
|
||||||
|
WXDIR = ..\..\..\..
|
||||||
|
TARGET = fl_sample2
|
||||||
|
|
||||||
|
EXTRACPPFLAGS =-DBMP_DIR=\"../bitmaps/\"
|
||||||
|
!if "$(FINAL)" == "1"
|
||||||
|
EXTRALIBS = $(WSLIBDIR)\fl.lib
|
||||||
|
!else
|
||||||
|
EXTRALIBS = $(WSLIBDIR)\fld.lib
|
||||||
|
!endif
|
||||||
|
|
||||||
|
OBJECTS = $(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.b32
|
||||||
|
|
18
contrib/samples/fl/fl_sample2/makefile.g95
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile for wxWorkshop for mingw & cygwin.
|
||||||
|
|
||||||
|
WXDIR = ../../../..
|
||||||
|
TARGET = fl_sample2
|
||||||
|
|
||||||
|
EXTRACPPFLAGS = -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
EXTRALIBS = $(WXDIR)/lib/libfl.a
|
||||||
|
|
||||||
|
OBJECTS = $(TARGET).o
|
||||||
|
|
||||||
|
include $(WXDIR)/src/makeprog.g95
|
24
contrib/samples/fl/fl_sample2/makefile.vc
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile : Builds fl sample (VC++, WIN32)
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debug info.
|
||||||
|
|
||||||
|
WXDIR = ..\..\..\..
|
||||||
|
TARGET = fl_sample2
|
||||||
|
|
||||||
|
EXTRAINC = -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
!if "$(FINAL)" == "1"
|
||||||
|
EXTRALIBS = $(WXDIR)\lib\fl.lib
|
||||||
|
!else
|
||||||
|
EXTRALIBS = $(WXDIR)\lib\fld.lib
|
||||||
|
!endif
|
||||||
|
|
||||||
|
PROGRAM = $(TARGET)
|
||||||
|
OBJECTS = $(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.vc
|
25
contrib/samples/fl/fl_sample3/Makefile.in
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample on UNIX/Linux.
|
||||||
|
|
||||||
|
top_srcdir = @top_srcdir@/..
|
||||||
|
top_builddir = ../../../..
|
||||||
|
|
||||||
|
TARGET = fl_sample3
|
||||||
|
|
||||||
|
program_dir = contrib/samples/fl/$(TARGET)
|
||||||
|
|
||||||
|
APPEXTRADEFS = -I$(top_srcdir)/contrib/include -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
APPEXTRALIBS = $(top_builddir)/lib/libfl.@WX_TARGET_LIBRARY_TYPE@
|
||||||
|
|
||||||
|
PROGRAM = $(TARGET)
|
||||||
|
OBJECTS = $(TARGET).o
|
||||||
|
|
||||||
|
include $(top_builddir)/src/makeprog.env
|
108
contrib/samples/fl/fl_sample3/fl_demo.dsp
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="fl_sample3" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||||
|
|
||||||
|
CFG=fl_sample3 - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "fl_demo.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "fl_demo.mak" CFG="fl_sample3 - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "fl_sample3 - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE "fl_sample3 - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "fl_sample3 - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../../include" /I "../../../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /D BMP_DIR=\"../bitmaps/\" /c
|
||||||
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib png.lib zlib.lib jpeg.lib tiff.lib fl.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "fl_sample3 - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../../include" /I "../../../../contrib/include" /D "_DEBUG" /D DEBUG=1 /D "__WXDEBUG__" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /D BMP_DIR=\"../bitmaps/\" /c
|
||||||
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||||
|
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib fld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "fl_sample3 - Win32 Release"
|
||||||
|
# Name "fl_sample3 - Win32 Debug"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\fl_sample3.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "fl_sample3 - Win32 Release"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "fl_sample3 - Win32 Debug"
|
||||||
|
|
||||||
|
# ADD CPP /Yc"wx/wxprec.h"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\fl_sample3.rc
|
||||||
|
# End Source File
|
||||||
|
# End Target
|
||||||
|
# End Project
|
29
contrib/samples/fl/fl_sample3/fl_demo.dsw
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "fl_sample3"=.\fl_demo.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
337
contrib/samples/fl/fl_sample3/fl_sample3.cpp
Normal file
@@ -0,0 +1,337 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fl_sample3.cpp
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by: Sebastian Haase (June 21, 2001)
|
||||||
|
// Created: 24/11/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/textctrl.h"
|
||||||
|
|
||||||
|
// fl headers
|
||||||
|
#include "wx/fl/controlbar.h"
|
||||||
|
|
||||||
|
// plugins used
|
||||||
|
#include "wx/fl/barhintspl.h"
|
||||||
|
#include "wx/fl/hintanimpl.h"
|
||||||
|
|
||||||
|
#define ID_LOAD 102
|
||||||
|
#define ID_STORE 103
|
||||||
|
#define ID_QUIT 104
|
||||||
|
|
||||||
|
#define ID_BUTT 145
|
||||||
|
#define ID_BUTT2 146
|
||||||
|
|
||||||
|
class MyApp: public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool OnInit(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
class MyFrame: public wxFrame
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
wxFrameLayout* mpLayout;
|
||||||
|
wxWindow* mpClientWnd;
|
||||||
|
|
||||||
|
wxButton * my_butt;
|
||||||
|
|
||||||
|
wxTextCtrl* CreateTextCtrl( const wxString& value );
|
||||||
|
public:
|
||||||
|
MyFrame( wxWindow* parent, char *title );
|
||||||
|
~MyFrame();
|
||||||
|
|
||||||
|
void OnLoad( wxCommandEvent& event );
|
||||||
|
void OnStore( wxCommandEvent& event );
|
||||||
|
void OnQuit( wxCommandEvent& event );
|
||||||
|
|
||||||
|
void OnButt( wxCommandEvent& event );
|
||||||
|
void OnButt2( wxCommandEvent& event );
|
||||||
|
bool OnClose(void) { return TRUE; }
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
/***** Implementation for class MyApp *****/
|
||||||
|
|
||||||
|
IMPLEMENT_APP (MyApp)
|
||||||
|
|
||||||
|
bool MyApp::OnInit(void)
|
||||||
|
{
|
||||||
|
// wxWindows boiler-plate:
|
||||||
|
|
||||||
|
MyFrame *frame = new MyFrame(NULL, "wxFrameLayout sample");
|
||||||
|
|
||||||
|
wxMenu *file_menu = new wxMenu;
|
||||||
|
|
||||||
|
file_menu->Append( ID_LOAD, "&Load layout" );
|
||||||
|
file_menu->Append( ID_STORE, "&Store layout" );
|
||||||
|
file_menu->AppendSeparator();
|
||||||
|
|
||||||
|
file_menu->Append( ID_QUIT, "E&xit" );
|
||||||
|
|
||||||
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
|
|
||||||
|
menu_bar->Append(file_menu, "&File");
|
||||||
|
|
||||||
|
frame->CreateStatusBar(3);
|
||||||
|
frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
|
frame->Show(TRUE);
|
||||||
|
SetTopWindow(frame);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Immlementation for class MyFrame *****/
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
|
EVT_MENU( ID_LOAD, MyFrame::OnLoad )
|
||||||
|
EVT_MENU( ID_STORE, MyFrame::OnStore )
|
||||||
|
EVT_MENU( ID_QUIT, MyFrame::OnQuit )
|
||||||
|
EVT_BUTTON( ID_BUTT, MyFrame::OnButt )
|
||||||
|
EVT_BUTTON( ID_BUTT2, MyFrame::OnButt2 )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
MyFrame::MyFrame( wxWindow* parent, char *title )
|
||||||
|
: wxFrame( parent, -1, "NewTest-II", wxDefaultPosition,
|
||||||
|
wxSize( 700, 500 ),
|
||||||
|
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
|
||||||
|
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
|
||||||
|
"freimas" )
|
||||||
|
{
|
||||||
|
|
||||||
|
mpClientWnd = new wxWindow(this, -1);
|
||||||
|
mpLayout = new wxFrameLayout( this, mpClientWnd );
|
||||||
|
|
||||||
|
/// mpLayout->PushDefaultPlugins();
|
||||||
|
/// mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for barso
|
||||||
|
/// //mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
|
||||||
|
|
||||||
|
cbDimInfo sizes( 80,65, // when docked horizontally
|
||||||
|
80,165, // when docked vertically
|
||||||
|
180,30, // when floated
|
||||||
|
TRUE, // the bar is fixed-size
|
||||||
|
5, // vertical gap (bar border)
|
||||||
|
5 // horizontal gap (bar border)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// drop-in some bars
|
||||||
|
|
||||||
|
for( int i = 1; i <= 11; ++i )
|
||||||
|
{
|
||||||
|
char buf[4];
|
||||||
|
sprintf( buf, "%d", i );
|
||||||
|
wxString name = wxString("Bar-");
|
||||||
|
name += buf;
|
||||||
|
|
||||||
|
sizes.mIsFixed = (i !=3); // every fifth bar is not fixed-size
|
||||||
|
|
||||||
|
if ( !sizes.mIsFixed ) name += " (flexible)";
|
||||||
|
// mpLayout->AddBar( CreateTextCtrl(name),// bar window
|
||||||
|
if(i != 4 && i!= 5 && i!=11) {
|
||||||
|
mpLayout->AddBar( new wxTextCtrl(this, -1, 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)
|
||||||
|
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),
|
||||||
|
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)
|
||||||
|
name // name to refere in customization pop-ups
|
||||||
|
);
|
||||||
|
} 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),
|
||||||
|
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)
|
||||||
|
name // name to refere in customization pop-ups
|
||||||
|
);
|
||||||
|
} else if(i==11) {
|
||||||
|
mpLayout->AddBar( new wxButton(this, ID_BUTT2, name+"_2"),
|
||||||
|
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)
|
||||||
|
name // name to refere in customization pop-ups
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// mpLayout->RecalcLayout(true);
|
||||||
|
// Layout();
|
||||||
|
// Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MyFrame::~MyFrame()
|
||||||
|
{
|
||||||
|
// layout is not a window, should be released manually
|
||||||
|
if ( mpLayout )
|
||||||
|
delete mpLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
|
||||||
|
{
|
||||||
|
wxTextCtrl* pCtrl = new wxTextCtrl( this, -1, value,
|
||||||
|
wxPoint(0,0), wxSize(1,1), wxTE_MULTILINE );
|
||||||
|
|
||||||
|
pCtrl->SetBackgroundColour( wxColour( 255,255,255 ) );
|
||||||
|
|
||||||
|
return pCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnLoad( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("Hey - you found a BIG question-mark !!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnStore( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxMessageBox("Hey - you found another BIG question-mark !!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnQuit( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
Show( FALSE ); // TRICK:: hide it, to avoid flickered destruction
|
||||||
|
|
||||||
|
Close(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnButt( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
static int i =0;
|
||||||
|
|
||||||
|
// cbBarInfo* FindBarByName( const wxString& name );
|
||||||
|
|
||||||
|
switch(i % 2) {
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
cbBarInfo* x = mpLayout->FindBarByName(wxString("Bar-1"));
|
||||||
|
if(x)
|
||||||
|
mpLayout->InverseVisibility(x);
|
||||||
|
else
|
||||||
|
wxBell();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
cbBarInfo* x = mpLayout->FindBarByName(wxString("Bar-6"));
|
||||||
|
if(x)
|
||||||
|
{
|
||||||
|
if(i % 4 == 1)
|
||||||
|
{
|
||||||
|
mpLayout->SetBarState(x, wxCBAR_FLOATING, TRUE);
|
||||||
|
//mpLayout->RecalcLayout(true);
|
||||||
|
mpLayout->RepositionFloatedBar(x);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mpLayout->SetBarState(x, 0, TRUE);
|
||||||
|
//mpLayout->RecalcLayout(true);
|
||||||
|
//mpLayout->RepositionFloatedBar(x);
|
||||||
|
}
|
||||||
|
// // // x->mState = wxCBAR_FLOATING;
|
||||||
|
// // // mpLayout->ApplyBarProperties(x);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxBell();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnButt2( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
static int i =0;
|
||||||
|
|
||||||
|
// cbBarInfo* FindBarByName( const wxString& name );
|
||||||
|
|
||||||
|
switch(i % 2) {
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
cbBarInfo* x = mpLayout->FindBarByName(wxString("Bar-1"));
|
||||||
|
if(x)
|
||||||
|
{
|
||||||
|
for(int a=0;a<MAX_BAR_STATES;a++)
|
||||||
|
{
|
||||||
|
x->mDimInfo.mSizes[a].x = 200;
|
||||||
|
x->mDimInfo.mSizes[a].y = 200;
|
||||||
|
}
|
||||||
|
x->mpBarWnd->SetSize(200,200);
|
||||||
|
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
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxBell();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
cbBarInfo* x = mpLayout->FindBarByName(wxString("Bar-1"));
|
||||||
|
if(x)
|
||||||
|
{
|
||||||
|
//mpLayout->InverseVisibility(x);
|
||||||
|
for(int a=0;a<MAX_BAR_STATES;a++)
|
||||||
|
{
|
||||||
|
// see cbPaneDrawPlugin::OnSizeBarWindow( cbSizeBarWndEvent& event )
|
||||||
|
x->mDimInfo.mSizes[a].x = 10 + 2 + 2*x->mDimInfo.mHorizGap;
|
||||||
|
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 !!!
|
||||||
|
wxYield(); // HACK !!! needed to resize BEFORE 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);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxBell();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
3
contrib/samples/fl/fl_sample3/fl_sample3.rc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/* mondrian ICON "mondrian.ico" */
|
||||||
|
#include "wx/msw/wx.rc"
|
||||||
|
|
23
contrib/samples/fl/fl_sample3/makefile.b32
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample for 32-bit BC++
|
||||||
|
|
||||||
|
WXDIR = ..\..\..\..
|
||||||
|
TARGET = fl_sample3
|
||||||
|
|
||||||
|
EXTRACPPFLAGS =-DBMP_DIR=\"../bitmaps/\"
|
||||||
|
!if "$(FINAL)" == "1"
|
||||||
|
EXTRALIBS = $(WSLIBDIR)\fl.lib
|
||||||
|
!else
|
||||||
|
EXTRALIBS = $(WSLIBDIR)\fld.lib
|
||||||
|
!endif
|
||||||
|
|
||||||
|
OBJECTS = $(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.b32
|
||||||
|
|
18
contrib/samples/fl/fl_sample3/makefile.g95
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile for wxWorkshop for mingw & cygwin.
|
||||||
|
|
||||||
|
WXDIR = ../../../..
|
||||||
|
TARGET = fl_sample3
|
||||||
|
|
||||||
|
EXTRACPPFLAGS = -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
EXTRALIBS = $(WXDIR)/lib/libfl.a
|
||||||
|
|
||||||
|
OBJECTS = $(TARGET).o
|
||||||
|
|
||||||
|
include $(WXDIR)/src/makeprog.g95
|
24
contrib/samples/fl/fl_sample3/makefile.vc
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile : Builds fl sample (VC++, WIN32)
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debug info.
|
||||||
|
|
||||||
|
WXDIR = ..\..\..\..
|
||||||
|
TARGET = fl_sample3
|
||||||
|
|
||||||
|
EXTRAINC = -DBMP_DIR=\"../bitmaps/\"
|
||||||
|
!if "$(FINAL)" == "1"
|
||||||
|
EXTRALIBS = $(WXDIR)\lib\fl.lib
|
||||||
|
!else
|
||||||
|
EXTRALIBS = $(WXDIR)\lib\fld.lib
|
||||||
|
!endif
|
||||||
|
|
||||||
|
PROGRAM = $(TARGET)
|
||||||
|
OBJECTS = $(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.vc
|
@@ -1,6 +1,6 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
CONTRIB_SUBDIRS=ogl mmedia stc xrc applet plot canvas animate
|
CONTRIB_SUBDIRS=ogl mmedia stc xrc applet plot canvas animate fl
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@for d in $(CONTRIB_SUBDIRS); do (cd $$d && $(MAKE)); done
|
@for d in $(CONTRIB_SUBDIRS); do (cd $$d && $(MAKE)); done
|
||||||
|
29
contrib/src/fl/Makefile.in
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Hans Van Leemputten
|
||||||
|
# Created: 2001
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) wxWorkshop team, 2001
|
||||||
|
#
|
||||||
|
# Makefile for wxWindows FrameLayout library (Linux/wxGTK).
|
||||||
|
|
||||||
|
top_srcdir = @top_srcdir@/..
|
||||||
|
top_builddir = ../../..
|
||||||
|
libsrc_dir = contrib/src/fl
|
||||||
|
|
||||||
|
TARGET_LIBNAME = libfl
|
||||||
|
OBJ_EXT = o
|
||||||
|
|
||||||
|
# Version Info.
|
||||||
|
LIBVERSION_CURRENT=1
|
||||||
|
LIBVERSION_REVISION=0
|
||||||
|
LIBVERSION_AGE=0
|
||||||
|
|
||||||
|
include ./files.lst
|
||||||
|
|
||||||
|
OBJECTS = $(FL_OBJECTS)
|
||||||
|
|
||||||
|
APPEXTRADEFS = -I$(top_srcdir)/contrib/include
|
||||||
|
|
||||||
|
include $(top_builddir)/src/makelib.env
|
||||||
|
|
236
contrib/src/fl/antiflickpl.cpp
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas (@Lithuania)
|
||||||
|
// Modified by:
|
||||||
|
// Created: 23/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "antiflickpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/antiflickpl.h"
|
||||||
|
|
||||||
|
/***** Implementation for class cbAntiflickerPlugin *****/
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS( cbAntiflickerPlugin, cbPluginBase )
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( cbAntiflickerPlugin, cbPluginBase )
|
||||||
|
|
||||||
|
EVT_PL_START_DRAW_IN_AREA ( cbAntiflickerPlugin::OnStartDrawInArea )
|
||||||
|
EVT_PL_FINISH_DRAW_IN_AREA ( cbAntiflickerPlugin::OnFinishDrawInArea )
|
||||||
|
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
// initialization of static members
|
||||||
|
|
||||||
|
int cbAntiflickerPlugin::mRefCount = 0;
|
||||||
|
|
||||||
|
wxBitmap* cbAntiflickerPlugin::mpVertBuf = 0;
|
||||||
|
wxBitmap* cbAntiflickerPlugin::mpHorizBuf = 0;
|
||||||
|
wxMemoryDC* cbAntiflickerPlugin::mpVertBufDc = 0;
|
||||||
|
wxMemoryDC* cbAntiflickerPlugin::mpHorizBufDc = 0;
|
||||||
|
|
||||||
|
// constructors
|
||||||
|
|
||||||
|
cbAntiflickerPlugin::cbAntiflickerPlugin(void)
|
||||||
|
: mpLRUBufDc ( NULL ),
|
||||||
|
mLRUArea ( -1,-1, -1,-1 )
|
||||||
|
{
|
||||||
|
++mRefCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbAntiflickerPlugin::cbAntiflickerPlugin( wxFrameLayout* pPanel, int paneMask )
|
||||||
|
|
||||||
|
: cbPluginBase( pPanel, paneMask ),
|
||||||
|
mpLRUBufDc ( NULL ),
|
||||||
|
mLRUArea ( -1,-1, -1,-1 )
|
||||||
|
{
|
||||||
|
++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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 verticallya and choose correspoinding 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
|
||||||
|
|
||||||
|
// short-cut
|
||||||
|
wxRect& area = event.mArea;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
wxDC* pBufDc = FindSuitableBuffer( area );
|
||||||
|
|
||||||
|
if ( !pBufDc )
|
||||||
|
|
||||||
|
pBufDc = AllocNewBuffer( area );
|
||||||
|
|
||||||
|
pBufDc->SetDeviceOrigin( -area.x, -area.y );
|
||||||
|
|
||||||
|
pBufDc->SetClippingRegion( area.x, area.y,
|
||||||
|
area.width, area.height );
|
||||||
|
|
||||||
|
wxClientDC clntDc( &mpLayout->GetParentFrame() );
|
||||||
|
|
||||||
|
(*event.mppDc) = pBufDc;
|
||||||
|
|
||||||
|
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 );
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbAntiflickerPlugin::OnFinishDrawInArea( cbFinishDrawInAreaEvent& event )
|
||||||
|
{
|
||||||
|
wxRect& area = event.mArea;
|
||||||
|
|
||||||
|
if ( event.mArea.width < 0 ||
|
||||||
|
event.mArea.height < 0 ) return;
|
||||||
|
|
||||||
|
wxASSERT( mpLRUBufDc ); // DBG:: OnStartDrawInArea should be called first
|
||||||
|
|
||||||
|
// 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 );
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
mpLRUBufDc->DestroyClippingRegion();
|
||||||
|
mpLRUBufDc = 0;
|
||||||
|
}
|
||||||
|
|
934
contrib/src/fl/bardragpl.cpp
Normal file
@@ -0,0 +1,934 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 23/09/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "bardragpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/bardragpl.h"
|
||||||
|
|
||||||
|
#define POS_UNDEFINED -32768
|
||||||
|
|
||||||
|
// helpers, FOR NOW:: static
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Implementation for class cbBarDragPlugin *****/
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS( cbBarDragPlugin, cbPluginBase )
|
||||||
|
|
||||||
|
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 )
|
||||||
|
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
cbBarDragPlugin::cbBarDragPlugin(void)
|
||||||
|
|
||||||
|
: 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 )
|
||||||
|
{}
|
||||||
|
|
||||||
|
cbBarDragPlugin::~cbBarDragPlugin()
|
||||||
|
{
|
||||||
|
// nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
// helper methods (protected)
|
||||||
|
|
||||||
|
// clips (top/bottom) or (right/left) edges against the frame's bounding rect.
|
||||||
|
|
||||||
|
void do_clip_edges( int len, int& rectPos, int& rectLen )
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::ClipRectInFrame( wxRect& rect )
|
||||||
|
{
|
||||||
|
int w, h;
|
||||||
|
mpLayout->GetParentFrame().GetClientSize( &w, &h );
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
if ( pos.x < 0 )
|
||||||
|
pos.x = 0;
|
||||||
|
if ( pos.y < 0 )
|
||||||
|
pos.y = 0;
|
||||||
|
if ( pos.x > w )
|
||||||
|
pos.x = w-1;
|
||||||
|
if ( pos.y > h )
|
||||||
|
pos.y = h-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::AdjustHintRect( wxPoint& mousePos )
|
||||||
|
{
|
||||||
|
mHintRect.x = mousePos.x - mMouseInRectX;
|
||||||
|
mHintRect.y = mousePos.y - mMouseInRectY;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbDockPane* cbBarDragPlugin::HitTestPanes( wxRect& rect )
|
||||||
|
{
|
||||||
|
//wxRect clipped = rect;
|
||||||
|
|
||||||
|
//ClipRectInFrame( clipped );
|
||||||
|
|
||||||
|
cbDockPane** pPanes = mpLayout->GetPanesArray();
|
||||||
|
|
||||||
|
for( int i = 0; i != MAX_PANES; ++i )
|
||||||
|
|
||||||
|
if ( rect_hits_rect( pPanes[i]->mBoundsInParent, rect ) )
|
||||||
|
|
||||||
|
return pPanes[i];
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbDockPane* cbBarDragPlugin::HitTestPanes( wxPoint& pos )
|
||||||
|
{
|
||||||
|
wxPoint clipped = pos;
|
||||||
|
|
||||||
|
//ClipPosInFrame( pos );
|
||||||
|
|
||||||
|
cbDockPane** pPanes = mpLayout->GetPanesArray();
|
||||||
|
|
||||||
|
for( int i = 0; i != MAX_PANES; ++i )
|
||||||
|
|
||||||
|
if ( rect_contains_point( pPanes[i]->mBoundsInParent, clipped.x, clipped.y ) )
|
||||||
|
|
||||||
|
return pPanes[i];
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cbBarDragPlugin::HitsPane( cbDockPane* pPane, wxRect& 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 );
|
||||||
|
|
||||||
|
case FL_ALIGN_RIGHT : return bounds.x - mousePos.x;
|
||||||
|
|
||||||
|
default : return 0; // never reached
|
||||||
|
}
|
||||||
|
|
||||||
|
// return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cbBarDragPlugin::IsInOtherPane( wxPoint& mousePos )
|
||||||
|
{
|
||||||
|
cbDockPane* pPane = HitTestPanes( mousePos );
|
||||||
|
|
||||||
|
if ( pPane && pPane != mpCurPane ) return TRUE;
|
||||||
|
else return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cbBarDragPlugin::IsInClientArea( wxPoint& mousePos )
|
||||||
|
{
|
||||||
|
return ( HitTestPanes( mousePos ) == NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cbBarDragPlugin::IsInClientArea( wxRect& rect )
|
||||||
|
{
|
||||||
|
return ( HitTestPanes( rect ) == NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::CalcOnScreenDims( wxRect& rect )
|
||||||
|
{
|
||||||
|
if ( !mpCurPane || mpDraggedBar->IsFixed() ) return;
|
||||||
|
|
||||||
|
wxRect inPane = rect;
|
||||||
|
|
||||||
|
mpCurPane->FrameToPane( &inPane );
|
||||||
|
|
||||||
|
int rowNo = mpCurPane->GetRowAt( inPane.y, inPane.y + inPane.height );
|
||||||
|
|
||||||
|
bool isMaximized = ( rowNo >= (int)mpCurPane->GetRowList().Count() || rowNo < 0 );
|
||||||
|
|
||||||
|
if ( isMaximized )
|
||||||
|
{
|
||||||
|
inPane.x = 0;
|
||||||
|
inPane.width = mpCurPane->mPaneWidth;
|
||||||
|
|
||||||
|
mpCurPane->PaneToFrame( &inPane );
|
||||||
|
|
||||||
|
rect = inPane;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// helpers
|
||||||
|
|
||||||
|
static inline void check_upper_overrun( int& pos, int width, int mousePos )
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::StickToPane( cbDockPane* pPane, wxPoint& mousePos )
|
||||||
|
{
|
||||||
|
int wInPane = GetBarWidthInPane ( pPane );
|
||||||
|
int hInPane = GetBarHeightInPane( pPane );
|
||||||
|
|
||||||
|
// adjsut hint-rect horizontally (in pane's orientation)
|
||||||
|
|
||||||
|
if ( pPane->IsHorizontal() )
|
||||||
|
{
|
||||||
|
mHintRect.width = wInPane;
|
||||||
|
mHintRect.height = hInPane;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mHintRect.height = wInPane;
|
||||||
|
mHintRect.width = hInPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
// adjsut hint-rect vertically (in pane's orientation)
|
||||||
|
|
||||||
|
wxRect& bounds = pPane->mBoundsInParent;
|
||||||
|
|
||||||
|
// TRUE, if hint enters the pane through it's lower edge
|
||||||
|
|
||||||
|
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 mouse pointer doesn't overrun (leave) the hint-rectangle
|
||||||
|
// when dimensions it's are recalculated upon sticking it to the pane
|
||||||
|
|
||||||
|
if ( pPane->IsHorizontal() && fromLowerEdge )
|
||||||
|
{
|
||||||
|
int paneBottomEdgeY = bounds.y + bounds.height;
|
||||||
|
|
||||||
|
mHintRect.y = wxMin( paneBottomEdgeY, mousePos.y );
|
||||||
|
|
||||||
|
check_lower_overrun( mHintRect.y, hInPane, mousePos.y );
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ( pPane->IsHorizontal() && !fromLowerEdge )
|
||||||
|
{
|
||||||
|
int paneTopEdgeY = bounds.y;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
mHintRect.x = wxMin( paneRightEdgeX, mousePos.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 );
|
||||||
|
|
||||||
|
check_upper_overrun( mHintRect.x, hInPane, mousePos.x );
|
||||||
|
}
|
||||||
|
|
||||||
|
mMouseInRectX = mousePos.x - mHintRect.x;
|
||||||
|
mMouseInRectY = mousePos.y - mHintRect.y;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
int newWidth = mpDraggedBar->mDimInfo.mSizes[wxCBAR_FLOATING].x;
|
||||||
|
int newHeight = mpDraggedBar->mDimInfo.mSizes[wxCBAR_FLOATING].y;
|
||||||
|
|
||||||
|
wxRect& flBounds = mpDraggedBar->mDimInfo.mBounds[wxCBAR_FLOATING];
|
||||||
|
|
||||||
|
if ( flBounds.width != -1 )
|
||||||
|
{
|
||||||
|
newWidth = flBounds.width;
|
||||||
|
newHeight = flBounds.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
mHintRect.width = newWidth;
|
||||||
|
mHintRect.height = newHeight;
|
||||||
|
|
||||||
|
wxRect& bounds = pPane->mBoundsInParent;
|
||||||
|
|
||||||
|
// TRUE, if hint leaves the pane through it's lower edge
|
||||||
|
|
||||||
|
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(..)
|
||||||
|
|
||||||
|
if ( pPane->IsHorizontal() && fromLowerEdge )
|
||||||
|
{
|
||||||
|
bool fromLowerEdge = mousePos.y > bounds.y;
|
||||||
|
|
||||||
|
mHintRect.y = wxMax( bounds.y + bounds.height + 1, mousePos.y - newHeight );
|
||||||
|
|
||||||
|
check_upper_overrun( mHintRect.y, newHeight, mousePos.y );
|
||||||
|
|
||||||
|
// 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 );
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
check_lower_overrun( mHintRect.x, newWidth, mousePos.x );
|
||||||
|
}
|
||||||
|
|
||||||
|
mMouseInRectX = mousePos.x - mHintRect.x;
|
||||||
|
mMouseInRectY = mousePos.y - mHintRect.y;
|
||||||
|
|
||||||
|
mpCurPane = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cbBarDragPlugin::GetBarWidthInPane( cbDockPane* pPane )
|
||||||
|
{
|
||||||
|
if ( pPane == mpSrcPane )
|
||||||
|
|
||||||
|
return mBarWidthInSrcPane;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::ShowHint( bool prevWasInClient )
|
||||||
|
{
|
||||||
|
bool wasDocked = 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mpSrcPane->mProps.mRealTimeUpdatesOn == FALSE )
|
||||||
|
{
|
||||||
|
// do hevy calculations first
|
||||||
|
|
||||||
|
wxRect actualRect = mHintRect; // will be adjusted depending on drag-settings
|
||||||
|
|
||||||
|
if ( mpSrcPane->mProps.mExactDockPredictionOn && mpCurPane )
|
||||||
|
{
|
||||||
|
bool success = mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, FALSE );
|
||||||
|
|
||||||
|
wxASSERT( success ); // DBG::
|
||||||
|
|
||||||
|
actualRect = mpDraggedBar->mBounds;
|
||||||
|
|
||||||
|
mpCurPane->PaneToFrame( &actualRect );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
CalcOnScreenDims( actualRect );
|
||||||
|
|
||||||
|
// release previous hint
|
||||||
|
|
||||||
|
if ( mPrevHintRect.x != POS_UNDEFINED )
|
||||||
|
{
|
||||||
|
// erase previous rectangle
|
||||||
|
|
||||||
|
cbDrawHintRectEvent evt( mPrevHintRect, prevWasInClient, TRUE, FALSE );
|
||||||
|
|
||||||
|
mpLayout->FirePluginEvent( evt );
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw new hint
|
||||||
|
|
||||||
|
cbDrawHintRectEvent evt( actualRect, mpCurPane == NULL, FALSE, FALSE );
|
||||||
|
|
||||||
|
mpLayout->FirePluginEvent( evt );
|
||||||
|
|
||||||
|
mPrevHintRect = actualRect;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// otherwise, if real-time updates option is ON
|
||||||
|
|
||||||
|
if ( mpCurPane )
|
||||||
|
{
|
||||||
|
mpLayout->GetUpdatesManager().OnStartChanges();
|
||||||
|
|
||||||
|
if ( wasDocked )
|
||||||
|
|
||||||
|
mpDraggedBar->mUMgrData.SetDirty( TRUE );
|
||||||
|
|
||||||
|
bool success = mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, FALSE );
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mHintRect;
|
||||||
|
|
||||||
|
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 )
|
||||||
|
|
||||||
|
mpCurCursor = mpLayout->mpDragCursor;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( mpLayout->mFloatingOn && mpSrcPane->mProps.mRealTimeUpdatesOn )
|
||||||
|
|
||||||
|
mpCurCursor = mpLayout->mpDragCursor;
|
||||||
|
else
|
||||||
|
mpCurCursor = mpLayout->mpNECursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pPrevCurs != mpCurCursor )
|
||||||
|
|
||||||
|
mpLayout->GetParentFrame().SetCursor( *mpCurCursor );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::OnLButtonDown( cbLeftDownEvent& event )
|
||||||
|
{
|
||||||
|
if ( mBarDragStarted )
|
||||||
|
{
|
||||||
|
wxMessageBox("DblClick!");
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::OnLButtonUp( cbLeftUpEvent& event )
|
||||||
|
{
|
||||||
|
if ( mBarDragStarted )
|
||||||
|
{
|
||||||
|
if ( mpSrcPane->mProps.mRealTimeUpdatesOn == FALSE )
|
||||||
|
{
|
||||||
|
// erase current rectangle, and finsih on-screen drawing session
|
||||||
|
|
||||||
|
cbDrawHintRectEvent evt( mPrevHintRect, mpCurPane == NULL, TRUE, TRUE );
|
||||||
|
|
||||||
|
mpLayout->FirePluginEvent( evt );
|
||||||
|
|
||||||
|
if ( mpCurPane != NULL )
|
||||||
|
{
|
||||||
|
if ( mpSrcPane->mProps.mExactDockPredictionOn )
|
||||||
|
{
|
||||||
|
mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, FALSE );
|
||||||
|
|
||||||
|
mpLayout->GetUpdatesManager().OnFinishChanges();
|
||||||
|
mpLayout->GetUpdatesManager().UpdateNow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mHintRect.width = -1;
|
||||||
|
|
||||||
|
mpLayout->GetParentFrame().SetCursor( *mpLayout->mpNormalCursor );
|
||||||
|
|
||||||
|
mpLayout->ReleaseEventsFromPane( event.mpPane );
|
||||||
|
mpLayout->ReleaseEventsFromPlugin( this );
|
||||||
|
|
||||||
|
mBarDragStarted = FALSE;
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::OnLDblClick( cbLeftDClickEvent& event )
|
||||||
|
{
|
||||||
|
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 );
|
||||||
|
|
||||||
|
mpLayout->RepositionFloatedBar( pHittedBar );
|
||||||
|
|
||||||
|
return; // event is "eaten" by this plugin
|
||||||
|
}
|
||||||
|
|
||||||
|
mBarDragStarted = FALSE;
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
//wxMessageBox("Hi, dblclick arrived!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::OnStartBarDragging( cbStartBarDraggingEvent& event )
|
||||||
|
{
|
||||||
|
mpDraggedBar = event.mpBar;
|
||||||
|
mpSrcPane = event.mpPane;
|
||||||
|
|
||||||
|
mpLayout->CaptureEventsForPane( event.mpPane );
|
||||||
|
mpLayout->CaptureEventsForPlugin( this );
|
||||||
|
|
||||||
|
mpLayout->GetParentFrame().SetCursor( *mpLayout->mpDragCursor );
|
||||||
|
|
||||||
|
mBarDragStarted = TRUE;
|
||||||
|
|
||||||
|
wxRect inParent = mpDraggedBar->mBounds;
|
||||||
|
|
||||||
|
mBarWasFloating = mpDraggedBar->mState == wxCBAR_FLOATING;
|
||||||
|
|
||||||
|
if ( mBarWasFloating )
|
||||||
|
{
|
||||||
|
inParent = mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ];
|
||||||
|
mFloatedBarBounds = inParent;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
event.mpPane->PaneToFrame( &inParent );
|
||||||
|
|
||||||
|
mHintRect.x = POS_UNDEFINED;
|
||||||
|
|
||||||
|
mHintRect.width = inParent.width;
|
||||||
|
mHintRect.height = inParent.height;
|
||||||
|
|
||||||
|
mMouseInRectX = event.mPos.x - inParent.x;
|
||||||
|
mMouseInRectY = event.mPos.y - inParent.y;
|
||||||
|
|
||||||
|
mpSrcPane = event.mpPane;
|
||||||
|
|
||||||
|
if ( mpDraggedBar->mState == wxCBAR_FLOATING )
|
||||||
|
|
||||||
|
mpCurPane = NULL;
|
||||||
|
else
|
||||||
|
mpCurPane = event.mpPane;
|
||||||
|
|
||||||
|
mPrevHintRect.x = POS_UNDEFINED;
|
||||||
|
|
||||||
|
mCanStick = FALSE; // we're not stuck into any pane now -
|
||||||
|
// there's nowhere to "stick-twice"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
int x = event.mPos.x, y = event.mPos.y;
|
||||||
|
|
||||||
|
mpSrcPane->FrameToPane( &x, &y );
|
||||||
|
|
||||||
|
cbMotionEvent motionEvt( wxPoint(x,y), event.mpPane );
|
||||||
|
|
||||||
|
|
||||||
|
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 ( event.mLastTime )
|
||||||
|
|
||||||
|
FinishTracking();
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _IMG_A 0xAA // Note: modified from _A to _IMG_A, _A was already defined (cygwin)
|
||||||
|
#define _IMG_B 0x00 // Note: modified from _B to _IMG_A, _B was already defined (cygwin)
|
||||||
|
#define _IMG_C 0x55 // Note: modified from _C to _IMG_C, for consistency reasons.
|
||||||
|
#define _IMG_D 0x00 // Note: modified from _D to _IMG_D, for consistency reasons.
|
||||||
|
|
||||||
|
// 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
|
||||||
|
};
|
||||||
|
|
||||||
|
void cbBarDragPlugin::StartTracking()
|
||||||
|
{
|
||||||
|
mpScrDc = new wxScreenDC;
|
||||||
|
|
||||||
|
wxScreenDC::StartDrawingOnTop(&mpLayout->GetParentFrame());
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::DoDrawHintRect( wxRect& rect, bool isInClientRect)
|
||||||
|
{
|
||||||
|
wxRect scrRect;
|
||||||
|
|
||||||
|
RectToScr( rect, scrRect );
|
||||||
|
|
||||||
|
int prevLF = mpScrDc->GetLogicalFunction();
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
wxBitmap checker( (const char*)_gCheckerImg, 8,8 );
|
||||||
|
|
||||||
|
wxBrush checkerBrush( checker );
|
||||||
|
|
||||||
|
mpScrDc->SetPen( mpLayout->mNullPen );
|
||||||
|
mpScrDc->SetBrush( checkerBrush );
|
||||||
|
|
||||||
|
int half = mInClientHintBorder / 2;
|
||||||
|
|
||||||
|
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 + 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->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+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->SetLogicalFunction( prevLF );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::DrawHintRect ( wxRect& rect, bool isInClientRect)
|
||||||
|
{
|
||||||
|
DoDrawHintRect( rect, isInClientRect );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::EraseHintRect( wxRect& rect, bool isInClientRect)
|
||||||
|
{
|
||||||
|
DoDrawHintRect( rect, isInClientRect );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::FinishTracking()
|
||||||
|
{
|
||||||
|
wxScreenDC::EndDrawingOnTop();
|
||||||
|
|
||||||
|
delete mpScrDc;
|
||||||
|
|
||||||
|
mpScrDc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarDragPlugin::RectToScr( wxRect& frameRect, wxRect& scrRect )
|
||||||
|
{
|
||||||
|
scrRect = frameRect;
|
||||||
|
|
||||||
|
int x = frameRect.x, y = frameRect.y;
|
||||||
|
|
||||||
|
mpLayout->GetParentFrame().ClientToScreen( &x, &y );
|
||||||
|
|
||||||
|
scrRect.x = x;
|
||||||
|
scrRect.y = y;
|
||||||
|
}
|
||||||
|
|
560
contrib/src/fl/barhintspl.cpp
Normal file
@@ -0,0 +1,560 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 30/11/98 (my 22th birthday :-)
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "barhintspl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/utils.h"
|
||||||
|
#include "wx/fl/barhintspl.h"
|
||||||
|
|
||||||
|
// fixed settings
|
||||||
|
|
||||||
|
#define GROOVE_WIDTH 3 // left shade + middle line + right shade
|
||||||
|
#define GROOVE_TO_GROOVE_GAP 1
|
||||||
|
#define BOX_T_BOX_GAP 2
|
||||||
|
#define BOX_TO_GROOVE_GAP 3
|
||||||
|
|
||||||
|
#define BOXES_IN_HINT 2
|
||||||
|
#define CLOSE_BOX_IDX 0
|
||||||
|
#define COLLAPSE_BOX_IDX 1
|
||||||
|
|
||||||
|
// used interally
|
||||||
|
|
||||||
|
#define CLOSE_BOX_HITTED 1
|
||||||
|
#define COLLAPSE_BOX_HITTED 2
|
||||||
|
|
||||||
|
/***** Implementation fro class cbBarHintsPlugin *****/
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS( cbBarHintsPlugin, cbPluginBase )
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( cbBarHintsPlugin, cbPluginBase )
|
||||||
|
|
||||||
|
EVT_PL_SIZE_BAR_WND ( cbBarHintsPlugin::OnSizeBarWindow )
|
||||||
|
EVT_PL_DRAW_BAR_DECOR( cbBarHintsPlugin::OnDrawBarDecorations )
|
||||||
|
|
||||||
|
EVT_PL_LEFT_DOWN( cbBarHintsPlugin::OnLeftDown )
|
||||||
|
EVT_PL_LEFT_UP ( cbBarHintsPlugin::OnLeftUp )
|
||||||
|
EVT_PL_MOTION ( cbBarHintsPlugin::OnMotion )
|
||||||
|
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
cbBarHintsPlugin::cbBarHintsPlugin(void)
|
||||||
|
|
||||||
|
: mpPane( 0 ),
|
||||||
|
mBtnPressed ( FALSE ),
|
||||||
|
mCloseBoxOn ( TRUE ),
|
||||||
|
mCollapseBoxOn( TRUE ),
|
||||||
|
mGrooveCount ( 2 ),
|
||||||
|
mHintGap ( 4 ),
|
||||||
|
mXWeight ( 2 )
|
||||||
|
{
|
||||||
|
mBoxes[CLOSE_BOX_IDX] = NULL;
|
||||||
|
mBoxes[COLLAPSE_BOX_IDX] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbBarHintsPlugin::cbBarHintsPlugin( wxFrameLayout* pLayout, int paneMask )
|
||||||
|
|
||||||
|
: cbPluginBase( pLayout, paneMask ),
|
||||||
|
mpPane( 0 ),
|
||||||
|
mBtnPressed ( FALSE ),
|
||||||
|
mCloseBoxOn ( TRUE ),
|
||||||
|
mCollapseBoxOn( TRUE ),
|
||||||
|
mGrooveCount ( 2 ),
|
||||||
|
mHintGap ( 5 ),
|
||||||
|
mXWeight ( 2 )
|
||||||
|
{
|
||||||
|
mBoxes[CLOSE_BOX_IDX] = NULL;
|
||||||
|
mBoxes[COLLAPSE_BOX_IDX] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cbBarHintsPlugin::~cbBarHintsPlugin()
|
||||||
|
{
|
||||||
|
if (mBoxes[CLOSE_BOX_IDX])
|
||||||
|
delete mBoxes[CLOSE_BOX_IDX];
|
||||||
|
|
||||||
|
if (mBoxes[COLLAPSE_BOX_IDX])
|
||||||
|
delete mBoxes[COLLAPSE_BOX_IDX];
|
||||||
|
} // cbBarHintsPlugin destructor
|
||||||
|
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::SetGrooveCount( int nGrooves )
|
||||||
|
{
|
||||||
|
mGrooveCount = nGrooves;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::CreateBoxes()
|
||||||
|
{
|
||||||
|
cbCloseBox* box1 = new cbCloseBox();
|
||||||
|
cbCollapseBox* box2 = new cbCollapseBox();
|
||||||
|
|
||||||
|
mBoxes[CLOSE_BOX_IDX] = box1;
|
||||||
|
mBoxes[COLLAPSE_BOX_IDX] = box2;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for( i = 0; i != BOXES_IN_HINT; ++i )
|
||||||
|
{
|
||||||
|
mBoxes[i]->mpLayout = mpLayout;
|
||||||
|
mBoxes[i]->mpPlugin = this;
|
||||||
|
mBoxes[i]->mpWnd = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::Draw3DBox( wxDC& dc, const wxPoint& pos, bool pressed )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::DrawCloseBox( wxDC& dc, const wxPoint& pos, bool pressed )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::DrawCollapseBox( wxDC& dc, const wxPoint& pos,
|
||||||
|
bool atLeft, bool disabled, bool pressed )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::DrawGrooves( wxDC& dc, const wxPoint& pos, int length )
|
||||||
|
{
|
||||||
|
int ofs = 0;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for( i = 0; i != mGrooveCount; ++i, ofs += ( GROOVE_WIDTH + GROOVE_TO_GROOVE_GAP ) )
|
||||||
|
|
||||||
|
if ( mpPane->IsHorizontal() )
|
||||||
|
{
|
||||||
|
dc.SetPen( mpLayout->mLightPen );
|
||||||
|
dc.DrawLine( pos.x + ofs, pos.y, pos.x + ofs, pos.y + length - 1 );
|
||||||
|
dc.DrawPoint( pos.x + ofs + 1, pos.y );
|
||||||
|
|
||||||
|
dc.SetPen( mpLayout->mDarkPen );
|
||||||
|
dc.DrawLine( pos.x + ofs + 2, pos.y, pos.x + ofs + 2, pos.y + length );
|
||||||
|
dc.DrawPoint( pos.x + ofs + 1, pos.y + length - 1 );
|
||||||
|
dc.DrawPoint( pos.x + ofs, pos.y + length - 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dc.SetPen( mpLayout->mLightPen );
|
||||||
|
dc.DrawLine( pos.x, pos.y + ofs, pos.x + length - 1, pos.y + ofs );
|
||||||
|
dc.DrawPoint( pos.x, pos.y + ofs + 1 );
|
||||||
|
|
||||||
|
dc.SetPen( mpLayout->mDarkPen );
|
||||||
|
dc.DrawLine( pos.x, pos.y + ofs + 2, pos.x + length, pos.y + ofs + 2 );
|
||||||
|
dc.DrawPoint( pos.x + length - 1, pos.y + ofs + 1 );
|
||||||
|
dc.DrawPoint( pos.x + length - 1, pos.y + ofs );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::ExcludeHints( wxRect& rect, cbBarInfo& info )
|
||||||
|
{
|
||||||
|
int boxHeight = BTN_BOX_HEIGHT;
|
||||||
|
|
||||||
|
// collapse and close box are not placed on fixed bars
|
||||||
|
|
||||||
|
if ( info.IsFixed() || ( !mCloseBoxOn && !mCollapseBoxOn ) )
|
||||||
|
|
||||||
|
boxHeight = 0;
|
||||||
|
|
||||||
|
int height = wxMax( mGrooveCount*(GROOVE_WIDTH + GROOVE_TO_GROOVE_GAP)
|
||||||
|
- GROOVE_TO_GROOVE_GAP,
|
||||||
|
boxHeight
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( mpPane->IsHorizontal() )
|
||||||
|
{
|
||||||
|
rect.x += ( mHintGap*2 + height );
|
||||||
|
rect.width -= (height + 2*mHintGap);
|
||||||
|
|
||||||
|
rect.x -= info.mDimInfo.mHorizGap + 2;
|
||||||
|
rect.width += info.mDimInfo.mHorizGap + 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect.y += (mHintGap*2 + height);
|
||||||
|
rect.height -= (height + 2*mHintGap);
|
||||||
|
|
||||||
|
rect.y -= info.mDimInfo.mVertGap + 2;
|
||||||
|
rect.height += info.mDimInfo.mVertGap + 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::DoDrawHint( wxDC& dc, wxRect& rect,
|
||||||
|
int pos, int boxOfs, int grooveOfs,
|
||||||
|
bool isFixed )
|
||||||
|
{
|
||||||
|
if ( !isFixed )
|
||||||
|
{
|
||||||
|
if ( mpPane->IsHorizontal() )
|
||||||
|
{
|
||||||
|
if ( mCloseBoxOn )
|
||||||
|
|
||||||
|
mBoxes[CLOSE_BOX_IDX]->Draw( dc );
|
||||||
|
|
||||||
|
if ( mCollapseBoxOn )
|
||||||
|
|
||||||
|
mBoxes[COLLAPSE_BOX_IDX]->Draw( dc );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( mCloseBoxOn )
|
||||||
|
|
||||||
|
mBoxes[CLOSE_BOX_IDX]->Draw( dc );
|
||||||
|
|
||||||
|
if ( mCollapseBoxOn )
|
||||||
|
|
||||||
|
mBoxes[COLLAPSE_BOX_IDX]->Draw( dc );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mpPane->IsHorizontal() )
|
||||||
|
|
||||||
|
DrawGrooves( dc, wxPoint( rect.x + mHintGap + grooveOfs, pos ),
|
||||||
|
rect.height - (pos - rect.y) - mHintGap );
|
||||||
|
else
|
||||||
|
DrawGrooves( dc, wxPoint( rect.x + mHintGap, rect.y + mHintGap + grooveOfs ),
|
||||||
|
(pos - rect.x) - mHintGap );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::GetHintsLayout( wxRect& rect, cbBarInfo& info,
|
||||||
|
int& boxOfs, int& grooveOfs, int& pos )
|
||||||
|
{
|
||||||
|
int boxHeight = BTN_BOX_HEIGHT;
|
||||||
|
int boxWidth = BTN_BOX_WIDTH + BOX_TO_GROOVE_GAP + BTN_BOX_WIDTH;
|
||||||
|
|
||||||
|
// collapse and close box are not placed on fixed bars
|
||||||
|
|
||||||
|
if ( info.IsFixed() || ( !mCloseBoxOn && !mCollapseBoxOn ) )
|
||||||
|
{
|
||||||
|
boxHeight = 0;
|
||||||
|
boxWidth = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ( !mCloseBoxOn || !mCollapseBoxOn )
|
||||||
|
|
||||||
|
boxWidth = BTN_BOX_WIDTH;
|
||||||
|
|
||||||
|
int grooveHeight = mGrooveCount*(GROOVE_WIDTH + GROOVE_TO_GROOVE_GAP)
|
||||||
|
- GROOVE_TO_GROOVE_GAP;
|
||||||
|
|
||||||
|
int height = wxMax( grooveHeight, boxHeight );
|
||||||
|
|
||||||
|
// center boxs and groves with respect to each other
|
||||||
|
|
||||||
|
boxOfs = ( height - boxHeight ) / 2;
|
||||||
|
grooveOfs = ( height - grooveHeight ) / 2;
|
||||||
|
|
||||||
|
pos = ( mpPane->IsHorizontal() ) ? rect.y + mHintGap
|
||||||
|
: rect.x + rect.width - mHintGap;
|
||||||
|
|
||||||
|
// setup positions for boxes
|
||||||
|
|
||||||
|
if ( !info.IsFixed() )
|
||||||
|
{
|
||||||
|
// what direction "collapse-triangle" should look at?
|
||||||
|
|
||||||
|
bool& isAtLeft = ((cbCollapseBox*)(mBoxes[COLLAPSE_BOX_IDX]))->mIsAtLeft;
|
||||||
|
|
||||||
|
isAtLeft= info.mBounds.x <= mpPane->mPaneWidth - ( info.mBounds.x + info.mBounds.width );
|
||||||
|
|
||||||
|
if ( info.IsExpanded() )
|
||||||
|
{
|
||||||
|
isAtLeft = FALSE;
|
||||||
|
|
||||||
|
cbBarInfo* pCur = info.mpPrev;
|
||||||
|
|
||||||
|
while( pCur )
|
||||||
|
{
|
||||||
|
if ( !pCur->IsFixed() )
|
||||||
|
{
|
||||||
|
isAtLeft = TRUE; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pCur = pCur->mpPrev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// collapse/expand works only when more not-fixed bars are present in the same row
|
||||||
|
|
||||||
|
mBoxes[COLLAPSE_BOX_IDX]->Enable( info.mpRow->mNotFixedBarsCnt > 1 );
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for( i = 0; i != BOXES_IN_HINT; ++i )
|
||||||
|
|
||||||
|
mBoxes[i]->mpPane = mpPane;
|
||||||
|
|
||||||
|
|
||||||
|
if ( mpPane->IsHorizontal() )
|
||||||
|
{
|
||||||
|
if ( mCloseBoxOn )
|
||||||
|
{
|
||||||
|
mBoxes[CLOSE_BOX_IDX]->mPos = wxPoint( rect.x + mHintGap + boxOfs, pos );
|
||||||
|
|
||||||
|
pos += BTN_BOX_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mCollapseBoxOn )
|
||||||
|
{
|
||||||
|
if ( mCloseBoxOn ) pos += BOX_T_BOX_GAP;
|
||||||
|
|
||||||
|
mBoxes[COLLAPSE_BOX_IDX]->mPos = wxPoint( rect.x + mHintGap + boxOfs, pos );
|
||||||
|
|
||||||
|
pos += BTN_BOX_HEIGHT;
|
||||||
|
|
||||||
|
pos += BOX_TO_GROOVE_GAP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( mCloseBoxOn )
|
||||||
|
{
|
||||||
|
pos -= BTN_BOX_WIDTH;
|
||||||
|
|
||||||
|
mBoxes[CLOSE_BOX_IDX]->mPos = wxPoint( pos , rect.y + mHintGap + boxOfs );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mCollapseBoxOn )
|
||||||
|
{
|
||||||
|
if ( mCloseBoxOn ) pos -= BOX_T_BOX_GAP;
|
||||||
|
|
||||||
|
pos -= BTN_BOX_WIDTH;
|
||||||
|
|
||||||
|
mBoxes[COLLAPSE_BOX_IDX]->mPos = wxPoint( pos, rect.y + mHintGap + boxOfs );
|
||||||
|
|
||||||
|
pos -= BOX_TO_GROOVE_GAP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool is_in_box( const wxPoint& rectPos, const wxPoint& mousePos )
|
||||||
|
{
|
||||||
|
return ( mousePos.x >= rectPos.x &&
|
||||||
|
mousePos.y >= rectPos.y &&
|
||||||
|
mousePos.x < rectPos.x + BTN_BOX_WIDTH &&
|
||||||
|
mousePos.y < rectPos.y + BTN_BOX_HEIGHT );
|
||||||
|
}
|
||||||
|
|
||||||
|
int cbBarHintsPlugin::HitTestHints( cbBarInfo& info, const wxPoint& pos )
|
||||||
|
{
|
||||||
|
wxPoint inPane = pos;
|
||||||
|
mpPane->PaneToFrame( &inPane.x, &inPane.y );
|
||||||
|
|
||||||
|
wxRect& rect = info.mBoundsInParent;
|
||||||
|
|
||||||
|
if ( info.IsFixed() ) return FALSE;
|
||||||
|
|
||||||
|
int boxOfs, grooveOfs, coord;
|
||||||
|
|
||||||
|
GetHintsLayout( rect, info, boxOfs, grooveOfs, coord );
|
||||||
|
|
||||||
|
if ( mpPane->IsHorizontal() )
|
||||||
|
{
|
||||||
|
if ( mCloseBoxOn )
|
||||||
|
{
|
||||||
|
if ( is_in_box( wxPoint( rect.x + mHintGap + boxOfs, coord ), inPane ) )
|
||||||
|
|
||||||
|
return CLOSE_BOX_HITTED;
|
||||||
|
|
||||||
|
coord += BTN_BOX_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mCollapseBoxOn )
|
||||||
|
{
|
||||||
|
if ( mCloseBoxOn ) coord += BOX_T_BOX_GAP;
|
||||||
|
|
||||||
|
if ( is_in_box( wxPoint( rect.x + mHintGap + boxOfs, coord ), inPane ) )
|
||||||
|
|
||||||
|
return COLLAPSE_BOX_HITTED;
|
||||||
|
|
||||||
|
coord += BTN_BOX_HEIGHT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( mCloseBoxOn )
|
||||||
|
{
|
||||||
|
coord -= BTN_BOX_WIDTH;
|
||||||
|
|
||||||
|
if ( is_in_box( wxPoint( coord , rect.y + mHintGap + boxOfs ), inPane ) )
|
||||||
|
|
||||||
|
return CLOSE_BOX_HITTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mCollapseBoxOn )
|
||||||
|
{
|
||||||
|
if ( mCloseBoxOn ) coord -= BOX_T_BOX_GAP;
|
||||||
|
coord -= BTN_BOX_WIDTH;
|
||||||
|
|
||||||
|
if ( is_in_box( wxPoint( coord, rect.y + mHintGap + boxOfs ), inPane ) )
|
||||||
|
|
||||||
|
return COLLAPSE_BOX_HITTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// handlers for plugin-events
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::OnSizeBarWindow( cbSizeBarWndEvent& event )
|
||||||
|
{
|
||||||
|
wxRect& rect = event.mBoundsInParent;
|
||||||
|
mpPane = event.mpPane;
|
||||||
|
|
||||||
|
ExcludeHints( rect, *event.mpBar );
|
||||||
|
|
||||||
|
event.Skip(); // pass event to the next plugin in the chain
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::OnDrawBarDecorations( cbDrawBarDecorEvent& event )
|
||||||
|
{
|
||||||
|
wxRect& rect = event.mBoundsInParent;
|
||||||
|
mpPane = event.mpPane;
|
||||||
|
|
||||||
|
int boxOfs, grooveOfs, pos;
|
||||||
|
|
||||||
|
GetHintsLayout( rect, *event.mpBar, boxOfs, grooveOfs, pos );
|
||||||
|
|
||||||
|
DoDrawHint( *event.mpDc, rect, pos, boxOfs, grooveOfs, event.mpBar->IsFixed() );
|
||||||
|
|
||||||
|
// let other plugins add on their decorations
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::OnLeftDown( cbLeftDownEvent& event )
|
||||||
|
{
|
||||||
|
mpPane = event.mpPane;
|
||||||
|
|
||||||
|
wxPoint inFrame = event.mPos;
|
||||||
|
mpPane->PaneToFrame( &inFrame.x, &inFrame.y );
|
||||||
|
|
||||||
|
wxBarIterator iter( mpPane->GetRowList() );
|
||||||
|
|
||||||
|
mpClickedBar = NULL;
|
||||||
|
|
||||||
|
while ( iter.Next() )
|
||||||
|
{
|
||||||
|
cbBarInfo& bar = iter.BarInfo();
|
||||||
|
|
||||||
|
int boxOfs, grooveOfs, pos;
|
||||||
|
|
||||||
|
GetHintsLayout( bar.mBoundsInParent, bar, boxOfs, grooveOfs, pos );
|
||||||
|
|
||||||
|
if ( !bar.IsFixed() )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for( i = 0; i != BOXES_IN_HINT; ++i )
|
||||||
|
{
|
||||||
|
mBoxes[i]->OnLeftDown( inFrame );
|
||||||
|
|
||||||
|
if ( mBoxes[i]->mPressed )
|
||||||
|
{
|
||||||
|
mBtnPressed = TRUE;
|
||||||
|
mpClickedBar = &bar;
|
||||||
|
|
||||||
|
return; // event handled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::OnLeftUp( cbLeftUpEvent& event )
|
||||||
|
{
|
||||||
|
if ( mBtnPressed )
|
||||||
|
{
|
||||||
|
wxPoint inFrame = event.mPos;
|
||||||
|
mpPane->PaneToFrame( &inFrame.x, &inFrame.y );
|
||||||
|
|
||||||
|
int boxOfs, grooveOfs, pos;
|
||||||
|
|
||||||
|
GetHintsLayout( mpClickedBar->mBoundsInParent, *mpClickedBar, boxOfs, grooveOfs, pos );
|
||||||
|
|
||||||
|
int result = HitTestHints( *mpClickedBar, event.mPos );
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for( i = 0; i != BOXES_IN_HINT; ++i )
|
||||||
|
{
|
||||||
|
mBoxes[i]->OnLeftUp( inFrame );
|
||||||
|
|
||||||
|
if ( mBoxes[i]->WasClicked() )
|
||||||
|
{
|
||||||
|
if ( i == 0 )
|
||||||
|
|
||||||
|
mpLayout->SetBarState( mpClickedBar, wxCBAR_HIDDEN, TRUE );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( mpClickedBar->IsExpanded() )
|
||||||
|
|
||||||
|
mpPane->ContractBar( mpClickedBar );
|
||||||
|
else
|
||||||
|
mpPane->ExpandBar( mpClickedBar );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mBtnPressed = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::OnMotion( cbMotionEvent& event )
|
||||||
|
{
|
||||||
|
if ( mBtnPressed )
|
||||||
|
{
|
||||||
|
wxPoint inFrame = event.mPos;
|
||||||
|
mpPane->PaneToFrame( &inFrame.x, &inFrame.y );
|
||||||
|
|
||||||
|
mpPane = event.mpPane;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for( i = 0; i != BOXES_IN_HINT; ++i )
|
||||||
|
|
||||||
|
mBoxes[i]->OnMotion( inFrame );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbBarHintsPlugin::OnInitPlugin()
|
||||||
|
{
|
||||||
|
cbPluginBase::OnInitPlugin();
|
||||||
|
|
||||||
|
cbDockPane** panes = mpLayout->GetPanesArray();
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for( i = 0; i != MAX_PANES; ++i )
|
||||||
|
{
|
||||||
|
if ( panes[i]->MatchesMask( mPaneMask ) )
|
||||||
|
{
|
||||||
|
panes[i]->mProps.mMinCBarDim.x = 25;
|
||||||
|
panes[i]->mProps.mMinCBarDim.y = 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CreateBoxes();
|
||||||
|
}
|
202
contrib/src/fl/cbcustom.cpp
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 06/09/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "cbcustom.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/cbcustom.h"
|
||||||
|
|
||||||
|
// helper class to receive menu customization event
|
||||||
|
|
||||||
|
class cbContextMenuHandler : public wxEvtHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cbSimpleCustomizationPlugin* mpBackRef;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void OnMenuCommand( wxCommandEvent& evt );
|
||||||
|
|
||||||
|
void OnCommandEvents( wxCommandEvent& evt );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
// FIXME:: is this "safe" ?
|
||||||
|
|
||||||
|
#define CB_CUSTOMIZE_MENU_FIRST_ITEM_ID 17500
|
||||||
|
|
||||||
|
/***** Implementation for helper class cbContextMenuHandler *****/
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( cbContextMenuHandler, wxEvtHandler )
|
||||||
|
|
||||||
|
// 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 )
|
||||||
|
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
void cbContextMenuHandler::OnCommandEvents( wxCommandEvent& evt )
|
||||||
|
{
|
||||||
|
//wxMessageBox("Wowwwww, Yeah!");
|
||||||
|
|
||||||
|
mpBackRef->OnMenuItemSelected( evt );
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Implementation for class cbSimpleCustomizationPlugin *****/
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS( cbSimpleCustomizationPlugin, cbPluginBase )
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( cbSimpleCustomizationPlugin, cbPluginBase )
|
||||||
|
|
||||||
|
EVT_PL_CUSTOMIZE_BAR ( cbSimpleCustomizationPlugin::OnCustomizeBar )
|
||||||
|
EVT_PL_CUSTOMIZE_LAYOUT( cbSimpleCustomizationPlugin::OnCustomizeLayout )
|
||||||
|
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
cbSimpleCustomizationPlugin::cbSimpleCustomizationPlugin(void)
|
||||||
|
{}
|
||||||
|
|
||||||
|
cbSimpleCustomizationPlugin::cbSimpleCustomizationPlugin( wxFrameLayout* pPanel, int paneMask )
|
||||||
|
|
||||||
|
: cbPluginBase( pPanel, paneMask )
|
||||||
|
{}
|
||||||
|
|
||||||
|
void cbSimpleCustomizationPlugin::OnCustomizeBar( cbCustomizeBarEvent& event )
|
||||||
|
{
|
||||||
|
// ingnore bar customization, treat it
|
||||||
|
// as layout-customization...ugly, eh?
|
||||||
|
|
||||||
|
cbCustomizeLayoutEvent clEvt( event.mClickPos );
|
||||||
|
|
||||||
|
OnCustomizeLayout( clEvt );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbSimpleCustomizationPlugin::OnCustomizeLayout( cbCustomizeLayoutEvent& event )
|
||||||
|
{
|
||||||
|
wxString helpStr1 = "Select this item to show the corresponding control bar";
|
||||||
|
wxString helpStr2 = "Select this itme to hide the corresponding control bar";
|
||||||
|
|
||||||
|
int id = CB_CUSTOMIZE_MENU_FIRST_ITEM_ID;
|
||||||
|
|
||||||
|
wxMenu* pMenu = new wxMenu();
|
||||||
|
|
||||||
|
BarArrayT& bars = mpLayout->GetBars();
|
||||||
|
|
||||||
|
for( size_t i = 0; i != bars.GetCount(); ++i )
|
||||||
|
{
|
||||||
|
cbBarInfo& bar = *bars[i];
|
||||||
|
|
||||||
|
bool isHidden = ( bar.mState == wxCBAR_HIDDEN );
|
||||||
|
|
||||||
|
wxString* pHelpStr = ( isHidden ) ? &helpStr1 : &helpStr2;
|
||||||
|
|
||||||
|
pMenu->Append( id, bar.mName, *pHelpStr, TRUE );
|
||||||
|
|
||||||
|
pMenu->Check( id, (isHidden == FALSE) );
|
||||||
|
|
||||||
|
++id;
|
||||||
|
}
|
||||||
|
|
||||||
|
pMenu->AppendSeparator();
|
||||||
|
pMenu->Append( id, "Customize...", "Show layout customization dialog", FALSE );
|
||||||
|
mCustMenuItemId = id;
|
||||||
|
|
||||||
|
cbContextMenuHandler* pHandler = new cbContextMenuHandler();
|
||||||
|
pHandler->mpBackRef = this;
|
||||||
|
|
||||||
|
wxWindow* pFrm = &mpLayout->GetParentFrame();
|
||||||
|
|
||||||
|
// 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) );
|
||||||
|
|
||||||
|
pMenu->SetEventHandler( pHandler );
|
||||||
|
|
||||||
|
pTmpWnd->PopupMenu( pMenu, 0,0 );
|
||||||
|
|
||||||
|
pTmpWnd->Destroy();
|
||||||
|
|
||||||
|
delete pMenu;
|
||||||
|
delete pHandler;
|
||||||
|
|
||||||
|
// event is "eaten" by this plugin
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbSimpleCustomizationPlugin::OnMenuItemSelected( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
if ( event.GetId() == mCustMenuItemId )
|
||||||
|
{
|
||||||
|
wxMessageBox("Customization dialog box is not supported by this plugin yet");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cbBarInfo* pBar = mpLayout->GetBars()[ event.GetId() -
|
||||||
|
CB_CUSTOMIZE_MENU_FIRST_ITEM_ID
|
||||||
|
];
|
||||||
|
|
||||||
|
wxASSERT( pBar ); // DBG::
|
||||||
|
|
||||||
|
// "inverse" bar-visibility of the selected bar
|
||||||
|
|
||||||
|
int newState = 0;
|
||||||
|
|
||||||
|
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 )
|
||||||
|
|
||||||
|
newState = wxCBAR_DOCKED_HORIZONTALLY;
|
||||||
|
else
|
||||||
|
newState = wxCBAR_DOCKED_VERTICALLY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newState = wxCBAR_HIDDEN;
|
||||||
|
|
||||||
|
if ( pBar->mState == wxCBAR_FLOATING )
|
||||||
|
|
||||||
|
pBar->mAlignment = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
mpLayout->SetBarState( pBar, newState, TRUE );
|
||||||
|
|
||||||
|
if ( newState == wxCBAR_FLOATING )
|
||||||
|
|
||||||
|
mpLayout->RepositionFloatedBar( pBar );
|
||||||
|
}
|
||||||
|
|
||||||
|
// menu-item-selected event is "eaten"
|
||||||
|
}
|
||||||
|
|
3524
contrib/src/fl/controlbar.cpp
Normal file
517
contrib/src/fl/dyntbar.cpp
Normal file
@@ -0,0 +1,517 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: ??/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "dyntbar.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/utils.h" // import wxMin,wxMax macros
|
||||||
|
|
||||||
|
#include "wx/fl/dyntbar.h"
|
||||||
|
#include "wx/fl/newbmpbtn.h"
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxDynamicToolBar, wxControl )
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( wxDynamicToolBar, wxControl )
|
||||||
|
|
||||||
|
EVT_SIZE ( wxDynamicToolBar::OnSize )
|
||||||
|
EVT_PAINT( wxDynamicToolBar::OnPaint )
|
||||||
|
//EVT_ERASE_BACKGROUND( wxDynamicToolBar::OnEraseBackground )
|
||||||
|
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
/***** Implementation for class wxDynToolInfo *****/
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxDynToolInfo, wxToolLayoutItem)
|
||||||
|
|
||||||
|
/***** Implementation for class wxDynamicToolBar *****/
|
||||||
|
|
||||||
|
wxDynamicToolBar::wxDynamicToolBar()
|
||||||
|
: mpLayoutMan( NULL ),
|
||||||
|
mSepartorSize( 8 ),
|
||||||
|
mVertGap ( 0 ),
|
||||||
|
mHorizGap( 0 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDynamicToolBar::wxDynamicToolBar(wxWindow *parent, const wxWindowID id,
|
||||||
|
const wxPoint& pos, const wxSize& size,
|
||||||
|
const long style, const int orientation,
|
||||||
|
const int RowsOrColumns, const wxString& name )
|
||||||
|
: mpLayoutMan( NULL ),
|
||||||
|
mSepartorSize( 8 ),
|
||||||
|
mVertGap ( 0 ),
|
||||||
|
mHorizGap( 0 )
|
||||||
|
{
|
||||||
|
Create(parent, id, pos, size, style, orientation, RowsOrColumns, name);
|
||||||
|
|
||||||
|
SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE) );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDynamicToolBar::Create(wxWindow *parent, const wxWindowID id,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
const long style,
|
||||||
|
const int orientation, const int RowsOrColumns,
|
||||||
|
const wxString& name)
|
||||||
|
{
|
||||||
|
// cut&pasted from wxtbatsmpl.h
|
||||||
|
|
||||||
|
if ( ! wxWindow::Create(parent, id, pos, size, style, name) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDynamicToolBar::Realize(void)
|
||||||
|
{
|
||||||
|
// FOR NOW:: nothing
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDynamicToolBar::~wxDynamicToolBar(void)
|
||||||
|
{
|
||||||
|
if ( mpLayoutMan )
|
||||||
|
delete mpLayoutMan;
|
||||||
|
|
||||||
|
size_t i;
|
||||||
|
for( i = 0; i != mTools.Count(); ++i )
|
||||||
|
{
|
||||||
|
delete mTools[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::AddTool( int toolIndex,
|
||||||
|
wxWindow* pToolWindow,
|
||||||
|
const wxSize& size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wxDynToolInfo* pInfo = new wxDynToolInfo();
|
||||||
|
|
||||||
|
pInfo->mpToolWnd = pToolWindow;
|
||||||
|
pInfo->mIndex = toolIndex;
|
||||||
|
pInfo->mIsSeparator = FALSE;
|
||||||
|
|
||||||
|
int x,y;
|
||||||
|
pToolWindow->GetSize( &x, &y );
|
||||||
|
pInfo->mRealSize.x = x;
|
||||||
|
pInfo->mRealSize.y = y;
|
||||||
|
pInfo->mRect.width = x;
|
||||||
|
pInfo->mRect.height = y;
|
||||||
|
|
||||||
|
mTools.Add( pInfo );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::AddTool( int toolIndex,
|
||||||
|
const wxString& imageFileName,
|
||||||
|
int imageFileType,
|
||||||
|
const wxString& labelText, bool alignTextRight,
|
||||||
|
bool isFlat )
|
||||||
|
{
|
||||||
|
wxNewBitmapButton* pBtn =
|
||||||
|
|
||||||
|
new wxNewBitmapButton( imageFileName, imageFileType,
|
||||||
|
labelText,
|
||||||
|
( alignTextRight )
|
||||||
|
? NB_ALIGN_TEXT_RIGHT
|
||||||
|
: NB_ALIGN_TEXT_BOTTOM,
|
||||||
|
isFlat
|
||||||
|
);
|
||||||
|
|
||||||
|
pBtn->Create( this, toolIndex );
|
||||||
|
|
||||||
|
pBtn->Reshape();
|
||||||
|
|
||||||
|
AddTool( toolIndex, pBtn );
|
||||||
|
}
|
||||||
|
void wxDynamicToolBar::AddTool( int toolIndex, wxBitmap labelBmp,
|
||||||
|
const wxString& labelText, bool alignTextRight,
|
||||||
|
bool isFlat )
|
||||||
|
{
|
||||||
|
wxNewBitmapButton* pBtn =
|
||||||
|
|
||||||
|
new wxNewBitmapButton( labelBmp,
|
||||||
|
labelText,
|
||||||
|
( alignTextRight )
|
||||||
|
? NB_ALIGN_TEXT_RIGHT
|
||||||
|
: NB_ALIGN_TEXT_BOTTOM,
|
||||||
|
isFlat
|
||||||
|
);
|
||||||
|
|
||||||
|
pBtn->Create( this, toolIndex );
|
||||||
|
|
||||||
|
pBtn->Reshape();
|
||||||
|
|
||||||
|
AddTool( toolIndex, pBtn );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxToolBarToolBase*
|
||||||
|
wxDynamicToolBar::AddTool(const int toolIndex, const wxBitmap& bitmap,
|
||||||
|
const wxBitmap& pushedBitmap,
|
||||||
|
const bool toggle, const long xPos,
|
||||||
|
const long yPos, wxObject *clientData,
|
||||||
|
const wxString& helpString1, const wxString& helpString2)
|
||||||
|
{
|
||||||
|
wxNewBitmapButton* pBmpBtn = new wxNewBitmapButton( bitmap );
|
||||||
|
|
||||||
|
pBmpBtn->Create( this, toolIndex );
|
||||||
|
|
||||||
|
pBmpBtn->Reshape();
|
||||||
|
|
||||||
|
AddTool( toolIndex, pBmpBtn );
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxDynToolInfo* wxDynamicToolBar::GetToolInfo( int toolIndex )
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
for( i = 0; i != mTools.Count(); ++i )
|
||||||
|
{
|
||||||
|
if ( mTools[i]->mIndex == toolIndex )
|
||||||
|
return mTools[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::RemveTool( int toolIndex )
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
for( i = 0; i != mTools.Count(); ++i )
|
||||||
|
{
|
||||||
|
if ( mTools[i]->mIndex == toolIndex )
|
||||||
|
{
|
||||||
|
if ( mTools[i]->mpToolWnd )
|
||||||
|
{
|
||||||
|
mTools[i]->mpToolWnd->Destroy();
|
||||||
|
}
|
||||||
|
delete mTools[i]; // HVL To be tested!!!
|
||||||
|
#if wxCHECK_VERSION(2,3,2)
|
||||||
|
mTools.RemoveAt(i);
|
||||||
|
#else
|
||||||
|
mTools.Remove(i);
|
||||||
|
#endif
|
||||||
|
Layout();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO:: if not found, should it be an assertion?
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::AddSeparator( wxWindow* pSepartorWnd )
|
||||||
|
{
|
||||||
|
wxDynToolInfo* pInfo = new wxDynToolInfo();
|
||||||
|
|
||||||
|
pInfo->mpToolWnd = pSepartorWnd;
|
||||||
|
pInfo->mIndex = -1;
|
||||||
|
pInfo->mIsSeparator = TRUE;
|
||||||
|
|
||||||
|
if ( pSepartorWnd )
|
||||||
|
{
|
||||||
|
pSepartorWnd->Create( this, -1 );
|
||||||
|
|
||||||
|
int x,y;
|
||||||
|
pSepartorWnd->GetSize( &x, &y );
|
||||||
|
pInfo->mRealSize.x = x;
|
||||||
|
pInfo->mRealSize.y = y;
|
||||||
|
|
||||||
|
pInfo->mRect.width = x;
|
||||||
|
pInfo->mRect.height = y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pInfo->mRealSize.x = mSepartorSize;
|
||||||
|
pInfo->mRealSize.y = 0;
|
||||||
|
|
||||||
|
pInfo->mRect.width = mSepartorSize;
|
||||||
|
pInfo->mRect.height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mTools.Add( pInfo );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::OnEraseBackground( wxEraseEvent& event )
|
||||||
|
{
|
||||||
|
// FOR NOW:: nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::OnSize( wxSizeEvent& event )
|
||||||
|
{
|
||||||
|
//SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ) );
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::DrawSeparator( wxDynToolInfo& info, wxDC& dc )
|
||||||
|
{
|
||||||
|
// check the orientation of separator
|
||||||
|
if ( info.mRect.width < info.mRect.height )
|
||||||
|
{
|
||||||
|
int midX = info.mRect.x + info.mRect.width/2 - 1;
|
||||||
|
|
||||||
|
dc.SetPen( *wxGREY_PEN );
|
||||||
|
dc.DrawLine( midX, info.mRect.y,
|
||||||
|
midX, info.mRect.y + info.mRect.height+1 );
|
||||||
|
|
||||||
|
dc.SetPen( *wxWHITE_PEN );
|
||||||
|
dc.DrawLine( midX+1, info.mRect.y,
|
||||||
|
midX+1, info.mRect.y + info.mRect.height+1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int midY = info.mRect.y + info.mRect.height/2 - 1;
|
||||||
|
|
||||||
|
dc.SetPen( *wxGREY_PEN );
|
||||||
|
dc.DrawLine( info.mRect.x, midY,
|
||||||
|
info.mRect.x + info.mRect.width+1, midY );
|
||||||
|
|
||||||
|
dc.SetPen( *wxWHITE_PEN );
|
||||||
|
dc.DrawLine( info.mRect.x, midY + 1,
|
||||||
|
info.mRect.x + info.mRect.width+1, midY + 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::OnPaint( wxPaintEvent& event )
|
||||||
|
{
|
||||||
|
// draw separators if any
|
||||||
|
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
|
||||||
|
size_t i;
|
||||||
|
for( i = 0; i != mTools.Count(); ++i )
|
||||||
|
|
||||||
|
if ( mTools[i]->mIsSeparator )
|
||||||
|
{
|
||||||
|
// check if separator doesn't have it's own window
|
||||||
|
// if so, then draw it using built-in drawing method
|
||||||
|
|
||||||
|
if ( !mTools[i]->mpToolWnd )
|
||||||
|
|
||||||
|
DrawSeparator( *mTools[i], dc );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FOR NOW:: quick fix
|
||||||
|
#include "wx/choice.h"
|
||||||
|
|
||||||
|
void wxDynamicToolBar::SizeToolWindows()
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
for( i = 0; i != mTools.Count(); ++i )
|
||||||
|
{
|
||||||
|
wxDynToolInfo& info = *mTools[i];
|
||||||
|
|
||||||
|
if ( !info.mIsSeparator )
|
||||||
|
{
|
||||||
|
|
||||||
|
// center real rectangle within the rectangle
|
||||||
|
// provided by the layout manager
|
||||||
|
|
||||||
|
int x = info.mRect.x;
|
||||||
|
int y = info.mRect.y + (info.mRect.height - info.mRealSize.y)/2;
|
||||||
|
|
||||||
|
// FOR NOW FOR NOW:: quick & dirty fix
|
||||||
|
if ( info.mpToolWnd->IsKindOf( CLASSINFO( wxChoice ) ) )
|
||||||
|
{
|
||||||
|
info.mpToolWnd->SetSize( x,y,
|
||||||
|
info.mRealSize.x - 3,
|
||||||
|
info.mRealSize.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
info.mpToolWnd->SetSize( x,y,
|
||||||
|
info.mRealSize.x,
|
||||||
|
info.mRealSize.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
// TBD:: size separator window if present
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDynamicToolBar::Layout()
|
||||||
|
{
|
||||||
|
if ( !mpLayoutMan )
|
||||||
|
mpLayoutMan = CreateDefaulLayout();
|
||||||
|
|
||||||
|
int x,y;
|
||||||
|
GetSize( &x, &y );
|
||||||
|
wxSize wndDim(x,y);
|
||||||
|
wxSize result;
|
||||||
|
|
||||||
|
wxLayoutItemArrayT items;
|
||||||
|
|
||||||
|
// safe conversion
|
||||||
|
size_t i;
|
||||||
|
for( i = 0; i != mTools.Count(); ++i )
|
||||||
|
items.Add( mTools[i] );
|
||||||
|
|
||||||
|
mpLayoutMan->Layout( wndDim, result, items, mVertGap, mHorizGap );;
|
||||||
|
|
||||||
|
SizeToolWindows();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::GetPreferredDim( const wxSize& givenDim, wxSize& prefDim )
|
||||||
|
{
|
||||||
|
if ( !mpLayoutMan )
|
||||||
|
mpLayoutMan = CreateDefaulLayout();
|
||||||
|
|
||||||
|
wxLayoutItemArrayT items;
|
||||||
|
|
||||||
|
// safe conversion
|
||||||
|
size_t i;
|
||||||
|
for( i = 0; i != mTools.Count(); ++i )
|
||||||
|
items.Add( mTools[i] );
|
||||||
|
|
||||||
|
mpLayoutMan->Layout( givenDim, prefDim, items, mVertGap, mHorizGap );;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::SetLayout( LayoutManagerBase* pLayout )
|
||||||
|
{
|
||||||
|
if ( mpLayoutMan )
|
||||||
|
delete mpLayoutMan;
|
||||||
|
|
||||||
|
mpLayoutMan = pLayout;
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::EnableTool(const int toolIndex, const bool enable )
|
||||||
|
{
|
||||||
|
wxDynToolInfo* pInfo = GetToolInfo( toolIndex );
|
||||||
|
|
||||||
|
if ( !pInfo )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( pInfo->mIsSeparator || !pInfo->mpToolWnd )
|
||||||
|
return;
|
||||||
|
|
||||||
|
pInfo->mpToolWnd->Enable( enable );
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Implementation for class BagLayout *****/
|
||||||
|
|
||||||
|
void BagLayout::Layout( const wxSize& parentDim,
|
||||||
|
wxSize& resultingDim,
|
||||||
|
wxLayoutItemArrayT& items,
|
||||||
|
int horizGap,
|
||||||
|
int vertGap
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int maxWidth = 0;
|
||||||
|
int curY = 0;
|
||||||
|
int nRows = 0;
|
||||||
|
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
|
while( i < items.Count() )
|
||||||
|
{
|
||||||
|
int curX = 0;
|
||||||
|
int height = 0;
|
||||||
|
// int nItems = 0;
|
||||||
|
|
||||||
|
// int firstItem = i;
|
||||||
|
int itemsInRow = 0;
|
||||||
|
|
||||||
|
if ( nRows > 0 )
|
||||||
|
curY += vertGap;
|
||||||
|
|
||||||
|
// step #1 - arrange horizontal positions of items in the row
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if ( itemsInRow > 0 )
|
||||||
|
curX += horizGap;
|
||||||
|
|
||||||
|
wxRect& r = items[i]->mRect;
|
||||||
|
|
||||||
|
if ( curX + r.width > parentDim.x )
|
||||||
|
{
|
||||||
|
if ( itemsInRow > 0 )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
r.x = curX;
|
||||||
|
r.y = curY;
|
||||||
|
|
||||||
|
curX += r.width;
|
||||||
|
|
||||||
|
height = wxMax( height, r.height );
|
||||||
|
|
||||||
|
++itemsInRow;
|
||||||
|
++i;
|
||||||
|
|
||||||
|
} while( i < items.Count() );
|
||||||
|
|
||||||
|
curY += height;
|
||||||
|
|
||||||
|
maxWidth = wxMax( maxWidth, curX );
|
||||||
|
}
|
||||||
|
|
||||||
|
resultingDim.x = maxWidth;
|
||||||
|
resultingDim.y = curY;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////// stuff from 2.1.15 ///////////
|
||||||
|
|
||||||
|
wxToolBarToolBase* wxDynamicToolBar::FindToolForPosition( wxCoord x, wxCoord y ) const
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDynamicToolBar::DoInsertTool( size_t pos, wxToolBarToolBase* tool )
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDynamicToolBar::DoDeleteTool( size_t pos, wxToolBarToolBase* tool )
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::DoEnableTool( wxToolBarToolBase* tool, bool enable )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::DoToggleTool( wxToolBarToolBase* tool, bool toggle )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicToolBar::DoSetToggle( wxToolBarToolBase* tool, bool toggle )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
wxToolBarToolBase* wxDynamicToolBar::CreateTool( int id, const wxBitmap& bitmap1, const wxBitmap& bitmap2, bool toggle, wxObject* clientData, const wxString& shortHelpString, const wxString& longHelpString )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxToolBarToolBase* wxDynamicToolBar::CreateTool( wxControl* control )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
49
contrib/src/fl/dyntbarhnd.cpp
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 23/01/99
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "dyntbarhnd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/dyntbarhnd.h"
|
||||||
|
|
||||||
|
/***** Implementation for class cbDynToolBarDimHandler *****/
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS( cbDynToolBarDimHandler, cbBarDimHandlerBase )
|
||||||
|
|
||||||
|
void cbDynToolBarDimHandler::OnChangeBarState(cbBarInfo* pBar, int newState )
|
||||||
|
{
|
||||||
|
// nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbDynToolBarDimHandler::OnResizeBar( cbBarInfo* pBar,
|
||||||
|
const wxSize& given,
|
||||||
|
wxSize& preferred )
|
||||||
|
{
|
||||||
|
wxASSERT( pBar->mpBarWnd ); // DBG:: should be present
|
||||||
|
|
||||||
|
wxDynamicToolBar* pTBar = (wxDynamicToolBar*)pBar->mpBarWnd;
|
||||||
|
|
||||||
|
pTBar->GetPreferredDim( given, preferred );
|
||||||
|
}
|
||||||
|
|
20
contrib/src/fl/files.lst
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
FL_OBJECTS = \
|
||||||
|
antiflickpl.$(OBJ_EXT) \
|
||||||
|
gcupdatesmgr.$(OBJ_EXT) \
|
||||||
|
rowlayoutpl.$(OBJ_EXT) \
|
||||||
|
bardragpl.$(OBJ_EXT) \
|
||||||
|
dyntbar.$(OBJ_EXT) \
|
||||||
|
hintanimpl.$(OBJ_EXT) \
|
||||||
|
toolwnd.$(OBJ_EXT) \
|
||||||
|
barhintspl.$(OBJ_EXT) \
|
||||||
|
dyntbarhnd.$(OBJ_EXT) \
|
||||||
|
newbmpbtn.$(OBJ_EXT) \
|
||||||
|
updatesmgr.$(OBJ_EXT) \
|
||||||
|
cbcustom.$(OBJ_EXT) \
|
||||||
|
frmview.$(OBJ_EXT) \
|
||||||
|
panedrawpl.$(OBJ_EXT) \
|
||||||
|
controlbar.$(OBJ_EXT) \
|
||||||
|
garbagec.$(OBJ_EXT) \
|
||||||
|
rowdragpl.$(OBJ_EXT)
|
||||||
|
|
230
contrib/src/fl/flVC.dsp
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="flVC" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||||
|
|
||||||
|
CFG=flVC - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "flVC.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "flVC.mak" CFG="flVC - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "flVC - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||||
|
!MESSAGE "flVC - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "flVC - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../include" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__HACK_MY_MSDEV40__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE RSC /l 0x809
|
||||||
|
# ADD RSC /l 0x809
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LIB32=link.exe -lib
|
||||||
|
# ADD BASE LIB32 /nologo
|
||||||
|
# ADD LIB32 /nologo /out:"..\..\..\lib\fl.lib"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "flVC - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE RSC /l 0x809
|
||||||
|
# ADD RSC /l 0x809
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LIB32=link.exe -lib
|
||||||
|
# ADD BASE LIB32 /nologo
|
||||||
|
# ADD LIB32 /nologo /out:"..\..\..\lib\fld.lib"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "flVC - Win32 Release"
|
||||||
|
# Name "flVC - Win32 Debug"
|
||||||
|
# Begin Group "Headers"
|
||||||
|
|
||||||
|
# PROP Default_Filter ""
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\antiflickpl.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\bardragpl.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\barhintspl.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\cbcustom.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\controlbar.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\dynbarhnd.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\dyntbar.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\dyntbarhnd.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\frmview.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\garbagec.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\gcupdatesmgr.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\hintanimpl.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\newbmpbtn.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\panedrawpl.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\rowdragpl.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\rowlayoutpl.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\toolwnd.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\include\wx\fl\updatesmgr.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\antiflickpl.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\bardragpl.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\barhintspl.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\cbcustom.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\controlbar.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\dyntbar.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\dyntbarhnd.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\frmview.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\garbagec.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\gcupdatesmgr.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\hintanimpl.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\newbmpbtn.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\panedrawpl.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\rowdragpl.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\rowlayoutpl.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\toolwnd.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\updatesmgr.cpp
|
||||||
|
# End Source File
|
||||||
|
# End Target
|
||||||
|
# End Project
|
29
contrib/src/fl/flVC.dsw
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "flVC"=.\flVC.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
451
contrib/src/fl/frmview.cpp
Normal file
@@ -0,0 +1,451 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 02/01/99
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "frmview.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/frmview.h"
|
||||||
|
#include "wx/utils.h"
|
||||||
|
|
||||||
|
/***** Implementation for class wxFrameView *****/
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( wxFrameView, wxEvtHandler )
|
||||||
|
|
||||||
|
EVT_IDLE( wxFrameView::OnIdle )
|
||||||
|
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
void wxFrameView::OnIdle( wxIdleEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
|
||||||
|
if ( mDoToolUpdates )
|
||||||
|
{
|
||||||
|
int o = 0; //glt
|
||||||
|
++o;
|
||||||
|
|
||||||
|
// TBD::
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** public methods ***/
|
||||||
|
|
||||||
|
wxFrameView::wxFrameView()
|
||||||
|
|
||||||
|
: mpLayout( NULL ),
|
||||||
|
mpFrameMgr( NULL )
|
||||||
|
{}
|
||||||
|
|
||||||
|
wxFrameView::~wxFrameView()
|
||||||
|
{
|
||||||
|
if ( mpLayout ) delete mpLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFrame* wxFrameView::GetParentFrame()
|
||||||
|
{
|
||||||
|
return mpFrameMgr->GetParentFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxWindow* wxFrameView::GetClientWindow()
|
||||||
|
{
|
||||||
|
return mpFrameMgr->GetClientWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameView::Activate()
|
||||||
|
{
|
||||||
|
mpFrameMgr->ActivateView( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameView::Deactivate()
|
||||||
|
{
|
||||||
|
mpFrameMgr->DeactivateCurrentView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameView::CreateLayout()
|
||||||
|
{
|
||||||
|
mpLayout = new wxFrameLayout( GetParentFrame(), mpFrameMgr->GetClientWindow(), FALSE );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFrameLayout* wxFrameView::GetLayout()
|
||||||
|
{
|
||||||
|
return mpLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameView::SetToolUpdates( bool doToolUpdates )
|
||||||
|
{
|
||||||
|
mDoToolUpdates = doToolUpdates;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameView::SetLayout( wxFrameLayout* pLayout )
|
||||||
|
{
|
||||||
|
if ( mpLayout ) delete mpLayout;
|
||||||
|
|
||||||
|
mpLayout = pLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFrameManager& wxFrameView::GetFrameManager()
|
||||||
|
{
|
||||||
|
return *mpFrameMgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameView::RegisterMenu( const wxString& topMenuName )
|
||||||
|
{
|
||||||
|
mTopMenus.Add( topMenuName );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
/***** Implementation for class wxFrameViewSerializer *****/
|
||||||
|
|
||||||
|
// NOTE:: currently "stipple" property of the brush is not serialized
|
||||||
|
|
||||||
|
class wxFrameViewSerializer : public wxEvtHandlerSerializer
|
||||||
|
{
|
||||||
|
DECLARE_SERIALIZER_CLASS( wxFrameViewSerializer );
|
||||||
|
|
||||||
|
static void Serialize( wxObject* pObj, wxObjectStorage& store );
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_SERIALIZER_CLASS( wxFrameView,
|
||||||
|
wxFrameViewSerializer,
|
||||||
|
wxFrameViewSerializer::Serialize,
|
||||||
|
NO_CLASS_INIT )
|
||||||
|
|
||||||
|
void wxFrameViewSerializer::Serialize( wxObject* pObj, wxObjectStorage& store )
|
||||||
|
{
|
||||||
|
// wxFrameViewSerializer is a kind of wxEvtHandler - peform serialization of
|
||||||
|
// the base class first
|
||||||
|
|
||||||
|
info.SerializeInherited( pObj, store );
|
||||||
|
|
||||||
|
wxFrameView* pView = (wxFrameView*)pObj;
|
||||||
|
|
||||||
|
store.XchgObjPtr( (wxObject**) &pView->mpFrameMgr );
|
||||||
|
store.XchgObjPtr( (wxObject**) &pView->mpLayout );
|
||||||
|
store.XchgBool ( pView->mDoToolUpdates );
|
||||||
|
|
||||||
|
// serialize members in derived classes
|
||||||
|
|
||||||
|
pView->OnSerialize( store );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/***** Implementation for class wxFrameManager *****/
|
||||||
|
|
||||||
|
void wxFrameManager::DoSerialize( wxObjectStorage& store )
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
store.AddInitialRef( mpFrameWnd );
|
||||||
|
store.AddInitialRef( this );
|
||||||
|
if ( mpClientWnd ) store.AddInitialRef( mpClientWnd );
|
||||||
|
|
||||||
|
store.XchgObj( (wxObject*) &mViews );
|
||||||
|
store.XchgInt( mActiveViewNo );
|
||||||
|
|
||||||
|
store.Finalize(); // finish serialization
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::DestroyViews()
|
||||||
|
{
|
||||||
|
DeactivateCurrentView();
|
||||||
|
|
||||||
|
wxNode* pNode = mViews.First();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
delete (wxFrameView*)pNode->Data();
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mActiveViewNo != -1 && GetParentFrame() )
|
||||||
|
|
||||||
|
GetParentFrame()->SetNextHandler( NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxFrameManager::GetViewNo( wxFrameView* pView )
|
||||||
|
{
|
||||||
|
wxNode* pNode = mViews.First();
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
if ( (wxFrameView*)pNode->Data() == pView )
|
||||||
|
|
||||||
|
return n;
|
||||||
|
|
||||||
|
++n;
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::EnableMenusForView( wxFrameView* pView, bool enable )
|
||||||
|
{
|
||||||
|
wxMenuBar* pMenuBar = GetParentFrame()->GetMenuBar();
|
||||||
|
int count = pMenuBar->GetMenuCount();
|
||||||
|
|
||||||
|
if ( !pMenuBar ) return;
|
||||||
|
|
||||||
|
wxStringListNode* pNode = pView->mTopMenus.GetFirst();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
for( int i = 0; i != count; ++i )
|
||||||
|
{
|
||||||
|
if ( pMenuBar->GetMenu(i)->GetTitle() == pNode->GetData() )
|
||||||
|
|
||||||
|
pMenuBar->EnableTop( i, enable );
|
||||||
|
}
|
||||||
|
|
||||||
|
pNode = pNode->GetNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::SyncAllMenus()
|
||||||
|
{
|
||||||
|
wxNode* pNode = mViews.First();
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
if ( i != mActiveViewNo )
|
||||||
|
|
||||||
|
EnableMenusForView( (wxFrameView*)pNode->GetData(), FALSE );
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
EnableMenusForView( GetView( mActiveViewNo ), TRUE );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** public methods ***/
|
||||||
|
|
||||||
|
wxFrameManager::wxFrameManager()
|
||||||
|
|
||||||
|
: mpFrameWnd( NULL ),
|
||||||
|
mActiveViewNo( -1 ),
|
||||||
|
mpClientWnd( NULL )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFrameManager::~wxFrameManager()
|
||||||
|
{
|
||||||
|
SaveViewsNow();
|
||||||
|
DestroyViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::Init( wxWindow* pMainFrame, const wxString& settingsFile )
|
||||||
|
{
|
||||||
|
mSettingsFile = settingsFile;
|
||||||
|
mpFrameWnd = pMainFrame;
|
||||||
|
|
||||||
|
wxNode* pNode = mViews.First();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
wxFrameView* pView = (wxFrameView*)pNode->Data();
|
||||||
|
|
||||||
|
pView->OnInit();
|
||||||
|
pView->OnInitMenus();
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !ReloadViews() )
|
||||||
|
{
|
||||||
|
// if loading of settings file failed (e.g. was not found),
|
||||||
|
// do recreation of items in each view
|
||||||
|
|
||||||
|
pNode = mViews.First();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
wxFrameView* pView = (wxFrameView*)pNode->Data();
|
||||||
|
|
||||||
|
pView->OnRecreate();
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mActiveViewNo >= mViews.Number() )
|
||||||
|
|
||||||
|
mActiveViewNo = -1;
|
||||||
|
|
||||||
|
ActivateView( GetView( ( mActiveViewNo == -1 ) ? 0 : mActiveViewNo ) );
|
||||||
|
|
||||||
|
SyncAllMenus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::AddView( wxFrameView* pFrmView )
|
||||||
|
{
|
||||||
|
mViews.Append( pFrmView );
|
||||||
|
|
||||||
|
pFrmView->mpFrameMgr = this; // back ref.
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::RemoveView( wxFrameView* pFrmView )
|
||||||
|
{
|
||||||
|
// TBD::
|
||||||
|
int avoidCompilerWarning = 0;
|
||||||
|
wxASSERT(avoidCompilerWarning);
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxFrameManager::GetActiveViewNo()
|
||||||
|
{
|
||||||
|
return mActiveViewNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFrameView* wxFrameManager::GetActiveView()
|
||||||
|
{
|
||||||
|
wxNode* pNode = mViews.Nth( mActiveViewNo );
|
||||||
|
|
||||||
|
if ( pNode ) return (wxFrameView*)pNode->Data();
|
||||||
|
else return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNode* wxFrameManager::GetActiveViewNode()
|
||||||
|
{
|
||||||
|
return mViews.Nth( mActiveViewNo );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFrame* wxFrameManager::GetParentFrame()
|
||||||
|
{
|
||||||
|
return ((wxFrame*)mpFrameWnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxWindow* wxFrameManager::GetParentWindow()
|
||||||
|
{
|
||||||
|
return mpFrameWnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFrameView* wxFrameManager::GetView( int viewNo )
|
||||||
|
{
|
||||||
|
wxNode* pNode = mViews.Nth( viewNo );
|
||||||
|
|
||||||
|
if ( pNode ) return (wxFrameView*)pNode->Data();
|
||||||
|
else return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::ActivateView( int viewNo )
|
||||||
|
{
|
||||||
|
ActivateView( GetView( viewNo ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::ActivateView( wxFrameView* pFrmView )
|
||||||
|
{
|
||||||
|
DeactivateCurrentView();
|
||||||
|
|
||||||
|
mActiveViewNo = GetViewNo( pFrmView );
|
||||||
|
|
||||||
|
if ( pFrmView->mpLayout )
|
||||||
|
|
||||||
|
pFrmView->mpLayout->Activate();
|
||||||
|
|
||||||
|
// FIXME:: we would have used PushEventHandler(),
|
||||||
|
// but wxFrame bypasses attached handlers when
|
||||||
|
// handling wxCommand events!
|
||||||
|
|
||||||
|
GetParentFrame()->PushEventHandler( pFrmView );
|
||||||
|
|
||||||
|
EnableMenusForView( pFrmView, TRUE );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::SetClinetWindow( wxWindow* pFrameClient )
|
||||||
|
{
|
||||||
|
if ( mpClientWnd ) mpClientWnd->Destroy();
|
||||||
|
|
||||||
|
mpClientWnd = pFrameClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxWindow* wxFrameManager::GetClientWindow()
|
||||||
|
{
|
||||||
|
if ( !mpClientWnd )
|
||||||
|
|
||||||
|
mpClientWnd = new wxWindow( GetParentFrame(), -1 );
|
||||||
|
|
||||||
|
return mpClientWnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::DeactivateCurrentView()
|
||||||
|
{
|
||||||
|
if ( mActiveViewNo == -1 ) return;
|
||||||
|
|
||||||
|
wxFrameView* pView = GetActiveView();
|
||||||
|
|
||||||
|
// FOR NOW::
|
||||||
|
wxASSERT( GetParentFrame()->GetEventHandler() == pView );
|
||||||
|
|
||||||
|
GetParentFrame()->PopEventHandler();
|
||||||
|
|
||||||
|
if ( pView->mpLayout )
|
||||||
|
|
||||||
|
pView->mpLayout->Deactivate();
|
||||||
|
|
||||||
|
EnableMenusForView( pView, FALSE );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFrameManager::SaveViewsNow()
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
if ( mSettingsFile == "" ) return;
|
||||||
|
|
||||||
|
wxIOStreamWrapper stm;
|
||||||
|
stm.CreateForOutput( mSettingsFile );
|
||||||
|
|
||||||
|
mStore.SetDataStream( stm );
|
||||||
|
DoSerialize( mStore );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxFrameManager::ReloadViews()
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// TBD: ????
|
||||||
|
#if 0
|
||||||
|
if ( mSettingsFile == "" || !wxFileExists( mSettingsFile ) )
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
DestroyViews();
|
||||||
|
|
||||||
|
wxIOStreamWrapper stm;
|
||||||
|
stm.CreateForInput( mSettingsFile );
|
||||||
|
|
||||||
|
mStore.SetDataStream( stm );
|
||||||
|
DoSerialize( mStore );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxFrameManager::ViewsAreLoaded()
|
||||||
|
{
|
||||||
|
return ( mViews.Number() != 0 );
|
||||||
|
}
|
||||||
|
|
224
contrib/src/fl/garbagec.cpp
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 18/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "garbagec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/garbagec.h"
|
||||||
|
|
||||||
|
/***** Implementation for class GarbageCollector *****/
|
||||||
|
|
||||||
|
inline static GCItem& node_to_item( wxNode* pNode )
|
||||||
|
{
|
||||||
|
return *( (GCItem*)(pNode->Data()) );
|
||||||
|
}
|
||||||
|
|
||||||
|
GarbageCollector::~GarbageCollector()
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** GC alg. helpers ***/
|
||||||
|
|
||||||
|
void GarbageCollector::DestroyItemList( wxList& lst )
|
||||||
|
{
|
||||||
|
wxNode* pNode = lst.First();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
delete &node_to_item( pNode );
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
lst.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNode* GarbageCollector::FindItemNode( void* pForObj )
|
||||||
|
{
|
||||||
|
wxNode* pNode = mAllNodes.First();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
if ( node_to_item( pNode ).mpObj == pForObj )
|
||||||
|
|
||||||
|
return pNode;
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
int avoidCompilerWarning = 0;
|
||||||
|
wxASSERT(avoidCompilerWarning); // DBG:: item should be present
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNode* GarbageCollector::FindReferenceFreeItemNode()
|
||||||
|
{
|
||||||
|
wxNode* pNode = mAllNodes.First();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
if ( node_to_item( pNode ).mRefs.Number() == 0 )
|
||||||
|
|
||||||
|
return pNode;
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GarbageCollector::RemoveReferencesToNode( wxNode* pItemNode )
|
||||||
|
{
|
||||||
|
wxNode* pNode = mAllNodes.First();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
wxList& refLst = node_to_item( pNode ).mRefs;
|
||||||
|
wxNode* pRefNode = refLst.First();
|
||||||
|
|
||||||
|
while( pRefNode )
|
||||||
|
{
|
||||||
|
if ( pRefNode->Data() == (wxObject*)pItemNode )
|
||||||
|
{
|
||||||
|
wxNode* pNext = pRefNode->Next();
|
||||||
|
|
||||||
|
refLst.DeleteNode( pRefNode );
|
||||||
|
|
||||||
|
pRefNode = pNext;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else pRefNode = pRefNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GarbageCollector::ResolveReferences()
|
||||||
|
{
|
||||||
|
wxNode* pNode = mAllNodes.First();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
GCItem& item = node_to_item( pNode );
|
||||||
|
|
||||||
|
wxNode* pRefNode = item.mRefs.First();
|
||||||
|
|
||||||
|
while( pRefNode )
|
||||||
|
{
|
||||||
|
pRefNode->SetData( (wxObject*) FindItemNode( (void*)pRefNode->Data() ) );
|
||||||
|
|
||||||
|
pRefNode = pRefNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GarbageCollector::AddObject( void* pObj, int refCnt )
|
||||||
|
{
|
||||||
|
// FOR NOW:: initial ref-count is not used
|
||||||
|
|
||||||
|
GCItem* pItem = new GCItem();
|
||||||
|
|
||||||
|
pItem->mpObj = pObj;
|
||||||
|
|
||||||
|
mAllNodes.Append( (wxObject*) pItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
void GarbageCollector::AddDependency( void* pObj, void* pDependsOnObj )
|
||||||
|
{
|
||||||
|
node_to_item( FindItemNode( pObj ) ).mRefs.Append( (wxObject*)pDependsOnObj );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** GC alg. implementation ***/
|
||||||
|
|
||||||
|
void GarbageCollector::ArrangeCollection()
|
||||||
|
{
|
||||||
|
ResolveReferences();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
// find node, which does not depend on anything
|
||||||
|
|
||||||
|
wxNode* pItemNode = FindReferenceFreeItemNode();
|
||||||
|
|
||||||
|
if ( pItemNode )
|
||||||
|
{
|
||||||
|
// append it to the list, where items are contained
|
||||||
|
// in the increasing order of dependencies
|
||||||
|
|
||||||
|
mRegularLst.Append( pItemNode->Data() );
|
||||||
|
|
||||||
|
mAllNodes.DeleteNode( pItemNode );
|
||||||
|
|
||||||
|
// remove references to this current "least-dependent" node
|
||||||
|
// from reference lists of all the other nodes
|
||||||
|
|
||||||
|
RemoveReferencesToNode( pItemNode );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// otherwise, what is left - all nodes, which
|
||||||
|
// are involved into cycled chains (rings)
|
||||||
|
|
||||||
|
wxNode* pNode = mAllNodes.First();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
mCycledLst.Append( pNode->Data() );
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// continue search for "least-dependent" nodes
|
||||||
|
|
||||||
|
} while(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxList& GarbageCollector::GetRegularObjects()
|
||||||
|
{
|
||||||
|
return mRegularLst;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxList& GarbageCollector::GetCycledObjects()
|
||||||
|
{
|
||||||
|
return mCycledLst;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GarbageCollector::Reset()
|
||||||
|
{
|
||||||
|
DestroyItemList( mAllNodes );
|
||||||
|
|
||||||
|
mRegularLst.Clear();
|
||||||
|
mCycledLst.Clear();
|
||||||
|
}
|
||||||
|
|
409
contrib/src/fl/gcupdatesmgr.cpp
Normal file
@@ -0,0 +1,409 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 19/10/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "gcupdatesmgr.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/gcupdatesmgr.h"
|
||||||
|
|
||||||
|
// helper function
|
||||||
|
|
||||||
|
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 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// helper structure
|
||||||
|
|
||||||
|
struct cbRectInfo
|
||||||
|
{
|
||||||
|
cbBarInfo* mpBar;
|
||||||
|
cbDockPane* mpPane;
|
||||||
|
wxRect* mpCurBounds;
|
||||||
|
wxRect* mpPrevBounds;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline cbRectInfo& node_to_rect_info( wxNode* pNode )
|
||||||
|
{
|
||||||
|
return *( (cbRectInfo*) (pNode->Data()) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Implementation for class cbSimpleUpdatesMgr *****/
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS( cbGCUpdatesMgr, cbSimpleUpdatesMgr )
|
||||||
|
|
||||||
|
cbGCUpdatesMgr::cbGCUpdatesMgr( wxFrameLayout* pPanel )
|
||||||
|
: cbSimpleUpdatesMgr( pPanel )
|
||||||
|
{}
|
||||||
|
|
||||||
|
void cbGCUpdatesMgr::AddItem( wxList& itemList,
|
||||||
|
cbBarInfo* pBar,
|
||||||
|
cbDockPane* pPane,
|
||||||
|
wxRect& curBounds,
|
||||||
|
wxRect& prevBounds )
|
||||||
|
{
|
||||||
|
cbRectInfo* pInfo = new cbRectInfo();
|
||||||
|
|
||||||
|
pInfo->mpBar = pBar;
|
||||||
|
pInfo->mpPane = pPane;
|
||||||
|
pInfo->mpCurBounds = &curBounds;
|
||||||
|
pInfo->mpPrevBounds = &prevBounds;
|
||||||
|
|
||||||
|
itemList.Append( (wxObject*) pInfo );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbGCUpdatesMgr::OnStartChanges()
|
||||||
|
{
|
||||||
|
// memorize states of ALL items in the layout -
|
||||||
|
// this is quite excessive, but OK for the decent
|
||||||
|
// implementation of updates manager
|
||||||
|
|
||||||
|
mpLayout->GetPrevClientRect() = mpLayout->GetClientRect();
|
||||||
|
|
||||||
|
cbDockPane** panes = mpLayout->GetPanesArray();
|
||||||
|
|
||||||
|
for( int n = 0; n != MAX_PANES; ++n )
|
||||||
|
{
|
||||||
|
cbDockPane& pane = *(panes[n]);
|
||||||
|
|
||||||
|
// store pane state
|
||||||
|
pane.mUMgrData.StoreItemState( pane.mBoundsInParent );
|
||||||
|
pane.mUMgrData.SetDirty( FALSE );
|
||||||
|
|
||||||
|
cbRowInfo* pRow = pane.GetFirstRow();
|
||||||
|
|
||||||
|
while ( pRow )
|
||||||
|
{
|
||||||
|
cbBarInfo* pBar = pRow->GetFirstBar();
|
||||||
|
|
||||||
|
// store row state
|
||||||
|
pRow->mUMgrData.StoreItemState( pRow->mBoundsInParent );
|
||||||
|
pRow->mUMgrData.SetDirty( FALSE );
|
||||||
|
|
||||||
|
while( pBar )
|
||||||
|
{
|
||||||
|
// store bar state
|
||||||
|
pBar->mUMgrData.StoreItemState( pBar->mBoundsInParent );
|
||||||
|
pBar->mUMgrData.SetDirty( FALSE );
|
||||||
|
|
||||||
|
pBar = pBar->mpNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
pRow = pRow->mpNext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbGCUpdatesMgr::UpdateNow()
|
||||||
|
{
|
||||||
|
cbDockPane** panes = mpLayout->GetPanesArray();
|
||||||
|
|
||||||
|
wxRect& r1 = mpLayout->GetClientRect();
|
||||||
|
wxRect& r2 = mpLayout->GetPrevClientRect();
|
||||||
|
|
||||||
|
// detect changes in client window's area
|
||||||
|
|
||||||
|
bool clientWindowChanged = ( r1.x != r2.x ||
|
||||||
|
r1.y != r2.y ||
|
||||||
|
r1.width != r2.width ||
|
||||||
|
r1.height != r2.height );
|
||||||
|
|
||||||
|
// step #1 - detect changes in each row of each pane,
|
||||||
|
// and repaint decorations around changed windows
|
||||||
|
|
||||||
|
wxList mBarsToResize;
|
||||||
|
|
||||||
|
for( int n = 0; n != MAX_PANES; ++n )
|
||||||
|
{
|
||||||
|
cbDockPane& pane = *(panes[n]);
|
||||||
|
|
||||||
|
bool paneChanged = WasChanged( pane.mUMgrData, pane.mBoundsInParent );
|
||||||
|
|
||||||
|
if ( paneChanged )
|
||||||
|
{
|
||||||
|
wxClientDC dc( &mpLayout->GetParentFrame() );
|
||||||
|
pane.PaintPaneBackground( dc );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxRect realBounds;
|
||||||
|
|
||||||
|
cbRowInfo* pRow = pane.GetFirstRow();
|
||||||
|
|
||||||
|
while ( pRow )
|
||||||
|
{
|
||||||
|
wxDC* pDc = 0;
|
||||||
|
|
||||||
|
cbBarInfo* pBar = pRow->GetFirstBar();
|
||||||
|
|
||||||
|
bool rowChanged = FALSE;
|
||||||
|
bool rowBkPainted = FALSE;
|
||||||
|
|
||||||
|
// FIXME:: the below should not be fixed
|
||||||
|
cbBarInfo* barsToRepaint[128];
|
||||||
|
// number of bars, that were changed in the current row
|
||||||
|
int nBars = 0;
|
||||||
|
|
||||||
|
wxRect r1 = pRow->mUMgrData.mPrevBounds;
|
||||||
|
wxRect r2 = pRow->mBoundsInParent;
|
||||||
|
|
||||||
|
if ( WasChanged( pRow->mUMgrData, pRow->mBoundsInParent ) )
|
||||||
|
|
||||||
|
rowChanged = TRUE;
|
||||||
|
else
|
||||||
|
while( pBar )
|
||||||
|
{
|
||||||
|
if ( WasChanged( pBar->mUMgrData, pBar->mBoundsInParent ) )
|
||||||
|
|
||||||
|
barsToRepaint[nBars++] = pBar;
|
||||||
|
|
||||||
|
pBar = pBar->mpNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( nBars || rowChanged )
|
||||||
|
{
|
||||||
|
realBounds = pRow->mBoundsInParent;
|
||||||
|
|
||||||
|
// include 1-pixel thick shades around the row
|
||||||
|
realBounds.x -= 1;
|
||||||
|
realBounds.y -= 1;
|
||||||
|
realBounds.width += 2;
|
||||||
|
realBounds.height += 2;
|
||||||
|
|
||||||
|
pDc = pane.StartDrawInArea( realBounds );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( rowChanged )
|
||||||
|
{
|
||||||
|
// postphone the resizement and refreshing the changed
|
||||||
|
// bar windows
|
||||||
|
|
||||||
|
cbBarInfo* pCurBar = pRow->GetFirstBar();
|
||||||
|
|
||||||
|
while( pCurBar )
|
||||||
|
{
|
||||||
|
if ( WasChanged( pCurBar->mUMgrData,
|
||||||
|
pCurBar->mBoundsInParent ) )
|
||||||
|
|
||||||
|
AddItem( mBarsToResize, pCurBar, &pane,
|
||||||
|
pCurBar->mBoundsInParent,
|
||||||
|
pCurBar->mUMgrData.mPrevBounds );
|
||||||
|
|
||||||
|
pCurBar = pCurBar->mpNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw only their decorations now
|
||||||
|
|
||||||
|
pane.PaintRow( pRow, *pDc );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ( nBars != 0 )
|
||||||
|
{
|
||||||
|
for( int i = 0; i != nBars; ++i )
|
||||||
|
|
||||||
|
// postphone the resizement and refreshing the changed
|
||||||
|
// bar windows
|
||||||
|
|
||||||
|
AddItem( mBarsToResize,
|
||||||
|
barsToRepaint[i],
|
||||||
|
&pane,
|
||||||
|
barsToRepaint[i]->mBoundsInParent,
|
||||||
|
barsToRepaint[i]->mUMgrData.mPrevBounds );
|
||||||
|
|
||||||
|
// redraw decorations of entire row, regardless of how much
|
||||||
|
// of the bars were changed
|
||||||
|
|
||||||
|
pane.PaintRow( pRow, *pDc );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pDc )
|
||||||
|
|
||||||
|
pane.FinishDrawInArea( realBounds );
|
||||||
|
|
||||||
|
pRow = pRow->mpNext;
|
||||||
|
|
||||||
|
} // end of while
|
||||||
|
|
||||||
|
if ( paneChanged )
|
||||||
|
{
|
||||||
|
wxClientDC dc( &mpLayout->GetParentFrame() );
|
||||||
|
pane.PaintPaneDecorations( dc );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end of for
|
||||||
|
|
||||||
|
if ( clientWindowChanged && !mpLayout->mClientWndRefreshPending )
|
||||||
|
{
|
||||||
|
// ptr to client-window object is "marked" as NULL
|
||||||
|
|
||||||
|
AddItem( mBarsToResize, NULL, NULL,
|
||||||
|
mpLayout->GetClientRect(),
|
||||||
|
mpLayout->GetPrevClientRect() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// step #2 - do ordered refreshing and resizing of bar window objects now
|
||||||
|
|
||||||
|
DoRepositionItems( mBarsToResize );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbGCUpdatesMgr::DoRepositionItems( wxList& items )
|
||||||
|
{
|
||||||
|
wxNode* pNode1 = items.First();
|
||||||
|
|
||||||
|
while( pNode1 )
|
||||||
|
{
|
||||||
|
cbRectInfo& info = node_to_rect_info( pNode1 );
|
||||||
|
|
||||||
|
wxNode* pNode2 = items.First();
|
||||||
|
|
||||||
|
// and node itself
|
||||||
|
|
||||||
|
mGC.AddObject( &info );
|
||||||
|
|
||||||
|
while( pNode2 )
|
||||||
|
{
|
||||||
|
if ( pNode2 != pNode1 ) // node should not depend on itself
|
||||||
|
{
|
||||||
|
// add references to objects, on which this object
|
||||||
|
// depends. Dependecy here indicates intersection of current
|
||||||
|
// bounds of this object with the initial bounds of the
|
||||||
|
// other object
|
||||||
|
|
||||||
|
cbRectInfo& otherInfo = node_to_rect_info( pNode2 );
|
||||||
|
|
||||||
|
if ( rect_hits_rect( *info.mpCurBounds, *otherInfo.mpPrevBounds ) )
|
||||||
|
|
||||||
|
// the node depends on node
|
||||||
|
mGC.AddDependency( &info, &otherInfo );
|
||||||
|
}
|
||||||
|
|
||||||
|
pNode2 = pNode2->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
pNode1 = pNode1->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
mGC.ArrangeCollection(); // order nodes according "least-dependency" rule,
|
||||||
|
// and find out cycled chains
|
||||||
|
|
||||||
|
// regular item nodes need to be resized, but not repainted (since
|
||||||
|
// they stand in linear (not cyclic) dependency with other
|
||||||
|
// regular nodes)
|
||||||
|
|
||||||
|
wxNode* pNode = mGC.GetRegularObjects().First();
|
||||||
|
|
||||||
|
while ( pNode )
|
||||||
|
{
|
||||||
|
cbRectInfo& info = *((cbRectInfo*)gc_node_to_obj(pNode));
|
||||||
|
|
||||||
|
if ( info.mpBar == NULL )
|
||||||
|
|
||||||
|
mpLayout->PositionClientWindow();
|
||||||
|
else
|
||||||
|
info.mpPane->SizeBar( info.mpBar );
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
// cycled item nodes, need to be both resized and repainted
|
||||||
|
|
||||||
|
pNode = mGC.GetCycledObjects().First();
|
||||||
|
|
||||||
|
while ( pNode )
|
||||||
|
{
|
||||||
|
cbRectInfo& info = *((cbRectInfo*)gc_node_to_obj(pNode));
|
||||||
|
|
||||||
|
if ( info.mpBar == NULL )
|
||||||
|
{
|
||||||
|
wxWindow* pClntWnd = mpLayout->GetFrameClient();
|
||||||
|
|
||||||
|
mpLayout->PositionClientWindow();
|
||||||
|
|
||||||
|
// FIXME FIXME:: excessive!
|
||||||
|
|
||||||
|
pClntWnd->Show( FALSE );
|
||||||
|
pClntWnd->Show( TRUE );
|
||||||
|
|
||||||
|
// OLD STUFF:: mpLayout->PositionClientWindow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ( info.mpBar->mpBarWnd )
|
||||||
|
{
|
||||||
|
wxWindow* pWnd = info.mpBar->mpBarWnd;
|
||||||
|
|
||||||
|
// resize
|
||||||
|
info.mpPane->SizeBar( info.mpBar );
|
||||||
|
|
||||||
|
// repaint
|
||||||
|
|
||||||
|
/* OLD STUFF:: bool isChoice = info.mpBar->IsKindOf( CLASSINFO( wxChoice ) );
|
||||||
|
|
||||||
|
//#ifdef __WINDOWS__
|
||||||
|
//int result = ::SendMessage( (HWND)pWnd->m_hWnd, WM_NCPAINT, 0, 0 );
|
||||||
|
//#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 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->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
// release data prepared for GC alg.
|
||||||
|
|
||||||
|
pNode = items.First();
|
||||||
|
|
||||||
|
while( pNode )
|
||||||
|
{
|
||||||
|
cbRectInfo* pInfo = (cbRectInfo*)(pNode->Data());
|
||||||
|
|
||||||
|
delete pInfo;
|
||||||
|
|
||||||
|
pNode = pNode->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
mGC.Reset(); // reinit GC
|
||||||
|
|
||||||
|
// FIXME:: this is a dirty-workaround for messy client-area,
|
||||||
|
// as a result of docking bar out of floated-container window
|
||||||
|
|
||||||
|
if ( mpLayout->mClientWndRefreshPending )
|
||||||
|
{
|
||||||
|
mpLayout->PositionClientWindow();
|
||||||
|
mpLayout->GetFrameClient()->Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
397
contrib/src/fl/hintanimpl.cpp
Normal file
@@ -0,0 +1,397 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: No names yet.
|
||||||
|
// Purpose: Contrib. demo
|
||||||
|
// Author: Aleksandras Gluchovas
|
||||||
|
// Modified by:
|
||||||
|
// Created: 9/11/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Aleksandras Gluchovas
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "hintanimpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/fl/hintanimpl.h"
|
||||||
|
|
||||||
|
#define POS_UNDEFINED -32768
|
||||||
|
|
||||||
|
/***** Implementation for class cbHintAnimationPlugin *****/
|
||||||
|
|
||||||
|
// FIXME:: some of the below code should be eliminated by
|
||||||
|
// reusing parts of cbBarDragPlugin's implementation
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS( cbHintAnimationPlugin, cbPluginBase )
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( cbHintAnimationPlugin, cbPluginBase )
|
||||||
|
|
||||||
|
EVT_PL_DRAW_HINT_RECT( cbHintAnimationPlugin::OnDrawHintRect )
|
||||||
|
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
cbHintAnimationPlugin::cbHintAnimationPlugin(void)
|
||||||
|
|
||||||
|
: mpScrDc( NULL ),
|
||||||
|
mpAnimTimer( 0 ),
|
||||||
|
mAnimStarted( FALSE ),
|
||||||
|
|
||||||
|
mMorphDelay ( 5 ),
|
||||||
|
mMaxFrames ( 20 ),
|
||||||
|
mInClientHintBorder( 4 ),
|
||||||
|
mAccelerationOn( TRUE )
|
||||||
|
{}
|
||||||
|
|
||||||
|
cbHintAnimationPlugin::cbHintAnimationPlugin( wxFrameLayout* pPanel, int paneMask )
|
||||||
|
|
||||||
|
: cbPluginBase( pPanel, paneMask ),
|
||||||
|
mpScrDc( NULL ),
|
||||||
|
mpAnimTimer( 0 ),
|
||||||
|
mAnimStarted( FALSE ),
|
||||||
|
|
||||||
|
mMorphDelay ( 5 ),
|
||||||
|
mMaxFrames ( 20 ),
|
||||||
|
mInClientHintBorder( 4 ),
|
||||||
|
mAccelerationOn( TRUE )
|
||||||
|
{}
|
||||||
|
|
||||||
|
cbHintAnimationPlugin::~cbHintAnimationPlugin()
|
||||||
|
{
|
||||||
|
if ( mpScrDc ) delete mpScrDc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** rect-tracking related methods ***/
|
||||||
|
|
||||||
|
void cbHintAnimationPlugin::OnDrawHintRect( cbDrawHintRectEvent& event )
|
||||||
|
{
|
||||||
|
if ( !mAnimStarted && !mpScrDc )
|
||||||
|
{
|
||||||
|
StartTracking();
|
||||||
|
|
||||||
|
mPrevInClient = event.mIsInClient;
|
||||||
|
|
||||||
|
mPrevRect = event.mRect;
|
||||||
|
|
||||||
|
mStopPending = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !event.mEraseRect )
|
||||||
|
{
|
||||||
|
// pass on current hint-rect info to the animation "thread", in
|
||||||
|
// order to make adjustments to the morph-target on-the-fly
|
||||||
|
|
||||||
|
mCurRect.x = event.mRect.x;
|
||||||
|
mCurRect.y = event.mRect.y;
|
||||||
|
mCurRect.width = event.mRect.width;
|
||||||
|
mCurRect.height = event.mRect.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the amount of change in the shape of hint,
|
||||||
|
// and start morph-effect if change is "sufficient"
|
||||||
|
|
||||||
|
int change = abs( mCurRect.width - mPrevRect.width ) +
|
||||||
|
abs( mCurRect.height - mPrevRect.height );
|
||||||
|
|
||||||
|
if ( change > 10 && !event.mLastTime && !event.mEraseRect )
|
||||||
|
{
|
||||||
|
if ( !mpAnimTimer )
|
||||||
|
|
||||||
|
mpAnimTimer = new cbHintAnimTimer();
|
||||||
|
|
||||||
|
// init the animation "thread", or reinit if already started
|
||||||
|
|
||||||
|
mpAnimTimer->Init( this, mAnimStarted );
|
||||||
|
|
||||||
|
mAnimStarted = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ( !mAnimStarted )
|
||||||
|
{
|
||||||
|
DoDrawHintRect( event.mRect, event.mIsInClient );
|
||||||
|
|
||||||
|
if ( event.mLastTime )
|
||||||
|
|
||||||
|
FinishTracking();
|
||||||
|
|
||||||
|
mPrevInClient = event.mIsInClient;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCurInClient = event.mIsInClient;
|
||||||
|
|
||||||
|
if ( event.mLastTime && mpAnimTimer )
|
||||||
|
{
|
||||||
|
mStopPending = TRUE;
|
||||||
|
|
||||||
|
if ( mpAnimTimer->mPrevMorphed.x != POS_UNDEFINED )
|
||||||
|
|
||||||
|
// erase previous rect
|
||||||
|
DoDrawHintRect( mpAnimTimer->mPrevMorphed, mPrevInClient );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mPrevRect = event.mRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _IMG_A 0xAA // Note: modified from _A to _IMG_A, _A was already defined (cygwin)
|
||||||
|
#define _IMG_B 0x00 // Note: modified from _B to _IMG_A, _B was already defined (cygwin)
|
||||||
|
#define _IMG_C 0x55 // Note: modified from _C to _IMG_C, for consistency reasons.
|
||||||
|
#define _IMG_D 0x00 // Note: modified from _D to _IMG_D, for consistency reasons.
|
||||||
|
|
||||||
|
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
|
||||||
|
};
|
||||||
|
|
||||||
|
void cbHintAnimationPlugin::StartTracking()
|
||||||
|
{
|
||||||
|
mpScrDc = new wxScreenDC;
|
||||||
|
|
||||||
|
wxScreenDC::StartDrawingOnTop(&mpLayout->GetParentFrame());
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbHintAnimationPlugin::DoDrawHintRect( wxRect& rect, bool isInClientRect)
|
||||||
|
{
|
||||||
|
wxRect scrRect;
|
||||||
|
|
||||||
|
RectToScr( rect, scrRect );
|
||||||
|
|
||||||
|
int prevLF = mpScrDc->GetLogicalFunction();
|
||||||
|
|
||||||
|
mpScrDc->SetLogicalFunction( wxXOR );
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
wxBrush checkerBrush( checker );
|
||||||
|
|
||||||
|
mpScrDc->SetPen( mpLayout->mNullPen );
|
||||||
|
mpScrDc->SetBrush( checkerBrush );
|
||||||
|
|
||||||
|
int half = mInClientHintBorder / 2;
|
||||||
|
|
||||||
|
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 + 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
|
||||||
|
{
|
||||||
|
// otherwise draw 1-pixel thin borders
|
||||||
|
|
||||||
|
mpScrDc->SetPen( mpLayout->mBlackPen );
|
||||||
|
|
||||||
|
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+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->SetLogicalFunction( prevLF );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbHintAnimationPlugin::DrawHintRect ( wxRect& rect, bool isInClientRect)
|
||||||
|
{
|
||||||
|
DoDrawHintRect( rect, isInClientRect );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbHintAnimationPlugin::EraseHintRect( wxRect& rect, bool isInClientRect)
|
||||||
|
{
|
||||||
|
DoDrawHintRect( rect, isInClientRect );
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbHintAnimationPlugin::FinishTracking()
|
||||||
|
{
|
||||||
|
wxScreenDC::EndDrawingOnTop();
|
||||||
|
|
||||||
|
delete mpScrDc;
|
||||||
|
|
||||||
|
mpScrDc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbHintAnimationPlugin::RectToScr( wxRect& frameRect, wxRect& scrRect )
|
||||||
|
{
|
||||||
|
scrRect = frameRect;
|
||||||
|
|
||||||
|
int x = frameRect.x, y = frameRect.y;
|
||||||
|
|
||||||
|
mpLayout->GetParentFrame().ClientToScreen( &x, &y );
|
||||||
|
|
||||||
|
scrRect.x = x;
|
||||||
|
scrRect.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Implementation for class cbHintAnimTimer *****/
|
||||||
|
|
||||||
|
cbHintAnimTimer::cbHintAnimTimer(void)
|
||||||
|
{
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
mLock = 0L;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mPrevMorphed.x = POS_UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbHintAnimTimer::MorphPoint( wxPoint& origin, MorphInfoT& info, wxPoint& point )
|
||||||
|
{
|
||||||
|
// simulate lienar movement (FOR NOW:: without acceleration)
|
||||||
|
|
||||||
|
double k;
|
||||||
|
|
||||||
|
if ( mpPl->mAccelerationOn )
|
||||||
|
|
||||||
|
k = double( mCurIter*mCurIter ) /
|
||||||
|
double( (mpPl->mMaxFrames - 1)*(mpPl->mMaxFrames - 1) );
|
||||||
|
else
|
||||||
|
k = double( mCurIter ) / double( mpPl->mMaxFrames - 1 );
|
||||||
|
|
||||||
|
point.x = int ( double ( info.mFrom.x + double (info.mTill.x - info.mFrom.x) * k ) );
|
||||||
|
|
||||||
|
point.y = int ( double ( info.mFrom.y + double (info.mTill.y - info.mFrom.y) * k ) );
|
||||||
|
|
||||||
|
point.x += origin.x;
|
||||||
|
point.y += origin.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbHintAnimTimer::Notify(void)
|
||||||
|
{
|
||||||
|
// FIXME:: "clean" implementation should use mutex to sync
|
||||||
|
// between GUI and animation threads
|
||||||
|
|
||||||
|
if ( mpPl->mStopPending )
|
||||||
|
{
|
||||||
|
Stop(); // top timer
|
||||||
|
|
||||||
|
mpPl->FinishTracking();
|
||||||
|
|
||||||
|
mpPl->mStopPending = FALSE;
|
||||||
|
mpPl->mpAnimTimer = NULL;
|
||||||
|
mpPl->mAnimStarted = FALSE;
|
||||||
|
|
||||||
|
mPrevMorphed.x = POS_UNDEFINED;
|
||||||
|
|
||||||
|
delete this;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxPoint origin( mpPl->mCurRect.x, mpPl->mCurRect.y );
|
||||||
|
|
||||||
|
wxPoint curUpper, curLower;
|
||||||
|
|
||||||
|
MorphPoint( origin, mUpperLeft, curUpper );
|
||||||
|
MorphPoint( origin, mLowerRight, curLower );
|
||||||
|
|
||||||
|
if ( mPrevMorphed.x != POS_UNDEFINED )
|
||||||
|
|
||||||
|
// erase previous rect
|
||||||
|
mpPl->DoDrawHintRect( mPrevMorphed, mpPl->mPrevInClient );
|
||||||
|
|
||||||
|
wxRect morphed( curUpper.x, curUpper.y,
|
||||||
|
curLower.x - curUpper.x,
|
||||||
|
curLower.y - curUpper.y );
|
||||||
|
|
||||||
|
// draw rect of current iteration
|
||||||
|
mpPl->DoDrawHintRect( morphed,
|
||||||
|
( mCurIter != mpPl->mMaxFrames - 1 )
|
||||||
|
? mpPl->mPrevInClient : mpPl->mCurInClient );
|
||||||
|
|
||||||
|
mPrevMorphed = morphed;
|
||||||
|
|
||||||
|
if ( mCurIter == mpPl->mMaxFrames - 1 )
|
||||||
|
{
|
||||||
|
Stop(); // top timer
|
||||||
|
|
||||||
|
mpPl->FinishTracking();
|
||||||
|
mpPl->mpAnimTimer = NULL;
|
||||||
|
mpPl->mAnimStarted = FALSE;
|
||||||
|
|
||||||
|
mPrevMorphed.x = POS_UNDEFINED;
|
||||||
|
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
++mCurIter;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cbHintAnimTimer::Init( cbHintAnimationPlugin* pAnimPl, bool reinit )
|
||||||
|
{
|
||||||
|
|
||||||
|
mpPl = pAnimPl;
|
||||||
|
|
||||||
|
// morph-points are set up relatively to the upper-left corner
|
||||||
|
// of the current hint-rectangle
|
||||||
|
|
||||||
|
if ( !reinit )
|
||||||
|
{
|
||||||
|
mUpperLeft.mFrom.x = mpPl->mPrevRect.x - mpPl->mCurRect.x;
|
||||||
|
mUpperLeft.mFrom.y = mpPl->mPrevRect.y - mpPl->mCurRect.y;
|
||||||
|
|
||||||
|
mLowerRight.mFrom.x = ( mUpperLeft.mFrom.x + mpPl->mPrevRect.width );
|
||||||
|
mLowerRight.mFrom.y = ( mUpperLeft.mFrom.y + mpPl->mPrevRect.height );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxPoint origin( mpPl->mPrevRect.x, mpPl->mPrevRect.y );
|
||||||
|
|
||||||
|
wxPoint curUpper, curLower;
|
||||||
|
|
||||||
|
MorphPoint( origin, mUpperLeft, curUpper );
|
||||||
|
MorphPoint( origin, mLowerRight, curLower );
|
||||||
|
|
||||||
|
mUpperLeft.mFrom.x = curUpper.x - mpPl->mCurRect.x;
|
||||||
|
mUpperLeft.mFrom.y = curUpper.y - mpPl->mCurRect.y;
|
||||||
|
|
||||||
|
mLowerRight.mFrom.x = ( mUpperLeft.mFrom.x + curLower.x - curUpper.x );
|
||||||
|
mLowerRight.mFrom.y = ( mUpperLeft.mFrom.y + curLower.y - curUpper.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
mUpperLeft.mTill.x = 0;
|
||||||
|
mUpperLeft.mTill.y = 0;
|
||||||
|
|
||||||
|
mLowerRight.mTill.x = mpPl->mCurRect.width;
|
||||||
|
mLowerRight.mTill.y = mpPl->mCurRect.height;
|
||||||
|
|
||||||
|
mCurIter = 1;
|
||||||
|
|
||||||
|
if ( !reinit )
|
||||||
|
|
||||||
|
Start( mpPl->mMorphDelay );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|