Fixes for wxUSE_STATUSBAR.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28305 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-07-19 09:39:38 +00:00
parent 1411f7eb1a
commit 67a9999283
17 changed files with 118 additions and 19 deletions

View File

@@ -76,9 +76,10 @@ MyFrame::MyFrame() :
wxFrame( (wxFrame *) NULL, wxID_ANY, _T("wxLayout"),
wxDefaultPosition, wxDefaultSize )
{
#if wxUSE_STATUSBAR
CreateStatusBar( 2 );
SetStatusText( _T("wxLayout by Karsten Ball<6C>der.") );
#endif // wxUSE_STATUSBAR
wxMenuBar *menu_bar = new wxMenuBar();
@@ -128,7 +129,9 @@ MyFrame::MyFrame() :
SetMenuBar( menu_bar );
m_lwin = new wxLayoutWindow(this);
#if wxUSE_STATUSBAR
m_lwin->SetStatusBar(GetStatusBar(), 0, 1);
#endif // wxUSE_STATUSBAR
m_lwin->SetMouseTracking(true);
m_lwin->SetEditable(true);
m_lwin->SetWrapMargin(40);

View File

@@ -153,7 +153,9 @@ wxLayoutWindow::wxLayoutWindow(wxWindow *parent)
wxWANTS_CHARS),
m_llist(NULL)
{
#if wxUSE_STATUSBAR
SetStatusBar(NULL); // don't use statusbar
#endif // wxUSE_STATUSBAR
m_Editable = false;
m_doSendEvents = false;
m_ViewStartX = 0; m_ViewStartY = 0;
@@ -310,7 +312,9 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
// this variables is used to only erase the message in the status
// bar if we had put it there previously - otherwise empting status
// bar might be undesirable
#if wxUSE_STATUSBAR
static bool s_hasPutMessageInStatusBar = false;
#endif // wxUSE_STATUSBAR
// found is only true if we are really over an object, not just
// behind it
@@ -319,27 +323,30 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
if(!m_HandCursor)
SetCursor(wxCURSOR_HAND);
m_HandCursor = true;
#if wxUSE_STATUSBAR
if(m_StatusBar && m_StatusFieldLabel != -1)
{
const wxString &label = u->GetLabel();
if(label.Length())
{
m_StatusBar->SetStatusText(label,
m_StatusFieldLabel);
m_StatusBar->SetStatusText(label,m_StatusFieldLabel);
s_hasPutMessageInStatusBar = true;
}
}
#endif // wxUSE_STATUSBAR
}
else
{
if(m_HandCursor)
SetCursor(wxCURSOR_IBEAM);
m_HandCursor = false;
#if wxUSE_STATUSBAR
if( m_StatusBar && m_StatusFieldLabel != -1 &&
s_hasPutMessageInStatusBar )
{
m_StatusBar->SetStatusText(wxEmptyString, m_StatusFieldLabel);
}
#endif // wxUSE_STATUSBAR
}
}
@@ -1062,6 +1069,7 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
ResetDirty();
#if wxUSE_STATUSBAR
if ( m_StatusBar && m_StatusFieldCursor != -1 )
{
static wxPoint s_oldCursorPos(-1, -1);
@@ -1078,6 +1086,7 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
m_StatusBar->SetStatusText(label, m_StatusFieldCursor);
}
}
#endif // wxUSE_STATUSBAR
WXLO_TIMER_PRINT(LayoutTimer);
WXLO_TIMER_PRINT(BlitTimer);

View File

@@ -177,6 +177,7 @@ public:
/// Redraws the window, used by RequestUpdate() or OnPaint().
void InternalPaint(const wxRect *updateRect);
#if wxUSE_STATUSBAR
/** Tell window to update a wxStatusBar with UserData labels and
cursor positions.
@param bar wxStatusBar pointer
@@ -190,6 +191,7 @@ public:
m_StatusBar = bar; m_StatusFieldLabel = labelfield;
m_StatusFieldCursor = cursorfield;
}
#endif // wxUSE_STATUSBAR
#ifndef __WXMSW__
/// Enable or disable focus follow mode under non-MSW
@@ -307,8 +309,10 @@ private:
wxBitmap *m_bitmap;
wxPoint m_bitmapSize;
#if wxUSE_STATUSBAR
/// A frame's statusbar to update
class wxStatusBar *m_StatusBar;
#endif // wxUSE_STATUSBAR
/// statusbar field for labels
int m_StatusFieldLabel;