X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5151c7af137a1b6f3c8f656048cf7d13524f040e..db23ced86782a4323272cea8bd499d2e4aeabfce:/demos/dbbrowse/tabpgwin.cpp diff --git a/demos/dbbrowse/tabpgwin.cpp b/demos/dbbrowse/tabpgwin.cpp index b8cde25969..5b1c5b029f 100644 --- a/demos/dbbrowse/tabpgwin.cpp +++ b/demos/dbbrowse/tabpgwin.cpp @@ -16,11 +16,6 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation -//#pragma interface -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -32,7 +27,8 @@ #include "wx/wx.h" #endif -#include +#include "wx/math.h" + #include #include "wx/string.h" @@ -50,12 +46,6 @@ twTabInfo::twTabInfo() : mpContent( 0 ) {} -//--------------------------------------------------------------------------- -twTabInfo::~twTabInfo() -{ - // FOR NOW:: nothing -} - //--------------------------------------------------------------------------- int twTabInfo::ImgWidth() { @@ -157,8 +147,8 @@ wxTabbedWindow::wxTabbedWindow() //--------------------------------------------------------------------------- wxTabbedWindow::~wxTabbedWindow() { - wxNode* pTab = mTabs.GetFirst(); - + wxObjectList::compatibility_iterator pTab = mTabs.GetFirst(); + while( pTab ) { delete ((twTabInfo*)pTab->GetData()); @@ -169,28 +159,28 @@ wxTabbedWindow::~wxTabbedWindow() //--------------------------------------------------------------------------- void wxTabbedWindow::SizeTabs(int x,int y, int width, int height, bool WXUNUSED(repant)) { - wxNode* pTabNode = mTabs.GetFirst(); + wxObjectList::compatibility_iterator pTabNode = mTabs.GetFirst(); size_t n = 0; - + while( pTabNode ) { twTabInfo& info = *((twTabInfo*)pTabNode->GetData()); - + if ( n == mActiveTab ) { //wxSizeEvent evt; //info.mpContent->GetEventHandler()->ProcessEvent( evt ); - + info.mpContent->SetSize( x, y, width, height, 0 ); info.mpContent->Show(true); info.mpContent->Refresh(); - + } else { info.mpContent->Show(false); } - + pTabNode = pTabNode->GetNext(); ++n; } @@ -203,26 +193,26 @@ void wxTabbedWindow::AddTab( wxWindow* pContent, wxBitmapType imageType ) { twTabInfo* pTab = new twTabInfo(); - + pTab->mpContent = pContent; pTab->mText = tabText; - + if ( wxFileExists( imageFileName ) && - + pTab->mBitMap.LoadFile( imageFileName, imageType ) ) { pTab->mImageFile = imageFileName; pTab->mImageType = imageType; } - - + + if ( pContent->GetParent() == NULL ) pContent->Create( this, wxID_ANY ); - + mTabs.Append( (wxObject*)pTab ); - + RecalcLayout(true); - + OnTabAdded( pTab ); } @@ -231,16 +221,16 @@ void wxTabbedWindow::AddTab( wxWindow* pContent, wxString tabText, wxBitmap* pImage ) { twTabInfo* pTab = new twTabInfo(); - + pTab->mpContent = pContent; pTab->mText = tabText; - + if ( pImage ) pTab->mBitMap = *pImage; - + if ( pContent->GetParent() == NULL ) pContent->Create( this, wxID_ANY ); - + mTabs.Append( (wxObject*)pTab ); RecalcLayout(true); OnTabAdded( pTab ); @@ -252,7 +242,7 @@ void wxTabbedWindow::RemoveTab( int tabNo ) twTabInfo* pTab = ((twTabInfo*)(mTabs.Item( tabNo )->GetData())); pTab->mpContent->Destroy(); delete pTab; - mTabs.DeleteNode( mTabs.Item( tabNo ) ); + mTabs.Erase( mTabs.Item( tabNo ) ); // if ( mActiveTab >= mTabs.GetCount() ); if ( mActiveTab >= mTabs.GetCount() ) mActiveTab = mTabs.GetCount() - 1; @@ -297,13 +287,13 @@ void wxTabbedWindow::DrawShadedRect( int x, int y, int width, int height, ) { // darw the lightened upper-left sides of the rectangle - + dc.SetPen( upperPen ); dc.DrawLine( x,y, x, y + height - 1 ); // vert dc.DrawLine( x,y, x + width - 1, y ); // horiz - + // draw the unenlightened lower-right sides of the rectangle - + dc.SetPen( lowerPen ); dc.DrawLine( x + width - 1, y, x + width - 1, y + height - 1 ); // vert dc.DrawLine( x, y + height - 1, x + width, y + height - 1 ); // horiz @@ -316,79 +306,79 @@ void wxTabbedWindow::DrawDecorations( wxDC& dc ) // but not including the point specified by last position. // This way Windows draws lines, not sure how Motif and Gtk // prots behave... - + int width, height; GetClientSize( &width, &height ); - + // check if there's at least a bit of space to draw things - + if ( width < mHorizGap*2 + BORDER_SZ*2+1 || height < mVertGap*2 + BORDER_SZ*2+1 + mTitleHeight ) return; - + // step #1 - draw border around the tab content area - + // setup position for kind of "pencil" int curX = mHorizGap; int curY = mVertGap; - + int xSize = width - mHorizGap*2; int ySize = height - mVertGap *2 - mTitleHeight; - + // layer 1 (upper white) DrawShadedRect( curX+0, curY+0, xSize-0, ySize-0, mWhitePen, mBlackPen, dc ); - + // layer 2 (upper gray) DrawShadedRect( curX+1, curY+1, xSize-2-1, ySize-2-1, mGrayPen, mGrayPen, dc ); - + // layer 3 (upper darkGray) DrawShadedRect( curX+2, curY+2, xSize-3-2, ySize-3-2, mDarkPen, mWhitePen, dc ); - + // layer 4 (upper black) DrawShadedRect( curX+3, curY+3, xSize-4-3, ySize-4-3, mBlackPen, mGrayPen, dc ); - + // add non-siemtric layer from the lower-right side (confroming to MFC-look) - + dc.SetPen( mDarkPen ); dc.DrawLine( curX+1, curY + ySize - 2, curX + xSize - 1, curY + ySize - 2 ); // horiz dc.DrawLine( curX + xSize - 2, curY + 1, curX + xSize - 2, curY + ySize - 2 ); // vert - + // step #2 - draw tab title bars - + curX = mFirstTitleGap; curY = height - mVertGap - mTitleHeight; - + size_t tabNo = 0; - wxNode* pNode = mTabs.GetFirst(); - + wxObjectList::compatibility_iterator pNode = mTabs.GetFirst(); + while( pNode ) { // "hard-coded metafile" for decorations - + twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); - + xSize = tab.mDims.x; ySize = mTitleHeight; - + if ( tabNo == mActiveTab ) { dc.SetPen( mGrayPen ); dc.DrawLine( curX+1, curY-2, curX+xSize-2, curY-2 ); dc.DrawLine( curX+1, curY-1, curX+xSize-2, curY-1 ); } - + dc.SetPen( mWhitePen ); - + if ( tabNo == mActiveTab ) dc.DrawLine( curX, curY-2, curX, curY+ySize-2 ); else dc.DrawLine( curX, curY, curX, curY+ySize-2 ); - + dc.SetPen( mDarkPen ); dc.DrawLine( curX+1, curY+ySize-3, curX+1, curY+ySize-1 ); // to pix down dc.DrawLine( curX+2, curY+ySize-2, curX+xSize-2, curY+ySize-2 ); @@ -397,23 +387,23 @@ void wxTabbedWindow::DrawDecorations( wxDC& dc ) dc.DrawLine( curX+xSize-2, curY+ySize-3, curX+xSize-2, curY-3 ); else dc.DrawLine( curX+xSize-2, curY+ySize-3, curX+xSize-2, curY-1 ); - + dc.SetPen( mBlackPen ); dc.DrawLine( curX+xSize-1, curY, curX+xSize-1, curY+ySize-2 ); 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->GetNext(); ++tabNo; - + // darw image and (or without) text centered within the // title bar rectangle - + if ( mLayoutType != wxTITLE_BORDER_ONLY && tab.HasImg() ) { wxMemoryDC tmpDc; tmpDc.SelectObject( tab.GetImg() ); - + dc.Blit( curX + mTitleHorizGap, curY + ( ySize - tab.ImgHeight() ) / 2, tab.ImgWidth(), @@ -421,25 +411,25 @@ void wxTabbedWindow::DrawDecorations( wxDC& dc ) &tmpDc, 0, 0, wxCOPY ); } - + if ( mLayoutType == wxTITLE_IMG_AND_TEXT && tab.HasText() ) { long x,w,h; - + // set select default font of the window into it's device context //dc.SetFont( GetLabelingFont() ); - + dc.SetTextBackground( GetBackgroundColour() ); - + dc.GetTextExtent(tab.mText, &w, &h ); - + x = curX + mTitleHorizGap + tab.ImgWidth() + tab.ImageToTxtGap(mImageTextGap); - + dc.DrawText( tab.GetText(), x, curY + ( ySize - h ) / 2 ); } curX += xSize; - + } // end of `while (pNode)' } // wxTabbedWindow::DrawDecorations() @@ -448,17 +438,17 @@ int wxTabbedWindow::HitTest( const wxPoint& pos ) { int width, height; GetClientSize( &width, &height ); - + int curX = mFirstTitleGap; int curY = height - mVertGap - mTitleHeight; - + int tabNo = 0; - wxNode* pNode = mTabs.GetFirst(); - + wxObjectList::compatibility_iterator pNode = mTabs.GetFirst(); + while( pNode ) { twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); - + // 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 @@ -466,13 +456,13 @@ int wxTabbedWindow::HitTest( const wxPoint& pos ) { return tabNo; } - + curX += tab.mDims.x; - + pNode = pNode->GetNext(); ++tabNo; } - + return -1; } // wxTabbedWindow::HitTest() @@ -481,10 +471,10 @@ void wxTabbedWindow::HideInactiveTabs( bool andRepaint ) { if ( !andRepaint ) return; - - wxNode* pNode = mTabs.GetFirst(); + + wxObjectList::compatibility_iterator pNode = mTabs.GetFirst(); size_t tabNo = 0; - + while( pNode ) { if ( tabNo != mActiveTab ) @@ -492,7 +482,7 @@ void wxTabbedWindow::HideInactiveTabs( bool andRepaint ) twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); tab.mpContent->Show(false); } - + pNode = pNode->GetNext(); ++tabNo; } @@ -507,15 +497,15 @@ wxFont wxTabbedWindow::GetLabelingFont() #else font.SetFamily( wxSWISS ); #endif - + font.SetStyle(40); font.SetWeight(40); font.SetPointSize( 8 ); - + #ifdef __WINDOWS__ font.RealizeResource(); #endif - + return font; } // wxTabbedWindow::GetLabelingFont() @@ -523,87 +513,87 @@ wxFont wxTabbedWindow::GetLabelingFont() void wxTabbedWindow::RecalcLayout(bool andRepaint) { HideInactiveTabs(andRepaint); - + // resetup position of the active tab - + int width, height; GetClientSize( &width, &height ); - + int curX = mHorizGap + BORDER_SZ; int curY = mVertGap + BORDER_SZ; - + int xSize = width - mHorizGap*2 - BORDER_SZ*2-1; int ySize = height - mVertGap*2 - BORDER_SZ*2-1 - mTitleHeight; - + SizeTabs( curX, curY, xSize, ySize, andRepaint ); - + // pass #1 - try to layout assuming it's wxTITLE_IMG_AND_TEXT - + mLayoutType = wxTITLE_IMG_AND_TEXT; - - wxNode* pNode = mTabs.GetFirst(); - + + wxObjectList::compatibility_iterator pNode = mTabs.GetFirst(); + curX = mFirstTitleGap; // the left-side gap mTitleHeight = 0; - + while( pNode ) { twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); - + wxWindowDC dc(this); - + long w,h; - + // set select default font of the window into it's device context //dc.SetFont( GetLabelingFont() ); - + dc.GetTextExtent(tab.mText, &w, &h ); - + tab.mDims.x = w + tab.ImageToTxtGap(mImageTextGap) + tab.ImgWidth() + mTitleHorizGap*2; - + tab.mDims.y = wxMax( h, tab.ImgHeight() ) + mTitleVertGap*2; mTitleHeight = wxMax( mTitleHeight, tab.mDims.y ); - + curX += tab.mDims.x; - + pNode = pNode->GetNext(); } - + curX += mHorizGap; // the right-side gap - + // make all title bars of equel height - + pNode = mTabs.GetFirst(); - + while( pNode ) { ((twTabInfo*)(pNode->GetData()))->mDims.y = mTitleHeight;; pNode = pNode->GetNext(); } - + // if curX has'nt ran out of bounds, leave TITLE_IMG layout and return if ( curX < width - mHorizGap ) return; - + // pass #2 - try to layout assuming wxTITLE_IMG_ONLY - + mLayoutType = wxTITLE_IMG_ONLY; - + pNode = mTabs.GetFirst(); - + curX = mFirstTitleGap; // the left-side gap - + int denomiator = mTabs.GetCount(); if ( denomiator == 0 ) ++denomiator; - + mBorderOnlyWidth = (width - mFirstTitleGap - mHorizGap) / denomiator; - + while( pNode ) { twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); - + if ( tab.HasImg() ) { tab.mDims.x = tab.ImgWidth() + mTitleHorizGap*2; @@ -614,31 +604,31 @@ void wxTabbedWindow::RecalcLayout(bool andRepaint) tab.mDims.x = mBorderOnlyWidth; tab.mDims.y = mTitleHeight; } - + curX += tab.mDims.x; - + pNode = pNode->GetNext(); } - + curX += mHorizGap; // the right-side gap - + // if curX has'nt ran out of bounds, leave IMG_ONLY layout and return if ( curX < width - mHorizGap ) return; - + // pass #3 - set the narrowest layout wxTITLE_BORDER_ONLY - + mLayoutType = wxTITLE_BORDER_ONLY; - + pNode = mTabs.GetFirst(); - + while( pNode ) { twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); - + tab.mDims.x = mBorderOnlyWidth; tab.mDims.y = mTitleHeight; - + pNode = pNode->GetNext(); } } // wxTabbedWindow::RecalcLayout() @@ -671,9 +661,9 @@ void wxTabbedWindow::OnLButtonDown( wxMouseEvent& event ) // floats, why? int x = (int)event.m_x; int y = (int)event.m_y; - + int tabNo = HitTest( wxPoint(x,y) ); - + if ( tabNo != -1 ) { SetActiveTab( tabNo ); @@ -721,27 +711,21 @@ wxPagedWindow::wxPagedWindow() mNoVertScroll = true; // Horizontale Scroll abschalten } -//--------------------------------------------------------------------------- -wxPagedWindow::~wxPagedWindow() -{ - // nothing (base class handles destruction) -} - //--------------------------------------------------------------------------- wxFont wxPagedWindow::GetLabelingFont() { wxFont font; - + #ifdef __WINDOWS__ font.SetFaceName(_T("Comic Sans MS")); #else font.SetFamily( wxSWISS ); #endif - + font.SetStyle(40); font.SetWeight(40); font.SetPointSize( 8 ); - + return font; } @@ -749,7 +733,7 @@ wxFont wxPagedWindow::GetLabelingFont() void wxPagedWindow::OnTabAdded( twTabInfo* WXUNUSED(pInfo) ) { int units = GetWholeTabRowLen() / 20; - + mpTabScroll->SetScrollbar( 0, 1, units, 1, false ); } @@ -768,18 +752,18 @@ wxScrollBar& wxPagedWindow::GetHorizontalScrollBar() //--------------------------------------------------------------------------- int wxPagedWindow::GetWholeTabRowLen() { - wxNode* pNode = mTabs.GetFirst(); - + wxObjectList::compatibility_iterator pNode = mTabs.GetFirst(); + int len = 0; - + while( pNode ) { twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); - + len += tab.mDims.x; pNode = pNode->GetNext(); } - + return len; } // wxPagedWindow::GetWholeTabRowLen() @@ -788,40 +772,40 @@ void wxPagedWindow::DrawPaperBar( twTabInfo& tab, int x, int y, wxBrush& brush, wxPen& pen, wxDC& dc ) { wxPoint poly[4]; - + // draw organizer-style paper outlet - + poly[0].x = x - mTabTrianGap; poly[0].y = y; - + poly[1].x = x + mTabTrianGap; poly[1].y = y + tab.mDims.y-1; - + poly[2].x = x + tab.mDims.x - mTabTrianGap; poly[2].y = y + tab.mDims.y-1; - + poly[3].x = x + tab.mDims.x + mTabTrianGap; poly[3].y = y; - + dc.SetPen( pen ); dc.SetBrush( brush ); - + dc.DrawPolygon( 4, poly ); - + long w,h; - + // set select default font of the window into it's device context //dc.SetFont( GetLabelingFont() ); - + dc.SetTextBackground( brush.GetColour() ); - + dc.GetTextExtent(tab.mText, &w, &h ); - + if ( tab.HasImg() ) { wxMemoryDC tmpDc; tmpDc.SelectObject( tab.GetImg() ); - + dc.Blit( x + mTitleHorizGap, y + ( tab.mDims.y - tab.ImgHeight() ) / 2, tab.ImgWidth(), @@ -829,12 +813,12 @@ void wxPagedWindow::DrawPaperBar( twTabInfo& tab, int x, int y, &tmpDc, 0, 0, wxCOPY ); } - + if ( tab.HasText() ) { int tx = x + mTitleHorizGap + tab.ImgWidth() + tab.ImageToTxtGap(mImageTextGap); - + dc.DrawText( tab.GetText(), tx, y + ( tab.mDims.y - h ) / 2 ); } } // wxPagedWindow::DrawPaperBar() @@ -861,7 +845,7 @@ void wxPagedWindow::DrawDecorations( wxDC& dc ) // draw inactive tab title bars frist (left-to-right) - wxNode* pNode = mTabs.GetFirst(); + wxObjectList::compatibility_iterator pNode = mTabs.GetFirst(); size_t tabNo = 0; /* OLD STUFF:: @@ -899,48 +883,48 @@ void wxPagedWindow::DrawDecorations( wxDC& dc ) pNode = pNode->GetNext(); ++tabNo; } - + // finally, draw the active tab (white-filled) - + pNode = mTabs.GetFirst(); tabNo = 0; - + curX = mTabTrianGap; - + while( pNode ) { twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); - + if ( tabNo == mActiveTab ) { DrawPaperBar( tab, curX, curY, mWhiteBrush, mBlackPen, tmpDc ); - + tmpDc.SetPen( mWhitePen ); - + tmpDc.DrawLine( curX - mTabTrianGap+1, curY, curX + tab.mDims.x + mTabTrianGap, curY ); break; } curX += tab.mDims.x; - + pNode = pNode->GetNext(); ++tabNo; } - + // back to initial device origin - + tmpDc.SetDeviceOrigin( 0, 0 ); - + // draw resize-hint-stick - + curX = mTitleRowLen - 6; - + DrawShadedRect( curX+0, 0+0, 6, mTitleHeight, mGrayPen, mBlackPen, tmpDc ); DrawShadedRect( curX+1, 0+1, 6-2, mTitleHeight-2, mWhitePen, mDarkPen, tmpDc ); DrawShadedRect( curX+2, 0+2, 6-4, mTitleHeight-4, mGrayPen, mGrayPen, tmpDc ); - - - + + + dc.Blit( mTitleRowStart, height - mVertGap - BORDER_SZ - mTitleHeight, mTitleRowLen, mTitleHeight, @@ -957,71 +941,71 @@ int wxPagedWindow::HitTest( const wxPoint& pos ) void wxPagedWindow::RecalcLayout(bool andRepaint) { mTitleRowLen = mAdjustableTitleRowLen; - + if ( int(mpTabScroll) == -1 ) return; - + // scroll bars should be created after Create() for this window is called if ( !mpTabScroll ) { mpTabScroll = new wxScrollBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_HORIZONTAL ); - + mpHorizScroll = new wxScrollBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_HORIZONTAL ); if (!mNoVertScroll) // Vertical Scroll (Original) mpVertScroll = new wxScrollBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL ); } - + { int units = GetWholeTabRowLen() / 20; - + mpTabScroll->SetScrollbar( 0, 1, units, 1, false ); } - + // resetup position of the active tab - + int thumbLen = 16; // FOR NOW:: hardcoded - + int width, height; GetClientSize( &width, &height ); - + mTitleHeight = thumbLen; - + int curX = mHorizGap + BORDER_SZ; int curY = mVertGap + BORDER_SZ; - + int xSize; if (!mNoVertScroll) // Vertical Scroll (Original) xSize = width - mHorizGap*2 - BORDER_SZ*2 - thumbLen; else xSize = width - mHorizGap*2 - BORDER_SZ*2; - + int ySize = height - mVertGap*2 - BORDER_SZ*2 - mTitleHeight; - + SizeTabs( curX, curY, xSize, ySize, andRepaint ); - + // setup title bar LINES's horizontal scroll bar - + curY = height - mVertGap - BORDER_SZ - thumbLen; - + mpTabScroll->SetSize( curX, curY, thumbLen*2, thumbLen ); - + // setup view's HORIZONTAL scroll bar curX += thumbLen*2; - + mTitleRowStart = curX; mFirstTitleGap = curX + mCurentRowOfs + mTabTrianGap; - + mTitleRowLen = wxMin( mAdjustableTitleRowLen, width - mHorizGap - BORDER_SZ - thumbLen*4 - curX ); - + curX += mTitleRowLen; - + if (!mNoVertScroll) // Vertical Scroll (Original) mpHorizScroll->SetSize( curX, curY,width - curX - mHorizGap - BORDER_SZ - thumbLen, thumbLen ); else mpHorizScroll->SetSize( curX, curY,width - curX - mHorizGap - BORDER_SZ-4, thumbLen ); - + // setup view's VERTICAL scroll bar if (!mNoVertScroll) // Vertical Scroll (Original) { @@ -1030,33 +1014,33 @@ void wxPagedWindow::RecalcLayout(bool andRepaint) mpVertScroll->SetSize( curX, curY, thumbLen,height - curY - mVertGap - BORDER_SZ - thumbLen); } // layout tab title bars - + mLayoutType = wxTITLE_IMG_AND_TEXT; - - wxNode* pNode = mTabs.GetFirst(); - + + wxObjectList::compatibility_iterator pNode = mTabs.GetFirst(); + while( pNode ) { twTabInfo& tab = *((twTabInfo*)(pNode->GetData())); - + wxWindowDC dc(this); - + long w,h; - + // set select default font of the window into it's device context //dc.SetFont( GetLabelingFont() ); dc.GetTextExtent(tab.mText, &w, &h ); - + tab.mDims.x = w + tab.ImageToTxtGap(mImageTextGap) + tab.ImgWidth() + mTitleHorizGap*2; - + tab.mDims.y = mTitleHeight; - + pNode = pNode->GetNext(); } - + // disable title-bar scroller if there's nowhere to scroll to - + mpTabScroll->Enable( mTitleRowLen < GetWholeTabRowLen() || mCurentRowOfs < 0 ); } @@ -1082,9 +1066,9 @@ void wxPagedWindow::OnLButtonDown( wxMouseEvent& event ) { mIsDragged = true; mDagOrigin = event.m_x; - + mOriginalTitleRowLen = mAdjustableTitleRowLen; - + CaptureMouse(); } else @@ -1101,7 +1085,7 @@ void wxPagedWindow::OnLButtonUp( wxMouseEvent& WXUNUSED(event) ) mIsDragged = false; mCursorChanged = false; SetCursor( mNormalCursor ); - + ReleaseMouse(); } } // wxPagedWindow::OnLButtonUp() @@ -1111,12 +1095,12 @@ void wxPagedWindow::OnMouseMove( wxMouseEvent& event ) { int width, height; GetClientSize( &width, &height ); - + if ( !mIsDragged ) { int y = height - mVertGap - BORDER_SZ - mTitleHeight; int x = mTitleRowStart + mTitleRowLen - 6; - + if ( event.m_x >= x && event.m_y >= y && event.m_x < x + 6 && event.m_y < y + mTitleHeight @@ -1125,7 +1109,7 @@ void wxPagedWindow::OnMouseMove( wxMouseEvent& event ) if ( !mCursorChanged ) { SetCursor( mResizeCursor ); - + mCursorChanged = true; } } @@ -1133,7 +1117,7 @@ void wxPagedWindow::OnMouseMove( wxMouseEvent& event ) if ( mCursorChanged ) { SetCursor( mNormalCursor ); - + mCursorChanged = false; } } @@ -1142,15 +1126,15 @@ void wxPagedWindow::OnMouseMove( wxMouseEvent& event ) if ( mIsDragged ) { mAdjustableTitleRowLen = mOriginalTitleRowLen + ( event.m_x - mDagOrigin ); - + // FOR NOW:: fixed if ( mAdjustableTitleRowLen < 6 ) mAdjustableTitleRowLen = 6; - + wxWindowDC dc(this); DrawDecorations( dc ); - + RecalcLayout(false); - + //Refresh(); } } @@ -1163,16 +1147,16 @@ void wxPagedWindow::OnScroll( wxScrollEvent& event ) // wxMessageBox("wxPagedWindow::OnScroll","-I->"); if ( pSender == mpTabScroll ) { - + int maxUnits = GetWholeTabRowLen() / 20; - + mCurentRowOfs = -event.GetPosition()*maxUnits; - + mFirstTitleGap = mTitleRowStart + mCurentRowOfs + mTabTrianGap; - + // let' it automatically disable itself if it's time mpTabScroll->Enable( mTitleRowLen < GetWholeTabRowLen() || mCurentRowOfs < 0 ); - + // repaint title bars wxWindowDC dc(this); DrawDecorations( dc ); @@ -1182,14 +1166,14 @@ void wxPagedWindow::OnScroll( wxScrollEvent& event ) if ( !mScrollEventInProgress ) { mScrollEventInProgress = true; - + GetActiveTab()->GetEventHandler()->ProcessEvent( event ); } else { // event bounced back to us, from here we // know that it has traveled the loop - thus it's processed! - + mScrollEventInProgress = false; } }