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

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

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: antiflickpl.cpp
// Purpose: Double-buffering plugin class for reducing flickering.
// Author: Aleksandras Gluchovas (@Lithuania)
// Modified by:
// Created: 23/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -115,7 +115,7 @@ wxDC* cbAntiflickerPlugin::AllocNewBuffer( const wxRect& forArea )
// excessive realocations later
// check whether the given area is oriented horizontally
// or verticallya and choose correspoinding bitmap to create or
// or vertically and choose corresponding bitmap to create or
// recreate
if ( forArea.height > forArea.width )

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: bardragpl.cpp
// Purpose: cbBarDragPlugin implementation
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 23/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -293,8 +293,8 @@ void cbBarDragPlugin::StickToPane( cbDockPane* pPane, wxPoint& mousePos )
: 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
// that the mouse pointer doesn't overrun (leave) the hint-rectangle
// when its dimensions are recalculated upon sticking it to the pane
if ( pPane->IsHorizontal() && fromLowerEdge )
{
@@ -341,10 +341,9 @@ void cbBarDragPlugin::StickToPane( cbDockPane* pPane, wxPoint& mousePos )
void cbBarDragPlugin::UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos )
{
// unsticking causes rectangle to get the shape, in which
// 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;
@@ -471,7 +470,7 @@ void cbBarDragPlugin::ShowHint( bool prevWasInClient )
if ( mpSrcPane->mProps.mRealTimeUpdatesOn == FALSE )
{
// do hevy calculations first
// do heavy calculations first
wxRect actualRect = mHintRect; // will be adjusted depending on drag-settings

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: barhintspl.h
// Purpose: Implementation for cbBarHintsPlugin
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 30/11/98 (my 22th birthday :-)
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: cbcustom.cpp
// Purpose: cbSimpleCustomizationPlugin class declaration
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 06/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: controlbar.cpp
// Purpose: Implementation for main controlbar classes.
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 06/09/98
@@ -50,7 +50,6 @@
// meet the new event paradigm as of wx2.3.0. Probably we
// should find a way to make these be non-global, but this
// works for right now.
#if wxCHECK_VERSION(2,3,0)
wxEventType cbEVT_PL_LEFT_DOWN = wxNewEventType();
wxEventType cbEVT_PL_LEFT_UP = wxNewEventType();
wxEventType cbEVT_PL_RIGHT_DOWN = wxNewEventType();
@@ -85,7 +84,6 @@
wxEventType cbEVT_PL_CUSTOMIZE_LAYOUT = wxNewEventType();
wxEventType wxCUSTOM_CB_PLUGIN_EVENTS_START_AT = wxNewEventType();
#endif // #if wxCHECK_VERSION(2,3,0)
// some ascii-art, still can't get these *nice* cursors working on wx... :-(
@@ -347,7 +345,7 @@ wxFrameLayout::wxFrameLayout( wxWindow* pParentFrame, wxWindow* pFrameClient, bo
mFloatingOn = CanReparent();
}
// NOTE:: below are the only plaftorm-check "ifdef"s in the docking system!
// NOTE:: below are the only platform-check "ifdef"s in the docking system!
bool wxFrameLayout::CanReparent()
{
@@ -627,10 +625,10 @@ bool wxFrameLayout::RedockBar( cbBarInfo* pBar,
pBarPane->RemoveBar( pBar );
// FIXME FIXME:: the below recalc. may be a *huge* performance
// FIXME FIXME:: the recalculation below may be a *huge* performance
// hit, it could be eliminated though...
// but first the "pane-postion-changed" problem
// have to be fixed
// has to be fixed
RecalcLayout( FALSE );
@@ -710,8 +708,8 @@ void wxFrameLayout::SetBarState( cbBarInfo* pBar, int newState, bool updateNow )
if ( pBar->mState == wxCBAR_FLOATING && newState != wxCBAR_FLOATING )
{
// remove bar's window form the containing mini-frame
// and set it's parent to be layout's parent frame
// remove bar's window from the containing mini-frame
// and set its parent to be layout's parent frame
if ( pBar->mpBarWnd )
{
@@ -1176,15 +1174,15 @@ void wxFrameLayout::HideBarWindows()
void wxFrameLayout::UnhookFromFrame()
{
// NOTE:: the SetEvtHandlerEnabled() method is not used
// here, since it is assumed, that unhooking layout
// here, since it is assumed that unhooking layout
// from window may result destroying of the layout itself
//
// BUG BUG BUG (wx):: this would not be a problem if
// wxEvtHandler's destructor would check if
// wxEvtHandler's destructor checked if
// this handler is currently the top-most
// handler of some window, and additionally
// to the reconnecting itself from the chain
// it would also re-setup current event handler
// to the reconnecting itself from the chain.
// It would also re-setup current event handler
// of the window using wxWindow::SetEventHandler()
// FOR NOW::
@@ -2576,7 +2574,7 @@ void cbDockPane::CalcLengthRatios( cbRowInfo* pInRow )
size_t i = 0;
// clac current-maximal-total-length of all maximized bars
// calc current-maximal-total-length of all maximized bars
for ( i = 0; i != pInRow->mBars.GetCount(); ++i )
{
@@ -2586,7 +2584,7 @@ void cbDockPane::CalcLengthRatios( cbRowInfo* pInRow )
totalWidth += bar.mBounds.width;
}
// set up persentages of occupied space for each maximized bar
// set up percentages of occupied space for each maximized bar
for ( i = 0; i != pInRow->mBars.Count(); ++i )
{

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: dyntbar.cpp
// Purpose: wxDynamicToolBar implementation
// Author: Aleksandras Gluchovas
// Modified by:
// Created: ??/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -16,7 +16,6 @@
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
@@ -34,94 +33,94 @@ IMPLEMENT_DYNAMIC_CLASS(wxDynamicToolBar, wxControl )
BEGIN_EVENT_TABLE( wxDynamicToolBar, wxControl )
EVT_SIZE ( wxDynamicToolBar::OnSize )
EVT_PAINT( wxDynamicToolBar::OnPaint )
//EVT_ERASE_BACKGROUND( wxDynamicToolBar::OnEraseBackground )
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 )
: 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 )
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);
Create(parent, id, pos, size, style, orientation, RowsOrColumns, name);
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE) );
SetBackgroundColour( wxSystemSettings::GetColour( 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)
const wxPoint& pos,
const wxSize& size,
const long style,
const int orientation, const int RowsOrColumns,
const wxString& name)
{
// cut&pasted from wxtbatsmpl.h
// cut&pasted from wxtbatsmpl.h
if ( ! wxWindow::Create(parent, id, pos, size, style, name) )
return FALSE;
if ( ! wxWindow::Create(parent, id, pos, size, style, name) )
return FALSE;
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ));
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ));
return TRUE;
return TRUE;
}
bool wxDynamicToolBar::Realize(void)
{
// FOR NOW:: nothing
return TRUE;
// FOR NOW:: nothing
return TRUE;
}
wxDynamicToolBar::~wxDynamicToolBar(void)
{
if ( mpLayoutMan )
if ( mpLayoutMan )
delete mpLayoutMan;
size_t i;
for( i = 0; i != mTools.Count(); ++i )
for( i = 0; i != mTools.Count(); ++i )
{
delete mTools[i];
delete mTools[i];
}
}
void wxDynamicToolBar::AddTool( int toolIndex,
wxWindow* pToolWindow,
const wxSize& size
)
wxWindow* pToolWindow,
const wxSize& size
)
{
wxDynToolInfo* pInfo = new wxDynToolInfo();
wxDynToolInfo* pInfo = new wxDynToolInfo();
pInfo->mpToolWnd = pToolWindow;
pInfo->mIndex = toolIndex;
pInfo->mIsSeparator = FALSE;
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;
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 );
mTools.Add( pInfo );
}
void wxDynamicToolBar::AddTool( int toolIndex,
@@ -130,191 +129,191 @@ void wxDynamicToolBar::AddTool( int toolIndex,
const wxString& labelText, bool alignTextRight,
bool isFlat )
{
wxNewBitmapButton* pBtn =
wxNewBitmapButton* pBtn =
new wxNewBitmapButton( imageFileName, imageFileType,
labelText,
( alignTextRight )
? NB_ALIGN_TEXT_RIGHT
: NB_ALIGN_TEXT_BOTTOM,
isFlat
);
new wxNewBitmapButton( imageFileName, imageFileType,
labelText,
( alignTextRight )
? NB_ALIGN_TEXT_RIGHT
: NB_ALIGN_TEXT_BOTTOM,
isFlat
);
pBtn->Create( this, toolIndex );
pBtn->Create( this, toolIndex );
pBtn->Reshape();
AddTool( toolIndex, pBtn );
pBtn->Reshape();
AddTool( toolIndex, pBtn );
}
void wxDynamicToolBar::AddTool( int toolIndex, wxBitmap labelBmp,
const wxString& labelText, bool alignTextRight,
bool isFlat )
const wxString& labelText, bool alignTextRight,
bool isFlat )
{
wxNewBitmapButton* pBtn =
wxNewBitmapButton* pBtn =
new wxNewBitmapButton( labelBmp,
labelText,
( alignTextRight )
? NB_ALIGN_TEXT_RIGHT
: NB_ALIGN_TEXT_BOTTOM,
isFlat
);
new wxNewBitmapButton( labelBmp,
labelText,
( alignTextRight )
? NB_ALIGN_TEXT_RIGHT
: NB_ALIGN_TEXT_BOTTOM,
isFlat
);
pBtn->Create( this, toolIndex );
pBtn->Create( this, toolIndex );
pBtn->Reshape();
AddTool( toolIndex, pBtn );
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)
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 );
wxNewBitmapButton* pBmpBtn = new wxNewBitmapButton( bitmap );
pBmpBtn->Create( this, toolIndex );
pBmpBtn->Create( this, toolIndex );
pBmpBtn->Reshape();
pBmpBtn->Reshape();
AddTool( toolIndex, pBmpBtn );
AddTool( toolIndex, pBmpBtn );
return NULL;
return NULL;
}
wxDynToolInfo* wxDynamicToolBar::GetToolInfo( int toolIndex )
{
size_t i;
for( i = 0; i != mTools.Count(); ++i )
for( i = 0; i != mTools.Count(); ++i )
{
if ( mTools[i]->mIndex == toolIndex )
if ( mTools[i]->mIndex == toolIndex )
return mTools[i];
}
return NULL;
return NULL;
}
void wxDynamicToolBar::RemveTool( int toolIndex )
{
size_t i;
for( i = 0; i != mTools.Count(); ++i )
for( i = 0; i != mTools.Count(); ++i )
{
if ( mTools[i]->mIndex == toolIndex )
{
if ( mTools[i]->mpToolWnd )
{
mTools[i]->mpToolWnd->Destroy();
}
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);
mTools.RemoveAt(i);
#else
mTools.Remove(i);
mTools.Remove(i);
#endif
Layout();
Layout();
return;
}
return;
}
}
// TODO:: if not found, should it be an assertion?
// TODO:: if not found, should it be an assertion?
}
void wxDynamicToolBar::AddSeparator( wxWindow* pSepartorWnd )
{
wxDynToolInfo* pInfo = new wxDynToolInfo();
wxDynToolInfo* pInfo = new wxDynToolInfo();
pInfo->mpToolWnd = pSepartorWnd;
pInfo->mIndex = -1;
pInfo->mIsSeparator = TRUE;
pInfo->mpToolWnd = pSepartorWnd;
pInfo->mIndex = -1;
pInfo->mIsSeparator = TRUE;
if ( pSepartorWnd )
{
pSepartorWnd->Create( this, -1 );
if ( pSepartorWnd )
{
pSepartorWnd->Create( this, -1 );
int x,y;
pSepartorWnd->GetSize( &x, &y );
pInfo->mRealSize.x = x;
pInfo->mRealSize.y = y;
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 = x;
pInfo->mRect.height = y;
}
else
{
pInfo->mRealSize.x = mSepartorSize;
pInfo->mRealSize.y = 0;
pInfo->mRect.width = mSepartorSize;
pInfo->mRect.height = 0;
}
pInfo->mRect.width = mSepartorSize;
pInfo->mRect.height = 0;
}
mTools.Add( pInfo );
mTools.Add( pInfo );
}
void wxDynamicToolBar::OnEraseBackground( wxEraseEvent& event )
{
// FOR NOW:: nothing
// FOR NOW:: nothing
}
void wxDynamicToolBar::OnSize( wxSizeEvent& event )
{
//SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) );
//SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) );
Layout();
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;
// 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( *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( *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( *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 );
}
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
// draw separators if any
wxPaintDC dc(this);
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
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 )
if ( !mTools[i]->mpToolWnd )
DrawSeparator( *mTools[i], dc );
}
DrawSeparator( *mTools[i], dc );
}
}
// FOR NOW:: quick fix
@@ -323,174 +322,174 @@ void wxDynamicToolBar::OnPaint( wxPaintEvent& event )
void wxDynamicToolBar::SizeToolWindows()
{
size_t i;
for( i = 0; i != mTools.Count(); ++i )
{
wxDynToolInfo& info = *mTools[i];
for( i = 0; i != mTools.Count(); ++i )
{
wxDynToolInfo& info = *mTools[i];
if ( !info.mIsSeparator )
{
if ( !info.mIsSeparator )
{
// center real rectangle within the rectangle
// provided by the layout manager
// 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;
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 );
}
// 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
}
// TBD:: size separator window if present
}
}
bool wxDynamicToolBar::Layout()
{
if ( !mpLayoutMan )
mpLayoutMan = CreateDefaulLayout();
if ( !mpLayoutMan )
mpLayoutMan = CreateDefaultLayout();
int x,y;
GetSize( &x, &y );
wxSize wndDim(x,y);
wxSize result;
int x,y;
GetSize( &x, &y );
wxSize wndDim(x,y);
wxSize result;
wxLayoutItemArrayT items;
wxLayoutItemArrayT items;
// safe conversion
// safe conversion
size_t i;
for( i = 0; i != mTools.Count(); ++i )
for( i = 0; i != mTools.Count(); ++i )
items.Add( mTools[i] );
mpLayoutMan->Layout( wndDim, result, items, mVertGap, mHorizGap );;
mpLayoutMan->Layout( wndDim, result, items, mVertGap, mHorizGap );;
SizeToolWindows();
SizeToolWindows();
return TRUE;
}
void wxDynamicToolBar::GetPreferredDim( const wxSize& givenDim, wxSize& prefDim )
{
if ( !mpLayoutMan )
mpLayoutMan = CreateDefaulLayout();
if ( !mpLayoutMan )
mpLayoutMan = CreateDefaultLayout();
wxLayoutItemArrayT items;
wxLayoutItemArrayT items;
// safe conversion
// safe conversion
size_t i;
for( i = 0; i != mTools.Count(); ++i )
for( i = 0; i != mTools.Count(); ++i )
items.Add( mTools[i] );
mpLayoutMan->Layout( givenDim, prefDim, items, mVertGap, mHorizGap );;
mpLayoutMan->Layout( givenDim, prefDim, items, mVertGap, mHorizGap );;
}
void wxDynamicToolBar::SetLayout( LayoutManagerBase* pLayout )
{
if ( mpLayoutMan )
if ( mpLayoutMan )
delete mpLayoutMan;
mpLayoutMan = pLayout;
mpLayoutMan = pLayout;
Layout();
Layout();
}
void wxDynamicToolBar::EnableTool(const int toolIndex, const bool enable )
{
wxDynToolInfo* pInfo = GetToolInfo( toolIndex );
wxDynToolInfo* pInfo = GetToolInfo( toolIndex );
if ( !pInfo )
if ( !pInfo )
return;
if ( pInfo->mIsSeparator || !pInfo->mpToolWnd )
if ( pInfo->mIsSeparator || !pInfo->mpToolWnd )
return;
pInfo->mpToolWnd->Enable( enable );
pInfo->mpToolWnd->Enable( enable );
}
/***** Implementation for class BagLayout *****/
void BagLayout::Layout( const wxSize& parentDim,
wxSize& resultingDim,
wxLayoutItemArrayT& items,
int horizGap,
int vertGap
)
wxSize& resultingDim,
wxLayoutItemArrayT& items,
int horizGap,
int vertGap
)
{
int maxWidth = 0;
int curY = 0;
int nRows = 0;
int maxWidth = 0;
int curY = 0;
int nRows = 0;
size_t i = 0;
size_t i = 0;
while( i < items.Count() )
{
int curX = 0;
int height = 0;
// int nItems = 0;
while( i < items.Count() )
{
int curX = 0;
int height = 0;
// int nItems = 0;
// int firstItem = i;
int itemsInRow = 0;
// int firstItem = i;
int itemsInRow = 0;
if ( nRows > 0 )
if ( nRows > 0 )
curY += vertGap;
// step #1 - arrange horizontal positions of items in the row
// step #1 - arrange horizontal positions of items in the row
do
{
if ( itemsInRow > 0 )
do
{
if ( itemsInRow > 0 )
curX += horizGap;
wxRect& r = items[i]->mRect;
wxRect& r = items[i]->mRect;
if ( curX + r.width > parentDim.x )
if ( curX + r.width > parentDim.x )
{
if ( itemsInRow > 0 )
if ( itemsInRow > 0 )
break;
}
r.x = curX;
r.y = curY;
r.x = curX;
r.y = curY;
curX += r.width;
curX += r.width;
height = wxMax( height, r.height );
height = wxMax( height, r.height );
++itemsInRow;
++i;
++itemsInRow;
++i;
} while( i < items.Count() );
} while( i < items.Count() );
curY += height;
curY += height;
maxWidth = wxMax( maxWidth, curX );
}
maxWidth = wxMax( maxWidth, curX );
}
resultingDim.x = maxWidth;
resultingDim.y = curY;
resultingDim.x = maxWidth;
resultingDim.y = curY;
}
//////// stuff from 2.1.15 ///////////
wxToolBarToolBase* wxDynamicToolBar::FindToolForPosition( wxCoord x, wxCoord y ) const
{
return NULL;
return NULL;
}
bool wxDynamicToolBar::DoInsertTool( size_t pos, wxToolBarToolBase* tool )
{
return TRUE;
return TRUE;
}
bool wxDynamicToolBar::DoDeleteTool( size_t pos, wxToolBarToolBase* tool )
{
return TRUE;
return TRUE;
}
void wxDynamicToolBar::DoEnableTool( wxToolBarToolBase* tool, bool enable )
@@ -507,11 +506,11 @@ 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;
return NULL;
}
wxToolBarToolBase* wxDynamicToolBar::CreateTool( wxControl* control )
{
return NULL;
return NULL;
}

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: dyntbarhnd.cpp
// Purpose: cbDynToolBarDimHandler implementation.
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 23/01/99
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -20,30 +20,28 @@
#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
// nothing
}
void cbDynToolBarDimHandler::OnResizeBar( cbBarInfo* pBar,
const wxSize& given,
wxSize& preferred )
const wxSize& given,
wxSize& preferred )
{
wxASSERT( pBar->mpBarWnd ); // DBG:: should be present
wxASSERT( pBar->mpBarWnd ); // DBG:: should be present
wxDynamicToolBar* pTBar = (wxDynamicToolBar*)pBar->mpBarWnd;
wxDynamicToolBar* pTBar = (wxDynamicToolBar*)pBar->mpBarWnd;
pTBar->GetPreferredDim( given, preferred );
pTBar->GetPreferredDim( given, preferred );
}

