/////////////////////////////////////////////////////////////////////////////
-// Name: No names yet.
+// Name: tabpgwin.cpp
// Purpose: Contrib. demo
// Author: Aleksandras Gluchovas
// Modified by: 19990908 : mj
#ifdef __GNUG__
#pragma implementation
-// #pragma interface
+//#pragma interface
#endif
// For compilers that support precompilation, includes "wx.h".
//---------------------------------------------------------------------------
wxTabbedWindow::~wxTabbedWindow()
{
- wxNode* pTab = mTabs.First();
+ wxNode* pTab = mTabs.GetFirst();
while( pTab )
{
- delete ((twTabInfo*)pTab->Data());
- pTab = pTab->Next();
+ delete ((twTabInfo*)pTab->GetData());
+ pTab = pTab->GetNext();
}
}
//---------------------------------------------------------------------------
-void wxTabbedWindow::SizeTabs(int x,int y, int width, int height, bool repant)
+void wxTabbedWindow::SizeTabs(int x,int y, int width, int height, bool WXUNUSED(repant))
{
- wxNode* pTabNode = mTabs.First();
- int n = 0;
+ wxNode* pTabNode = mTabs.GetFirst();
+ size_t n = 0;
while( pTabNode )
{
- twTabInfo& info = *((twTabInfo*)pTabNode->Data());
+ twTabInfo& info = *((twTabInfo*)pTabNode->GetData());
if ( n == mActiveTab )
{
info.mpContent->Show(FALSE);
}
- pTabNode = pTabNode->Next();
+ pTabNode = pTabNode->GetNext();
++n;
}
}
//---------------------------------------------------------------------------
-void wxTabbedWindow::AddTab( wxWindow* pContent,
- wxString tabText,
- wxString imageFileName,
- long imageType )
+void wxTabbedWindow::AddTab( wxWindow* pContent,
+ wxString tabText,
+ wxString imageFileName,
+ wxBitmapType imageType )
{
twTabInfo* pTab = new twTabInfo();
//---------------------------------------------------------------------------
void wxTabbedWindow::RemoveTab( int tabNo )
{
- twTabInfo* pTab = ((twTabInfo*)(mTabs.Nth( tabNo )->Data()));
+ twTabInfo* pTab = ((twTabInfo*)(mTabs.Item( tabNo )->GetData()));
pTab->mpContent->Destroy();
delete pTab;
- mTabs.DeleteNode( mTabs.Nth( tabNo ) );
- // if ( mActiveTab >= mTabs.Number() );
- if ( mActiveTab >= mTabs.Number() )
- mActiveTab = mTabs.Number() - 1;
+ mTabs.DeleteNode( mTabs.Item( tabNo ) );
+ // if ( mActiveTab >= mTabs.GetCount() );
+ if ( mActiveTab >= mTabs.GetCount() )
+ mActiveTab = mTabs.GetCount() - 1;
SetActiveTab( mActiveTab );
}
//---------------------------------------------------------------------------
int wxTabbedWindow::GetTabCount()
{
- return mTabs.Number();
+ return mTabs.GetCount();
}
//---------------------------------------------------------------------------
wxWindow* wxTabbedWindow::GetTab( int tabNo )
{
- return ((twTabInfo*)(mTabs.Nth( tabNo )->Data()))->mpContent;
+ return ((twTabInfo*)(mTabs.Item( tabNo )->GetData()))->mpContent;
}
//---------------------------------------------------------------------------
curX = mFirstTitleGap;
curY = height - mVertGap - mTitleHeight;
- int tabNo = 0;
- wxNode* pNode = mTabs.First();
+ size_t tabNo = 0;
+ wxNode* pNode = mTabs.GetFirst();
while( pNode )
{
// "hard-coded metafile" for decorations
- twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
+ twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));
xSize = tab.mDims.x;
ySize = mTitleHeight;
dc.DrawLine( curX+xSize-2, curY+ySize-2, curX+xSize-3, curY+ySize-2 );
dc.DrawLine( curX+xSize-3, curY+ySize-1, curX+1, curY+ySize-1 );
- pNode = pNode->Next();
+ pNode = pNode->GetNext();
++tabNo;
// darw image and (or without) text centered within the
int curY = height - mVertGap - mTitleHeight;
int tabNo = 0;
- wxNode* pNode = mTabs.First();
+ wxNode* pNode = mTabs.GetFirst();
while( pNode )
{
- twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
+ twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));
- int w,h;
- w = tab.mDims.x;
- h = tab.mDims.y;
// hit test rectangle of the currnet tab title bar
if ( pos.x >= curX && pos.x < curX + tab.mDims.x &&
pos.y >= curY && pos.y < curY + tab.mDims.y
curX += tab.mDims.x;
- pNode = pNode->Next();
+ pNode = pNode->GetNext();
++tabNo;
}
if ( !andRepaint )
return;
- wxNode* pNode = mTabs.First();
- int tabNo = 0;
+ wxNode* pNode = mTabs.GetFirst();
+ size_t tabNo = 0;
while( pNode )
{
if ( tabNo != mActiveTab )
{
- twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
+ twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));
tab.mpContent->Show(FALSE);
}
- pNode = pNode->Next();
+ pNode = pNode->GetNext();
++tabNo;
}
} // wxTabbedWindow::HideInactiveTabs()
{
wxFont font;
#ifdef __WINDOWS__
- font.SetFaceName("MS Sans Serif");
+ font.SetFaceName(_T("MS Sans Serif"));
#else
font.SetFamily( wxSWISS );
#endif
mLayoutType = wxTITLE_IMG_AND_TEXT;
- wxNode* pNode = mTabs.First();
+ wxNode* pNode = mTabs.GetFirst();
curX = mFirstTitleGap; // the left-side gap
mTitleHeight = 0;
while( pNode )
{
- twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
+ twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));
wxWindowDC dc(this);
curX += tab.mDims.x;
- pNode = pNode->Next();
+ pNode = pNode->GetNext();
}
curX += mHorizGap; // the right-side gap
// make all title bars of equel height
- pNode = mTabs.First();
+ pNode = mTabs.GetFirst();
while( pNode )
{
- ((twTabInfo*)(pNode->Data()))->mDims.y = mTitleHeight;;
- pNode = pNode->Next();
+ ((twTabInfo*)(pNode->GetData()))->mDims.y = mTitleHeight;;
+ pNode = pNode->GetNext();
}
// if curX has'nt ran out of bounds, leave TITLE_IMG layout and return
mLayoutType = wxTITLE_IMG_ONLY;
- pNode = mTabs.First();
+ pNode = mTabs.GetFirst();
curX = mFirstTitleGap; // the left-side gap
- int denomiator = mTabs.Number();
+ int denomiator = mTabs.GetCount();
if ( denomiator == 0 )
++denomiator;
while( pNode )
{
- twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
+ twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));
if ( tab.HasImg() )
{
curX += tab.mDims.x;
- pNode = pNode->Next();
+ pNode = pNode->GetNext();
}
curX += mHorizGap; // the right-side gap
mLayoutType = wxTITLE_BORDER_ONLY;
- pNode = mTabs.First();
+ pNode = mTabs.GetFirst();
while( pNode )
{
- twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
+ twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));
tab.mDims.x = mBorderOnlyWidth;
tab.mDims.y = mTitleHeight;
- pNode = pNode->Next();
+ pNode = pNode->GetNext();
}
} // wxTabbedWindow::RecalcLayout()
//---------------------------------------------------------------------------
// wx event handlers
//---------------------------------------------------------------------------
-void wxTabbedWindow::OnPaint( wxPaintEvent& event )
+void wxTabbedWindow::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
wxPaintDC dc(this);
DrawDecorations( dc );
}
//---------------------------------------------------------------------------
-void wxTabbedWindow::OnSize ( wxSizeEvent& event )
+void wxTabbedWindow::OnSize ( wxSizeEvent& WXUNUSED(event) )
{
SetBackgroundColour( wxColour( 192,192,192 ) );
RecalcLayout(TRUE);
}
//---------------------------------------------------------------------------
-void wxTabbedWindow::OnBkErase( wxEraseEvent& event )
+void wxTabbedWindow::OnBkErase( wxEraseEvent& WXUNUSED(event) )
{
// do nothing
}
wxFont font;
#ifdef __WINDOWS__
- font.SetFaceName("Comic Sans MS");
+ font.SetFaceName(_T("Comic Sans MS"));
#else
font.SetFamily( wxSWISS );
#endif
}
//---------------------------------------------------------------------------
-void wxPagedWindow::OnTabAdded( twTabInfo* pInfo )
+void wxPagedWindow::OnTabAdded( twTabInfo* WXUNUSED(pInfo) )
{
int units = GetWholeTabRowLen() / 20;
//---------------------------------------------------------------------------
int wxPagedWindow::GetWholeTabRowLen()
{
- wxNode* pNode = mTabs.First();
+ wxNode* pNode = mTabs.GetFirst();
int len = 0;
while( pNode )
{
- twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
+ twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));
len += tab.mDims.x;
- pNode = pNode->Next();
+ pNode = pNode->GetNext();
}
return len;
// draw inactive tab title bars frist (left-to-right)
- wxNode* pNode = mTabs.First();
- int tabNo = 0;
+ wxNode* pNode = mTabs.GetFirst();
+ size_t tabNo = 0;
/* OLD STUFF::
curX = mTitleRowStart;
while( pNode )
{
- twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
+ twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));
if ( tabNo != mActiveTab )
DrawPaperBar( tab, curX, curY, mGrayBrush, mBlackPen, tmpDc );
curX += tab.mDims.x;
- pNode = pNode->Next();
+ pNode = pNode->GetNext();
++tabNo;
}
// finally, draw the active tab (white-filled)
- pNode = mTabs.First();
+ pNode = mTabs.GetFirst();
tabNo = 0;
curX = mTabTrianGap;
while( pNode )
{
- twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
+ twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));
if ( tabNo == mActiveTab )
{
}
curX += tab.mDims.x;
- pNode = pNode->Next();
+ pNode = pNode->GetNext();
++tabNo;
}
mLayoutType = wxTITLE_IMG_AND_TEXT;
- wxNode* pNode = mTabs.First();
+ wxNode* pNode = mTabs.GetFirst();
while( pNode )
{
- twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
+ twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));
wxWindowDC dc(this);
tab.mDims.y = mTitleHeight;
- pNode = pNode->Next();
+ pNode = pNode->GetNext();
}
// disable title-bar scroller if there's nowhere to scroll to
//---------------------------------------------------------------------------
// event handlers
//---------------------------------------------------------------------------
-void wxPagedWindow::OnPaint( wxPaintEvent& event )
+void wxPagedWindow::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
wxPaintDC dc(this);
DrawDecorations( dc );
} // wxPagedWindow::OnLButtonDown()
//---------------------------------------------------------------------------
-void wxPagedWindow::OnLButtonUp( wxMouseEvent& event )
+void wxPagedWindow::OnLButtonUp( wxMouseEvent& WXUNUSED(event) )
{
if ( mIsDragged )
{