View File

@@ -12,7 +12,6 @@ FL_OBJECTS = \
newbmpbtn.$(OBJ_EXT) \
updatesmgr.$(OBJ_EXT) \
cbcustom.$(OBJ_EXT) \
frmview.$(OBJ_EXT) \
panedrawpl.$(OBJ_EXT) \
controlbar.$(OBJ_EXT) \
garbagec.$(OBJ_EXT) \

View File

@@ -188,10 +188,6 @@ 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

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: frmview.cpp
// Purpose: wxFrameView implementation. NOT USED IN FL.
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 02/01/99
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: garbagec.cpp
// Purpose: Garbage collection algorithm for optimizing refresh.
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 18/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -32,193 +32,193 @@
inline static GCItem& node_to_item( wxNode* pNode )
{
return *( (GCItem*)(pNode->Data()) );
return *( (GCItem*)(pNode->Data()) );
}
GarbageCollector::~GarbageCollector()
{
Reset();
Reset();
}
/*** GC alg. helpers ***/
void GarbageCollector::DestroyItemList( wxList& lst )
{
wxNode* pNode = lst.First();
wxNode* pNode = lst.First();
while( pNode )
{
delete &node_to_item( pNode );
while( pNode )
{
delete &node_to_item( pNode );
pNode = pNode->Next();
}
pNode = pNode->Next();
}
lst.Clear();
lst.Clear();
}
wxNode* GarbageCollector::FindItemNode( void* pForObj )
{
wxNode* pNode = mAllNodes.First();
wxNode* pNode = mAllNodes.First();
while( pNode )
{
if ( node_to_item( pNode ).mpObj == pForObj )
while( pNode )
{
if ( node_to_item( pNode ).mpObj == pForObj )
return pNode;
return pNode;
pNode = pNode->Next();
}
pNode = pNode->Next();
}
int avoidCompilerWarning = 0;
wxASSERT(avoidCompilerWarning); // DBG:: item should be present
int avoidCompilerWarning = 0;
wxASSERT(avoidCompilerWarning); // DBG:: item should be present
return 0;
return 0;
}
wxNode* GarbageCollector::FindReferenceFreeItemNode()
{
wxNode* pNode = mAllNodes.First();
wxNode* pNode = mAllNodes.First();
while( pNode )
{
if ( node_to_item( pNode ).mRefs.Number() == 0 )
while( pNode )
{
if ( node_to_item( pNode ).mRefs.Number() == 0 )
return pNode;
return pNode;
pNode = pNode->Next();
}
pNode = pNode->Next();
}
return 0;
return 0;
}
void GarbageCollector::RemoveReferencesToNode( wxNode* pItemNode )
{
wxNode* pNode = mAllNodes.First();
wxNode* pNode = mAllNodes.First();
while( pNode )
{
wxList& refLst = node_to_item( pNode ).mRefs;
wxNode* pRefNode = refLst.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();
while( pRefNode )
{
if ( pRefNode->Data() == (wxObject*)pItemNode )
{
wxNode* pNext = pRefNode->Next();
refLst.DeleteNode( pRefNode );
refLst.DeleteNode( pRefNode );
pRefNode = pNext;
pRefNode = pNext;
continue;
}
else pRefNode = pRefNode->Next();
}
continue;
}
else pRefNode = pRefNode->Next();
}
pNode = pNode->Next();
}
pNode = pNode->Next();
}
}
void GarbageCollector::ResolveReferences()
{
wxNode* pNode = mAllNodes.First();
wxNode* pNode = mAllNodes.First();
while( pNode )
{
GCItem& item = node_to_item( pNode );
while( pNode )
{
GCItem& item = node_to_item( pNode );
wxNode* pRefNode = item.mRefs.First();
wxNode* pRefNode = item.mRefs.First();
while( pRefNode )
{
pRefNode->SetData( (wxObject*) FindItemNode( (void*)pRefNode->Data() ) );
while( pRefNode )
{
pRefNode->SetData( (wxObject*) FindItemNode( (void*)pRefNode->Data() ) );
pRefNode = pRefNode->Next();
}
pRefNode = pRefNode->Next();
}
pNode = pNode->Next();
}
pNode = pNode->Next();
}
}
void GarbageCollector::AddObject( void* pObj, int refCnt )
{
// FOR NOW:: initial ref-count is not used
// FOR NOW:: initial ref-count is not used
GCItem* pItem = new GCItem();
GCItem* pItem = new GCItem();
pItem->mpObj = pObj;
pItem->mpObj = pObj;
mAllNodes.Append( (wxObject*) pItem );
mAllNodes.Append( (wxObject*) pItem );
}
void GarbageCollector::AddDependency( void* pObj, void* pDependsOnObj )
{
node_to_item( FindItemNode( pObj ) ).mRefs.Append( (wxObject*)pDependsOnObj );
node_to_item( FindItemNode( pObj ) ).mRefs.Append( (wxObject*)pDependsOnObj );
}
/*** GC alg. implementation ***/
void GarbageCollector::ArrangeCollection()
{
ResolveReferences();
ResolveReferences();
do
{
// find node, which does not depend on anything
do
{
// find node, which does not depend on anything
wxNode* pItemNode = FindReferenceFreeItemNode();
wxNode* pItemNode = FindReferenceFreeItemNode();
if ( pItemNode )
{
// append it to the list, where items are contained
// in the increasing order of dependencies
if ( pItemNode )
{
// append it to the list, where items are contained
// in the increasing order of dependencies
mRegularLst.Append( pItemNode->Data() );
mRegularLst.Append( pItemNode->Data() );
mAllNodes.DeleteNode( pItemNode );
mAllNodes.DeleteNode( pItemNode );
// remove references to this current "least-dependent" node
// from reference lists of all the other nodes
// 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)
RemoveReferencesToNode( pItemNode );
}
else
{
// otherwise, what is left - all nodes, which
// are involved into cycled chains (rings)
wxNode* pNode = mAllNodes.First();
wxNode* pNode = mAllNodes.First();
while( pNode )
{
mCycledLst.Append( pNode->Data() );
while( pNode )
{
mCycledLst.Append( pNode->Data() );
pNode = pNode->Next();
}
pNode = pNode->Next();
}
break;
}
break;
}
// continue search for "least-dependent" nodes
// continue search for "least-dependent" nodes
} while(1);
} while(1);
}
wxList& GarbageCollector::GetRegularObjects()
{
return mRegularLst;
return mRegularLst;
}
wxList& GarbageCollector::GetCycledObjects()
{
return mCycledLst;
return mCycledLst;
}
void GarbageCollector::Reset()
{
DestroyItemList( mAllNodes );
DestroyItemList( mAllNodes );
mRegularLst.Clear();
mCycledLst.Clear();
mRegularLst.Clear();
mCycledLst.Clear();
}

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: gcupdatesmgr.cpp
// Purpose: cbGCUpdatesMgr class, optimizing refresh using GarbageCollector
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 19/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -30,30 +30,30 @@
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.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;
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;
return 0;
}
// helper structure
struct cbRectInfo
{
cbBarInfo* mpBar;
cbDockPane* mpPane;
wxRect* mpCurBounds;
wxRect* mpPrevBounds;
cbBarInfo* mpBar;
cbDockPane* mpPane;
wxRect* mpCurBounds;
wxRect* mpPrevBounds;
};
static inline cbRectInfo& node_to_rect_info( wxNode* pNode )
{
return *( (cbRectInfo*) (pNode->Data()) );
return *( (cbRectInfo*) (pNode->Data()) );
}
/***** Implementation for class cbSimpleUpdatesMgr *****/
@@ -61,350 +61,350 @@ static inline cbRectInfo& node_to_rect_info( wxNode* pNode )
IMPLEMENT_DYNAMIC_CLASS( cbGCUpdatesMgr, cbSimpleUpdatesMgr )
cbGCUpdatesMgr::cbGCUpdatesMgr( wxFrameLayout* pPanel )
: cbSimpleUpdatesMgr( pPanel )
: cbSimpleUpdatesMgr( pPanel )
{}
void cbGCUpdatesMgr::AddItem( wxList& itemList,
cbBarInfo* pBar,
cbDockPane* pPane,
wxRect& curBounds,
wxRect& prevBounds )
cbBarInfo* pBar,
cbDockPane* pPane,
wxRect& curBounds,
wxRect& prevBounds )
{
cbRectInfo* pInfo = new cbRectInfo();
cbRectInfo* pInfo = new cbRectInfo();
pInfo->mpBar = pBar;
pInfo->mpPane = pPane;
pInfo->mpCurBounds = &curBounds;
pInfo->mpPrevBounds = &prevBounds;
pInfo->mpBar = pBar;
pInfo->mpPane = pPane;
pInfo->mpCurBounds = &curBounds;
pInfo->mpPrevBounds = &prevBounds;
itemList.Append( (wxObject*) pInfo );
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
// 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();
mpLayout->GetPrevClientRect() = mpLayout->GetClientRect();
cbDockPane** panes = mpLayout->GetPanesArray();
cbDockPane** panes = mpLayout->GetPanesArray();
for( int n = 0; n != MAX_PANES; ++n )
{
cbDockPane& pane = *(panes[n]);
for( int n = 0; n != MAX_PANES; ++n )
{
cbDockPane& pane = *(panes[n]);
// store pane state
pane.mUMgrData.StoreItemState( pane.mBoundsInParent );
pane.mUMgrData.SetDirty( FALSE );
// store pane state
pane.mUMgrData.StoreItemState( pane.mBoundsInParent );
pane.mUMgrData.SetDirty( FALSE );
cbRowInfo* pRow = pane.GetFirstRow();
cbRowInfo* pRow = pane.GetFirstRow();
while ( pRow )
{
cbBarInfo* pBar = pRow->GetFirstBar();
while ( pRow )
{
cbBarInfo* pBar = pRow->GetFirstBar();
// store row state
pRow->mUMgrData.StoreItemState( pRow->mBoundsInParent );
pRow->mUMgrData.SetDirty( FALSE );
// 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 );
while( pBar )
{
// store bar state
pBar->mUMgrData.StoreItemState( pBar->mBoundsInParent );
pBar->mUMgrData.SetDirty( FALSE );
pBar = pBar->mpNext;
}
pBar = pBar->mpNext;
}
pRow = pRow->mpNext;
}
}
pRow = pRow->mpNext;
}
}
}
void cbGCUpdatesMgr::UpdateNow()
{
cbDockPane** panes = mpLayout->GetPanesArray();
cbDockPane** panes = mpLayout->GetPanesArray();
wxRect& r1 = mpLayout->GetClientRect();
wxRect& r2 = mpLayout->GetPrevClientRect();
wxRect& r1 = mpLayout->GetClientRect();
wxRect& r2 = mpLayout->GetPrevClientRect();
// detect changes in client window's area
// 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 );
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
// step #1 - detect changes in each row of each pane,
// and repaint decorations around changed windows
wxList mBarsToResize;
wxList mBarsToResize;
int n;
for ( n = 0; n != MAX_PANES; ++n )
{
cbDockPane& pane = *(panes[n]);
int n;
for ( n = 0; n != MAX_PANES; ++n )
{
cbDockPane& pane = *(panes[n]);
bool paneChanged = WasChanged( pane.mUMgrData, pane.mBoundsInParent );
bool paneChanged = WasChanged( pane.mUMgrData, pane.mBoundsInParent );
if ( paneChanged )
{
wxClientDC dc( &mpLayout->GetParentFrame() );
pane.PaintPaneBackground( dc );
}
if ( paneChanged )
{
wxClientDC dc( &mpLayout->GetParentFrame() );
pane.PaintPaneBackground( dc );
}
wxRect realBounds;
wxRect realBounds;
cbRowInfo* pRow = pane.GetFirstRow();
cbRowInfo* pRow = pane.GetFirstRow();
while ( pRow )
{
wxDC* pDc = 0;
while ( pRow )
{
wxDC* pDc = 0;
cbBarInfo* pBar = pRow->GetFirstBar();
cbBarInfo* pBar = pRow->GetFirstBar();
bool rowChanged = FALSE;
// bool rowBkPainted = FALSE;
bool rowChanged = FALSE;
// bool rowBkPainted = FALSE;
// FIXME:: the below should not be fixed
cbBarInfo* barsToRepaint[128];
// number of bars, that were changed in the current row
int nBars = 0;
// 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;
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;
if ( WasChanged( pRow->mUMgrData, pRow->mBoundsInParent ) )
rowChanged = TRUE;
else
while( pBar )
{
if ( WasChanged( pBar->mUMgrData, pBar->mBoundsInParent ) )
barsToRepaint[nBars++] = pBar;
pBar = pBar->mpNext;
}
pBar = pBar->mpNext;
}
if ( nBars || rowChanged )
{
realBounds = pRow->mBoundsInParent;
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;
// include 1-pixel thick shades around the row
realBounds.x -= 1;
realBounds.y -= 1;
realBounds.width += 2;
realBounds.height += 2;
pDc = pane.StartDrawInArea( realBounds );
}
pDc = pane.StartDrawInArea( realBounds );
}
if ( rowChanged )
{
// postphone the resizement and refreshing the changed
// bar windows
if ( rowChanged )
{
// postphone the resizement and refreshing the changed
// bar windows
cbBarInfo* pCurBar = pRow->GetFirstBar();
cbBarInfo* pCurBar = pRow->GetFirstBar();
while ( pCurBar )
{
if ( WasChanged( pCurBar->mUMgrData,
pCurBar->mBoundsInParent ) )
while ( pCurBar )
{
if ( WasChanged( pCurBar->mUMgrData,
pCurBar->mBoundsInParent ) )
AddItem( mBarsToResize, pCurBar, &pane,
pCurBar->mBoundsInParent,
pCurBar->mUMgrData.mPrevBounds );
AddItem( mBarsToResize, pCurBar, &pane,
pCurBar->mBoundsInParent,
pCurBar->mUMgrData.mPrevBounds );
pCurBar = pCurBar->mpNext;
}
pCurBar = pCurBar->mpNext;
}
// draw only their decorations now
// draw only their decorations now
pane.PaintRow( pRow, *pDc );
}
else
if ( nBars != 0 )
{
for ( int i = 0; i != nBars; ++i )
pane.PaintRow( pRow, *pDc );
}
else
if ( nBars != 0 )
{
for ( int i = 0; i != nBars; ++i )
// postphone the resizement and refreshing the changed
// bar windows
// postphone the resizement and refreshing the changed
// bar windows
AddItem( mBarsToResize,
barsToRepaint[i],
&pane,
barsToRepaint[i]->mBoundsInParent,
barsToRepaint[i]->mUMgrData.mPrevBounds );
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
// redraw decorations of entire row, regardless of how much
// of the bars were changed
pane.PaintRow( pRow, *pDc );
}
pane.PaintRow( pRow, *pDc );
}
if ( pDc )
pane.FinishDrawInArea( realBounds );
if ( pDc )
pane.FinishDrawInArea( realBounds );
pRow = pRow->mpNext;
pRow = pRow->mpNext;
} // end of while
} // end of while
if ( paneChanged )
{
wxClientDC dc( &mpLayout->GetParentFrame() );
pane.PaintPaneDecorations( dc );
}
if ( paneChanged )
{
wxClientDC dc( &mpLayout->GetParentFrame() );
pane.PaintPaneDecorations( dc );
}
} // end of for
} // end of for
if ( clientWindowChanged && !mpLayout->mClientWndRefreshPending )
{
// ptr to client-window object is "marked" as NULL
if ( clientWindowChanged && !mpLayout->mClientWndRefreshPending )
{
// ptr to client-window object is "marked" as NULL
AddItem( mBarsToResize, NULL, NULL,
mpLayout->GetClientRect(),
mpLayout->GetPrevClientRect() );
}
AddItem( mBarsToResize, NULL, NULL,
mpLayout->GetClientRect(),
mpLayout->GetPrevClientRect() );
}
// step #2 - do ordered refreshing and resizing of bar window objects now
// step #2 - do ordered refreshing and resizing of bar window objects now
DoRepositionItems( mBarsToResize );
DoRepositionItems( mBarsToResize );
}
void cbGCUpdatesMgr::DoRepositionItems( wxList& items )
{
wxNode* pNode1 = items.First();
wxNode* pNode1 = items.First();
while( pNode1 )
{
cbRectInfo& info = node_to_rect_info( pNode1 );
while( pNode1 )
{
cbRectInfo& info = node_to_rect_info( pNode1 );
wxNode* pNode2 = items.First();
wxNode* pNode2 = items.First();
// and node itself
// and node itself
mGC.AddObject( &info );
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
while( pNode2 )
{
if ( pNode2 != pNode1 ) // node should not depend on itself
{
// Add references to objects on which this object
// depends. Dependency here indicates intersection of current
// bounds of this object with the initial bounds of the
// other object.
cbRectInfo& otherInfo = node_to_rect_info( pNode2 );
cbRectInfo& otherInfo = node_to_rect_info( pNode2 );
if ( rect_hits_rect( *info.mpCurBounds, *otherInfo.mpPrevBounds ) )
// the node depends on node
mGC.AddDependency( &info, &otherInfo );
}
if ( rect_hits_rect( *info.mpCurBounds, *otherInfo.mpPrevBounds ) )
// the node depends on node
mGC.AddDependency( &info, &otherInfo );
}
pNode2 = pNode2->Next();
}
pNode2 = pNode2->Next();
}
pNode1 = pNode1->Next();
}
pNode1 = pNode1->Next();
}
mGC.ArrangeCollection(); // order nodes according "least-dependency" rule,
// and find out cycled chains
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)
// 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();
wxNode* pNode = mGC.GetRegularObjects().First();
while ( pNode )
{
cbRectInfo& info = *((cbRectInfo*)gc_node_to_obj(pNode));
while ( pNode )
{
cbRectInfo& info = *((cbRectInfo*)gc_node_to_obj(pNode));
if ( info.mpBar == NULL )
mpLayout->PositionClientWindow();
else
info.mpPane->SizeBar( info.mpBar );
if ( info.mpBar == NULL )
mpLayout->PositionClientWindow();
else
info.mpPane->SizeBar( info.mpBar );
pNode = pNode->Next();
}
pNode = pNode->Next();
}
// cycled item nodes, need to be both resized and repainted
// cycled item nodes, need to be both resized and repainted
pNode = mGC.GetCycledObjects().First();
pNode = mGC.GetCycledObjects().First();
while ( pNode )
{
cbRectInfo& info = *((cbRectInfo*)gc_node_to_obj(pNode));
while ( pNode )
{
cbRectInfo& info = *((cbRectInfo*)gc_node_to_obj(pNode));
if ( info.mpBar == NULL )
{
wxWindow* pClntWnd = mpLayout->GetFrameClient();
if ( info.mpBar == NULL )
{
wxWindow* pClntWnd = mpLayout->GetFrameClient();
mpLayout->PositionClientWindow();
mpLayout->PositionClientWindow();
// FIXME FIXME:: excessive!
// FIXME FIXME:: excessive!
pClntWnd->Show( FALSE );
pClntWnd->Show( TRUE );
pClntWnd->Show( FALSE );
pClntWnd->Show( TRUE );
// OLD STUFF:: mpLayout->PositionClientWindow();
}
else
if ( info.mpBar->mpBarWnd )
{
wxWindow* pWnd = info.mpBar->mpBarWnd;
// OLD STUFF:: mpLayout->PositionClientWindow();
}
else
if ( info.mpBar->mpBarWnd )
{
wxWindow* pWnd = info.mpBar->mpBarWnd;
// resize
info.mpPane->SizeBar( info.mpBar );
// resize
info.mpPane->SizeBar( info.mpBar );
// repaint
// repaint
/* OLD STUFF:: bool isChoice = info.mpBar->IsKindOf( CLASSINFO( wxChoice ) );
/* OLD STUFF:: bool isChoice = info.mpBar->IsKindOf( CLASSINFO( wxChoice ) );
//#ifdef __WINDOWS__
//int result = ::SendMessage( (HWND)pWnd->m_hWnd, WM_NCPAINT, 0, 0 );
//#endif
*/
//#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"
// 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();
}
pWnd->Show(FALSE);
pWnd->Show(TRUE);
pWnd->Refresh();
}
pNode = pNode->Next();
}
pNode = pNode->Next();
}
// release data prepared for GC alg.
// release data prepared for GC alg.
pNode = items.First();
pNode = items.First();
while( pNode )
{
cbRectInfo* pInfo = (cbRectInfo*)(pNode->Data());
while( pNode )
{
cbRectInfo* pInfo = (cbRectInfo*)(pNode->Data());
delete pInfo;
delete pInfo;
pNode = pNode->Next();
}
pNode = pNode->Next();
}
mGC.Reset(); // reinit GC
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
// 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();
}
if ( mpLayout->mClientWndRefreshPending )
{
mpLayout->PositionClientWindow();
mpLayout->GetFrameClient()->Refresh();
}
}

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: hintanimpl.cpp
// Purpose: cbHintAnimationPlugin implementation.
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 9/11/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -37,111 +37,111 @@ IMPLEMENT_DYNAMIC_CLASS( cbHintAnimationPlugin, cbPluginBase )
BEGIN_EVENT_TABLE( cbHintAnimationPlugin, cbPluginBase )
EVT_PL_DRAW_HINT_RECT( cbHintAnimationPlugin::OnDrawHintRect )
EVT_PL_DRAW_HINT_RECT( cbHintAnimationPlugin::OnDrawHintRect )
END_EVENT_TABLE()
cbHintAnimationPlugin::cbHintAnimationPlugin(void)
: mpScrDc( NULL ),
mpAnimTimer( 0 ),
mAnimStarted( FALSE ),
mMorphDelay ( 5 ),
mMaxFrames ( 20 ),
: mpScrDc( NULL ),
mpAnimTimer( 0 ),
mAnimStarted( FALSE ),
mMorphDelay ( 5 ),
mMaxFrames ( 20 ),
mInClientHintBorder( 4 ),
mAccelerationOn( TRUE )
mAccelerationOn( TRUE )
{}
cbHintAnimationPlugin::cbHintAnimationPlugin( wxFrameLayout* pPanel, int paneMask )
: cbPluginBase( pPanel, paneMask ),
mpScrDc( NULL ),
mpAnimTimer( 0 ),
mAnimStarted( FALSE ),
: cbPluginBase( pPanel, paneMask ),
mpScrDc( NULL ),
mpAnimTimer( 0 ),
mAnimStarted( FALSE ),
mMorphDelay ( 5 ),
mMaxFrames ( 20 ),
mInClientHintBorder( 4 ),
mAccelerationOn( TRUE )
mMorphDelay ( 5 ),
mMaxFrames ( 20 ),
mInClientHintBorder( 4 ),
mAccelerationOn( TRUE )
{}
cbHintAnimationPlugin::~cbHintAnimationPlugin()
{
if ( mpScrDc ) delete mpScrDc;
if ( mpScrDc ) delete mpScrDc;
}
/*** rect-tracking related methods ***/
void cbHintAnimationPlugin::OnDrawHintRect( cbDrawHintRectEvent& event )
{
if ( !mAnimStarted && !mpScrDc )
{
StartTracking();
if ( !mAnimStarted && !mpScrDc )
{
StartTracking();
mPrevInClient = event.mIsInClient;
mPrevInClient = event.mIsInClient;
mPrevRect = event.mRect;
mPrevRect = event.mRect;
mStopPending = FALSE;
}
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
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;
}
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"
// 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 );
int change = abs( mCurRect.width - mPrevRect.width ) +
abs( mCurRect.height - mPrevRect.height );
if ( change > 10 && !event.mLastTime && !event.mEraseRect )
{
if ( !mpAnimTimer )
if ( change > 10 && !event.mLastTime && !event.mEraseRect )
{
if ( !mpAnimTimer )
mpAnimTimer = new cbHintAnimTimer();
mpAnimTimer = new cbHintAnimTimer();
// init the animation "thread", or reinit if already started
// init the animation "thread", or reinit if already started
mpAnimTimer->Init( this, mAnimStarted );
mpAnimTimer->Init( this, mAnimStarted );
mAnimStarted = TRUE;
}
else
if ( !mAnimStarted )
{
DoDrawHintRect( event.mRect, event.mIsInClient );
mAnimStarted = TRUE;
}
else
if ( !mAnimStarted )
{
DoDrawHintRect( event.mRect, event.mIsInClient );
if ( event.mLastTime )
if ( event.mLastTime )
FinishTracking();
FinishTracking();
mPrevInClient = event.mIsInClient;
}
else
{
mCurInClient = event.mIsInClient;
mPrevInClient = event.mIsInClient;
}
else
{
mCurInClient = event.mIsInClient;
if ( event.mLastTime && mpAnimTimer )
{
mStopPending = TRUE;
if ( event.mLastTime && mpAnimTimer )
{
mStopPending = TRUE;
if ( mpAnimTimer->mPrevMorphed.x != POS_UNDEFINED )
if ( mpAnimTimer->mPrevMorphed.x != POS_UNDEFINED )
// erase previous rect
DoDrawHintRect( mpAnimTimer->mPrevMorphed, mPrevInClient );
}
}
// erase previous rect
DoDrawHintRect( mpAnimTimer->mPrevMorphed, mPrevInClient );
}
}
mPrevRect = event.mRect;
mPrevRect = event.mRect;
}
#define _IMG_A 0xAA // Note: modified from _A to _IMG_A, _A was already defined (cygwin)
@@ -150,109 +150,109 @@ void cbHintAnimationPlugin::OnDrawHintRect( cbDrawHintRectEvent& event )
#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
};
_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;
mpScrDc = new wxScreenDC;
wxScreenDC::StartDrawingOnTop(&mpLayout->GetParentFrame());
wxScreenDC::StartDrawingOnTop(&mpLayout->GetParentFrame());
}
void cbHintAnimationPlugin::DoDrawHintRect( wxRect& rect, bool isInClientRect)
{
wxRect scrRect;
wxRect scrRect;
RectToScr( rect, scrRect );
RectToScr( rect, scrRect );
int prevLF = mpScrDc->GetLogicalFunction();
int prevLF = mpScrDc->GetLogicalFunction();
mpScrDc->SetLogicalFunction( wxXOR );
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
if ( isInClientRect )
{
// BUG BUG BUG (wx):: somehow stippled brush works only
// when the bitmap created on stack, not
// as a member of the class
wxBitmap checker( (const char*)_gCheckerImg, 8,8 );
wxBitmap checker( (const char*)_gCheckerImg, 8,8 );
wxBrush checkerBrush( checker );
wxBrush checkerBrush( checker );
mpScrDc->SetPen( mpLayout->mNullPen );
mpScrDc->SetBrush( checkerBrush );
mpScrDc->SetPen( mpLayout->mNullPen );
mpScrDc->SetBrush( checkerBrush );
int half = mInClientHintBorder / 2;
int half = mInClientHintBorder / 2;
mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y - half,
scrRect.width + 2*half, mInClientHintBorder );
mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y - half,
scrRect.width + 2*half, mInClientHintBorder );
mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y + scrRect.height - half,
scrRect.width + 2*half, mInClientHintBorder );
mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y + scrRect.height - half,
scrRect.width + 2*half, mInClientHintBorder );
mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y + half - 1,
mInClientHintBorder, scrRect.height - 2*half + 2);
mpScrDc->DrawRectangle( scrRect.x - half, scrRect.y + half - 1,
mInClientHintBorder, scrRect.height - 2*half + 2);
mpScrDc->DrawRectangle( scrRect.x + scrRect.width - half,
scrRect.y + half - 1,
mInClientHintBorder, scrRect.height - 2*half + 2);
mpScrDc->DrawRectangle( scrRect.x + scrRect.width - half,
scrRect.y + half - 1,
mInClientHintBorder, scrRect.height - 2*half + 2);
mpScrDc->SetBrush( wxNullBrush );
}
else
{
// otherwise draw 1-pixel thin borders
mpScrDc->SetBrush( wxNullBrush );
}
else
{
// otherwise draw 1-pixel thin borders
mpScrDc->SetPen( mpLayout->mBlackPen );
mpScrDc->SetPen( mpLayout->mBlackPen );
mpScrDc->DrawLine( scrRect.x, scrRect.y,
scrRect.x + scrRect.width, scrRect.y );
mpScrDc->DrawLine( scrRect.x, scrRect.y,
scrRect.x + scrRect.width, scrRect.y );
mpScrDc->DrawLine( scrRect.x, scrRect.y + 1,
scrRect.x, scrRect.y + scrRect.height );
mpScrDc->DrawLine( scrRect.x, scrRect.y + 1,
scrRect.x, scrRect.y + scrRect.height );
mpScrDc->DrawLine( scrRect.x+1, scrRect.y + scrRect.height,
scrRect.x + scrRect.width, scrRect.y + scrRect.height );
mpScrDc->DrawLine( scrRect.x+1, scrRect.y + scrRect.height,
scrRect.x + scrRect.width, scrRect.y + scrRect.height );
mpScrDc->DrawLine( scrRect.x + scrRect.width , scrRect.y,
scrRect.x + scrRect.width, scrRect.y + scrRect.height + 1);
}
mpScrDc->DrawLine( scrRect.x + scrRect.width , scrRect.y,
scrRect.x + scrRect.width, scrRect.y + scrRect.height + 1);
}
mpScrDc->SetLogicalFunction( prevLF );
mpScrDc->SetLogicalFunction( prevLF );
}
void cbHintAnimationPlugin::DrawHintRect ( wxRect& rect, bool isInClientRect)
{
DoDrawHintRect( rect, isInClientRect );
DoDrawHintRect( rect, isInClientRect );
}
void cbHintAnimationPlugin::EraseHintRect( wxRect& rect, bool isInClientRect)
{
DoDrawHintRect( rect, isInClientRect );
DoDrawHintRect( rect, isInClientRect );
}
void cbHintAnimationPlugin::FinishTracking()
{
wxScreenDC::EndDrawingOnTop();
wxScreenDC::EndDrawingOnTop();
delete mpScrDc;
delete mpScrDc;
mpScrDc = NULL;
mpScrDc = NULL;
}
void cbHintAnimationPlugin::RectToScr( wxRect& frameRect, wxRect& scrRect )
{
scrRect = frameRect;
scrRect = frameRect;
int x = frameRect.x, y = frameRect.y;
int x = frameRect.x, y = frameRect.y;
mpLayout->GetParentFrame().ClientToScreen( &x, &y );
mpLayout->GetParentFrame().ClientToScreen( &x, &y );
scrRect.x = x;
scrRect.y = y;
scrRect.x = x;
scrRect.y = y;
}
/***** Implementation for class cbHintAnimTimer *****/
@@ -260,138 +260,138 @@ void cbHintAnimationPlugin::RectToScr( wxRect& frameRect, wxRect& scrRect )
cbHintAnimTimer::cbHintAnimTimer(void)
{
#ifdef __WINDOWS__
mLock = 0L;
mLock = 0L;
#endif
mPrevMorphed.x = POS_UNDEFINED;
mPrevMorphed.x = POS_UNDEFINED;
}
void cbHintAnimTimer::MorphPoint( wxPoint& origin, MorphInfoT& info, wxPoint& point )
{
// simulate lienar movement (FOR NOW:: without acceleration)
// 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 );
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.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.y = int ( double ( info.mFrom.y + double (info.mTill.y - info.mFrom.y) * k ) );
point.x += origin.x;
point.y += origin.y;
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
// FIXME:: "clean" implementation should use mutex to sync
// between GUI and animation threads
if ( mpPl->mStopPending )
{
Stop(); // top timer
if ( mpPl->mStopPending )
{
Stop(); // top timer
mpPl->FinishTracking();
mpPl->FinishTracking();
mpPl->mStopPending = FALSE;
mpPl->mpAnimTimer = NULL;
mpPl->mAnimStarted = FALSE;
mpPl->mStopPending = FALSE;
mpPl->mpAnimTimer = NULL;
mpPl->mAnimStarted = FALSE;
mPrevMorphed.x = POS_UNDEFINED;
mPrevMorphed.x = POS_UNDEFINED;
delete this;
delete this;
return;
}
return;
}
wxPoint origin( mpPl->mCurRect.x, mpPl->mCurRect.y );
wxPoint origin( mpPl->mCurRect.x, mpPl->mCurRect.y );
wxPoint curUpper, curLower;
wxPoint curUpper, curLower;
MorphPoint( origin, mUpperLeft, curUpper );
MorphPoint( origin, mLowerRight, curLower );
MorphPoint( origin, mUpperLeft, curUpper );
MorphPoint( origin, mLowerRight, curLower );
if ( mPrevMorphed.x != POS_UNDEFINED )
if ( mPrevMorphed.x != POS_UNDEFINED )
// erase previous rect
mpPl->DoDrawHintRect( mPrevMorphed, mpPl->mPrevInClient );
// erase previous rect
mpPl->DoDrawHintRect( mPrevMorphed, mpPl->mPrevInClient );
wxRect morphed( curUpper.x, curUpper.y,
curLower.x - curUpper.x,
curLower.y - curUpper.y );
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 );
// draw rect of current iteration
mpPl->DoDrawHintRect( morphed,
( mCurIter != mpPl->mMaxFrames - 1 )
? mpPl->mPrevInClient : mpPl->mCurInClient );
mPrevMorphed = morphed;
mPrevMorphed = morphed;
if ( mCurIter == mpPl->mMaxFrames - 1 )
{
Stop(); // top timer
mpPl->FinishTracking();
mpPl->mpAnimTimer = NULL;
mpPl->mAnimStarted = FALSE;
if ( mCurIter == mpPl->mMaxFrames - 1 )
{
Stop(); // top timer
mpPl->FinishTracking();
mpPl->mpAnimTimer = NULL;
mpPl->mAnimStarted = FALSE;
mPrevMorphed.x = POS_UNDEFINED;
mPrevMorphed.x = POS_UNDEFINED;
delete this;
}
else
++mCurIter;
delete this;
}
else
++mCurIter;
}
bool cbHintAnimTimer::Init( cbHintAnimationPlugin* pAnimPl, bool reinit )
{
mpPl = pAnimPl;
mpPl = pAnimPl;
// morph-points are set up relatively to the upper-left corner
// of the current hint-rectangle
// 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;
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 );
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;
wxPoint curUpper, curLower;
MorphPoint( origin, mUpperLeft, curUpper );
MorphPoint( origin, mLowerRight, 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;
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 );
}
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;
mUpperLeft.mTill.x = 0;
mUpperLeft.mTill.y = 0;
mLowerRight.mTill.x = mpPl->mCurRect.width;
mLowerRight.mTill.y = mpPl->mCurRect.height;
mLowerRight.mTill.x = mpPl->mCurRect.width;
mLowerRight.mTill.y = mpPl->mCurRect.height;
mCurIter = 1;
if ( !reinit )
mCurIter = 1;
if ( !reinit )
Start( mpPl->mMorphDelay );
Start( mpPl->mMorphDelay );
return TRUE;
return TRUE;
}

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: newbmpbtn.cpp
// Purpose: wxNewBitmapButton enhanced bitmap button class.
// Author: Aleksandras Gluchovas
// Modified by:
// Created: ??/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -142,7 +142,7 @@ static void gray_out_pixmap( int* src, int* dest, int width, int height )
} while (1);
}
// alg. for making the image look "grayed" (e.g. disabled button)
// algorithm for making the image look "grayed" (e.g. disabled button)
// NOTE:: used GetPixel(), which is Windows-Only!
void gray_out_image_on_dc( wxDC& dc, int width, int height )
@@ -198,7 +198,7 @@ void gray_out_image_on_dc( wxDC& dc, int width, int height )
///////////////////////////////
/***** Impelementation for class wxNewBitmapButton *****/
/***** Implementation for class wxNewBitmapButton *****/
IMPLEMENT_DYNAMIC_CLASS(wxNewBitmapButton, wxPanel)
@@ -382,7 +382,7 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
{
if ( destBmp != 0 ) return;
// render lables on-demand
// render labels on-demand
wxMemoryDC srcDc;
srcDc.SelectObject( *srcBmp );
@@ -756,8 +756,7 @@ void wxNewBitmapButton::OnSize( wxSizeEvent& event )
}
void wxNewBitmapButton::Reshape( )
{
{
bool wasCreated = mIsCreated;
mIsCreated = TRUE;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: rowlayoutpl.cpp
// Purpose: cbRowLayoutPlugin implementation.
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 09/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: toolwnd.cpp
// Purpose: wxToolWindow implementation.
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 06/09/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: No names yet.
// Purpose: Contrib. demo
// Name: updatesmgr.cpp
// Purpose: cbSimpleUpdatesMgr implementation.
// Author: Aleksandras Gluchovas
// Modified by:
// Created: 19/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -30,15 +30,15 @@
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.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;
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;
return 0;
}
/***** Implementation for class cbSimpleUpdatesMgr *****/
@@ -46,247 +46,247 @@ static inline bool rect_hits_rect( const wxRect& r1, const wxRect& r2 )
IMPLEMENT_DYNAMIC_CLASS( cbSimpleUpdatesMgr, cbUpdatesManagerBase )
cbSimpleUpdatesMgr::cbSimpleUpdatesMgr( wxFrameLayout* pPanel )
: cbUpdatesManagerBase( pPanel )
: cbUpdatesManagerBase( pPanel )
{}
bool cbSimpleUpdatesMgr::WasChanged( cbUpdateMgrData& data, wxRect& currentBounds )
{
return ( data.IsDirty() ||
return ( data.IsDirty() ||
( data.mPrevBounds.x != currentBounds.x ||
data.mPrevBounds.y != currentBounds.y ||
data.mPrevBounds.width != currentBounds.width ||
data.mPrevBounds.height != currentBounds.height )
);
( data.mPrevBounds.x != currentBounds.x ||
data.mPrevBounds.y != currentBounds.y ||
data.mPrevBounds.width != currentBounds.width ||
data.mPrevBounds.height != currentBounds.height )
);
}
void cbSimpleUpdatesMgr::OnStartChanges()
{
// memorize states of ALL items in the layout -
// this is quite excessive, but OK for the simple
// implementation of updates manager
// memorize states of ALL items in the layout -
// this is quite excessive, but OK for the simple
// implementation of updates manager
mpLayout->GetPrevClientRect() = mpLayout->GetClientRect();
mpLayout->GetPrevClientRect() = mpLayout->GetClientRect();
cbDockPane** panes = mpLayout->GetPanesArray();
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 );
for( int n = 0; n != MAX_PANES; ++n )
{
cbDockPane& pane = *panes[n];
// store pane state
pane.mUMgrData.StoreItemState( pane.mBoundsInParent );
pane.mUMgrData.SetDirty( FALSE );
for( size_t i = 0; i != pane.GetRowList().Count(); ++i )
{
cbRowInfo& row = *pane.GetRowList()[ i ];
for( size_t i = 0; i != pane.GetRowList().Count(); ++i )
{
cbRowInfo& row = *pane.GetRowList()[ i ];
// store row state
row.mUMgrData.StoreItemState( row.mBoundsInParent );
row.mUMgrData.SetDirty( FALSE );
// store row state
row.mUMgrData.StoreItemState( row.mBoundsInParent );
row.mUMgrData.SetDirty( FALSE );
for( size_t k = 0; k != row.mBars.Count(); ++k )
{
cbBarInfo& bar = *row.mBars[ k ];
for( size_t k = 0; k != row.mBars.Count(); ++k )
{
cbBarInfo& bar = *row.mBars[ k ];
// store bar state
bar.mUMgrData.StoreItemState( bar.mBoundsInParent );
bar.mUMgrData.SetDirty( FALSE );
}
}
}
// store bar state
bar.mUMgrData.StoreItemState( bar.mBoundsInParent );
bar.mUMgrData.SetDirty( FALSE );
}
}
}
}
void cbSimpleUpdatesMgr::OnFinishChanges()
{
// nothing here, could be overriden by more sophisticated updates-managers
// nothing here, could be overriden by more sophisticated updates-managers
}
void cbSimpleUpdatesMgr::OnRowWillChange( cbRowInfo* pRow, cbDockPane* pInPane )
{
// -/-
// -/-
}
void cbSimpleUpdatesMgr::OnBarWillChange( cbBarInfo* pBar,
cbRowInfo* pInRow, cbDockPane* pInPane )
cbRowInfo* pInRow, cbDockPane* pInPane )
{
// -/-
// -/-
}
void cbSimpleUpdatesMgr::OnPaneMarginsWillChange( cbDockPane* pPane )
{
// -/-
// -/-
}
void cbSimpleUpdatesMgr::OnPaneWillChange( cbDockPane* pPane )
{
// -/-
// -/-
}
void cbSimpleUpdatesMgr::UpdateNow()
{
cbDockPane** panes = mpLayout->GetPanesArray();
cbDockPane** panes = mpLayout->GetPanesArray();
wxRect& r1 = mpLayout->GetClientRect();
wxRect& r2 = mpLayout->GetPrevClientRect();
wxRect& r1 = mpLayout->GetClientRect();
wxRect& r2 = mpLayout->GetPrevClientRect();
// detect changes in client window's area
// 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 );
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
// step #1 - detect changes in each row of each pane,
// and repaint decorations around changed windows
wxList mBarsToRefresh;
wxList mPanesList;
wxList mBarsToRefresh;
wxList mPanesList;
for( int n = 0; n != MAX_PANES; ++n )
{
cbDockPane& pane = *(panes[n]);
for( int n = 0; n != MAX_PANES; ++n )
{
cbDockPane& pane = *(panes[n]);
bool paneChanged = WasChanged( pane.mUMgrData, pane.mBoundsInParent );
bool paneChanged = WasChanged( pane.mUMgrData, pane.mBoundsInParent );
if ( paneChanged )
{
wxClientDC dc( &mpLayout->GetParentFrame() );
pane.PaintPaneBackground( dc );
}
if ( paneChanged )
{
wxClientDC dc( &mpLayout->GetParentFrame() );
pane.PaintPaneBackground( dc );
}
wxRect realBounds;
wxRect realBounds;
for( size_t i = 0; i != pane.GetRowList().Count(); ++i )
{
cbRowInfo& row = *pane.GetRowList()[ i ];
for( size_t i = 0; i != pane.GetRowList().Count(); ++i )
{
cbRowInfo& row = *pane.GetRowList()[ i ];
wxDC* pDc = NULL;
wxDC* pDc = NULL;
bool rowChanged = FALSE;
bool rowChanged = FALSE;
// FIXME:: the below should not be fixed
cbBarInfo* barsToRepaint[256];
// FIXME:: the below should not be fixed
cbBarInfo* barsToRepaint[256];
// number of bars, that were changed in the current row
int nBars = 0;
// number of bars, that were changed in the current row
int nBars = 0;
if ( WasChanged( row.mUMgrData, row.mBoundsInParent ) )
rowChanged = TRUE;
else
for( size_t k = 0; k != row.mBars.Count(); ++k )
if ( WasChanged( row.mUMgrData, row.mBoundsInParent ) )
rowChanged = TRUE;
else
for( size_t k = 0; k != row.mBars.Count(); ++k )
if ( WasChanged( row.mBars[k]->mUMgrData,
row.mBars[k]->mBoundsInParent )
)
barsToRepaint[nBars++] = row.mBars[k];
if ( WasChanged( row.mBars[k]->mUMgrData,
row.mBars[k]->mBoundsInParent )
)
barsToRepaint[nBars++] = row.mBars[k];
if ( nBars || rowChanged )
{
realBounds = row.mBoundsInParent;
if ( nBars || rowChanged )
{
realBounds = row.mBoundsInParent;
// include 1-pixel thick shades around the row
realBounds.x -= 1;
realBounds.y -= 1;
realBounds.width += 2;
realBounds.height += 2;
// include 1-pixel thick shades around the row
realBounds.x -= 1;
realBounds.y -= 1;
realBounds.width += 2;
realBounds.height += 2;
pDc = pane.StartDrawInArea( realBounds );
}
pDc = pane.StartDrawInArea( realBounds );
}
if ( rowChanged )
{
// postphone the resizing and refreshing the changed
// bar windows
if ( rowChanged )
{
// postphone the resizing and refreshing the changed
// bar windows
for( size_t k = 0; k != row.mBars.Count(); ++k )
{
mBarsToRefresh.Append( (wxObject*)row.mBars[k] );
mPanesList.Append( &pane );
}
for( size_t k = 0; k != row.mBars.Count(); ++k )
{
mBarsToRefresh.Append( (wxObject*)row.mBars[k] );
mPanesList.Append( &pane );
}
// draw only their decorations now
// draw only their decorations now
pane.PaintRow( &row, *pDc );
}
else
if ( nBars != 0 )
{
for( int i = 0; i != nBars; ++i )
{
// postphone the resizement and refreshing the changed
// bar windows
pane.PaintRow( &row, *pDc );
}
else
if ( nBars != 0 )
{
for( int i = 0; i != nBars; ++i )
{
// postphone the resizement and refreshing the changed
// bar windows
mBarsToRefresh.Append( (wxObject*)barsToRepaint[i] );
mPanesList.Append( &pane );
}
mBarsToRefresh.Append( (wxObject*)barsToRepaint[i] );
mPanesList.Append( &pane );
}
// redraw decorations of entire row, regardless of how much
// of the bars were changed
pane.PaintRow( &row, *pDc );
}
// redraw decorations of entire row, regardless of how much
// of the bars were changed
pane.PaintRow( &row, *pDc );
}
if ( pDc )
pane.FinishDrawInArea( realBounds );
} // end of while
if ( pDc )
pane.FinishDrawInArea( realBounds );
} // end of while
if ( paneChanged )
{
wxClientDC dc( &mpLayout->GetParentFrame() );
pane.PaintPaneDecorations( dc );
}
if ( paneChanged )
{
wxClientDC dc( &mpLayout->GetParentFrame() );
pane.PaintPaneDecorations( dc );
}
} // end of for
} // end of for
if ( clientWindowChanged )
{
mpLayout->PositionClientWindow();
// ptr to client-window object is "marked" as 0
}
if ( clientWindowChanged )
{
mpLayout->PositionClientWindow();
// ptr to client-window object is "marked" as 0
}
// step #2 - do ordered refreshing and resizing of bar window objects now
// step #2 - do ordered refreshing and resizing of bar window objects now
wxNode* pNode = mBarsToRefresh.First();
wxNode* pPaneNode = mPanesList.First();
wxNode* pNode = mBarsToRefresh.First();
wxNode* pPaneNode = mPanesList.First();
while( pNode )
{
cbBarInfo* pBar = (cbBarInfo*) pNode->Data();
cbDockPane* pPane = (cbDockPane*)pPaneNode->Data();
while( pNode )
{
cbBarInfo* pBar = (cbBarInfo*) pNode->Data();
cbDockPane* pPane = (cbDockPane*)pPaneNode->Data();
pPane->SizeBar( pBar );
pPane->SizeBar( pBar );
pNode = pNode->Next();
pPaneNode = pPaneNode->Next();
}
pNode = pNode->Next();
pPaneNode = pPaneNode->Next();
}
pNode = mBarsToRefresh.First();
pNode = mBarsToRefresh.First();
while( pNode )
{
cbBarInfo* pBar = (cbBarInfo*)pNode->Data();
while( pNode )
{
cbBarInfo* pBar = (cbBarInfo*)pNode->Data();
if ( pBar->mpBarWnd )
{
pBar->mpBarWnd->Refresh();
if ( pBar->mpBarWnd )
{
pBar->mpBarWnd->Refresh();
// FIXME::
//info.mpBarWnd->Show(FALSE);
//info.mpBarWnd->Show(TRUE);
}
// FIXME::
//info.mpBarWnd->Show(FALSE);
//info.mpBarWnd->Show(TRUE);
}
pNode = pNode->Next();
}
pNode = pNode->Next();
}
if ( clientWindowChanged )
{
// FIXME:: excessive?
if ( clientWindowChanged )
{
// FIXME:: excessive?
mpLayout->GetFrameClient()->Refresh();
}
mpLayout->GetFrameClient()->Refresh();
}
}