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

@ -216,9 +216,11 @@ bool MainApp::OnInit(void) // Does everything needed for a program start
menu_bar->Append(file_menu, _("&File"));
menu_bar->Append(help_menu, _("&Help"));
frame->SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
frame->CreateStatusBar(1);
Temp0.Printf(_("%s has started !"),p_ProgramCfg->GetAppName().c_str());
frame->SetStatusText(Temp0, 0);
#endif // wxUSE_STATUSBAR
//---------------------------------------------------------------------------------------
int width, height;
frame->GetClientSize(&width, &height);

View File

@ -125,15 +125,19 @@ int DBGrid::OnTableView(wxString Table)
{ // BrowserDB::OnGetNext Formats the field Value into tablename
SetCellValue(z, y,((db_Br+i_Which)->cl_BrowserDB+y)->tableName);
}
#if wxUSE_STATUSBAR
if (z % 50 == 0)
{
Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - Record %6d (from %d) has been read."),Table.c_str(),z,(db_Br+i_Which)->i_Records);
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
}
#endif // wxUSE_STATUSBAR
} // for (z=0;z<(db_Br+i_Which)->i_Records;z++)
Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - %6d Records have been read. - Time needed : %ld ms"),Table.c_str(),z,sw.Time());
wxLogMessage(Temp0);
#if wxUSE_STATUSBAR
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
#endif // wxUSE_STATUSBAR
// The Grid has been filled, now leave
goto Weiter;
} // if ((ct_BrowserDB->pTableInf+x)->pColInf)

View File

@ -221,8 +221,10 @@ int DBTree::OnPopulate()
z++;
// if (z % 10 == 0)
{
#if wxUSE_STATUSBAR
Temp0.Printf(_("-I-> DBTree::OnPopulate(%s) - Table %6d (from %d) has been read."),(ct_BrowserDB->pTableInf+x)->tableName,z,ct_BrowserDB->numTables);
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
#endif // wxUSE_STATUSBAR
}
wxYield();
} // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE" or VIEW)
@ -235,7 +237,9 @@ int DBTree::OnPopulate()
wxEndBusyCursor();
Temp0.Printf(_("-I-> DBTree::OnPopulate() - %6d Tables have been read. - Time needed : %ld ms"),z,sw.Time());
wxLogMessage(Temp0);
#if wxUSE_STATUSBAR
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
#endif // wxUSE_STATUSBAR
} // if((pDoc->db_Br+i_Which)->Initialize(false))
else
{
@ -264,7 +268,9 @@ void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
{
int i;
Temp0.Empty();
#if wxUSE_STATUSBAR
pDoc->p_MainFrame->SetStatusText(Temp0,0);
#endif // wxUSE_STATUSBAR
// Get the Information that we need
wxTreeItemId itemId = GetSelection();
DBTreeData *item = (DBTreeData *)GetItemData(itemId);

View File

@ -144,9 +144,11 @@ bool MainDoc::OnInitView()
// return false;
OnInitODBC();
//---------------------------------------------------------------------------------------
#if wxUSE_STATUSBAR
Temp0.Printf(_("-I-> MainDoc::OnInitView() - End - %d DSN's found"),i_DSN);
p_MainFrame->SetStatusText(Temp0, 0);
wxLogMessage(Temp0);
#endif // wxUSE_STATUSBAR
return true;
}

View File

@ -137,7 +137,9 @@ void PgmCtrl::OnSelChanged(wxMouseEvent& WXUNUSED(event))
{
int i;
Temp0.Empty(); Temp1.Empty();
#if wxUSE_STATUSBAR
pDoc->p_MainFrame->SetStatusText(Temp0,0);
#endif // wxUSE_STATUSBAR
// Get the Information that we need
wxTreeItemId itemId = GetSelection();
TreeData *item = (TreeData *)GetItemData(itemId);

View File

@ -198,7 +198,9 @@ FortyFrame::FortyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos
SetSizer( topsizer );
topsizer->SetSizeHints( this );
#if wxUSE_STATUSBAR
CreateStatusBar();
#endif // wxUSE_STATUSBAR
}
FortyFrame::~FortyFrame()

View File

@ -261,9 +261,11 @@ LifeFrame::LifeFrame() : wxFrame( (wxFrame *) NULL, wxID_ANY,
toolBar->Realize();
toolBar->EnableTool(ID_STOP, false); // must be after Realize() !
#if wxUSE_STATUSBAR
// status bar
CreateStatusBar(2);
SetStatusText(_("Welcome to Life!"));
#endif // wxUSE_STATUSBAR
// game and timer
m_life = new Life();
@ -884,10 +886,12 @@ void LifeCanvas::OnMouse(wxMouseEvent& event)
wxInt32 i = XToCell( event.GetX() );
wxInt32 j = YToCell( event.GetY() );
#if wxUSE_STATUSBAR
// set statusbar text
wxString msg;
msg.Printf(_("Cell: (%d, %d)"), i, j);
((LifeFrame *) wxGetApp().GetTopWindow())->SetStatusText(msg, 1);
#endif // wxUSE_STATUSBAR
// NOTE that wxMouseEvent::LeftDown() and wxMouseEvent::LeftIsDown()
// have different semantics. The first one is used to signal that the

View File

@ -120,9 +120,11 @@ public:
void SetRelatedFrame(wxFrame* frame, const wxString& format);
wxFrame* GetRelatedFrame() const {return m_RelatedFrame;}
#if wxUSE_STATUSBAR
// After(!) calling SetRelatedFrame, this sets statusbar slot where messages
// will be displayed. Default is -1 = no messages.
void SetRelatedStatusBar(int bar);
#endif // wxUSE_STATUSBAR
// Sets fonts to be used when displaying HTML page.
void SetFonts(wxString normal_face, wxString fixed_face,
@ -283,9 +285,11 @@ protected:
wxFrame *m_RelatedFrame;
wxString m_TitleFormat;
#if wxUSE_STATUSBAR
// frame in which page title should be displayed & number of it's statusbar
// reserved for usage with this html window
int m_RelatedStatusBar;
#endif // wxUSE_STATUSBAR
// borders (free space between text and window borders)
// defaults to 10 pixels.

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ü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;

View File

@ -568,6 +568,8 @@ void wxGenericMDIChildFrame::OnMenuHighlight(wxMenuEvent& event)
// but may be the MDI frame does?
m_pMDIParentFrame->OnMenuHighlight(event);
}
#else
wxUnusedVar(event);
#endif // wxUSE_STATUSBAR
}

View File

@ -338,7 +338,9 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
int notebook_page = 0;
#if wxUSE_STATUSBAR
CreateStatusBar();
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
// toolbar?
@ -377,7 +379,9 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
}
m_HtmlWin->SetRelatedFrame(this, m_TitleFormat);
#if wxUSE_STATUSBAR
m_HtmlWin->SetRelatedStatusBar(0);
#endif // wxUSE_STATUSBAR
if ( m_Config )
m_HtmlWin->ReadCustomization(m_Config, m_ConfigRoot);

View File

@ -158,7 +158,9 @@ void wxHtmlWindow::Init()
m_tmpLastCell = NULL;
m_tmpCanDrawLocks = 0;
m_FS = new wxFileSystem();
#if wxUSE_STATUSBAR
m_RelatedStatusBar = -1;
#endif // wxUSE_STATUSBAR
m_RelatedFrame = NULL;
m_TitleFormat = wxT("%s");
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
@ -228,10 +230,12 @@ void wxHtmlWindow::SetRelatedFrame(wxFrame* frame, const wxString& format)
#if wxUSE_STATUSBAR
void wxHtmlWindow::SetRelatedStatusBar(int bar)
{
m_RelatedStatusBar = bar;
}
#endif // wxUSE_STATUSBAR
@ -355,13 +359,15 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
else
{
needs_refresh = TRUE;
needs_refresh = true;
#if wxUSE_STATUSBAR
// load&display it:
if (m_RelatedStatusBar != -1)
{
m_RelatedFrame->SetStatusText(_("Connecting..."), m_RelatedStatusBar);
Refresh(FALSE);
Refresh(false);
}
#endif // wxUSE_STATUSBAR
f = m_Parser->OpenURL(wxHTML_URL_PAGE, location);
@ -377,7 +383,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
{
wxLogError(_("Unable to open requested HTML document: %s"), location.c_str());
m_tmpCanDrawLocks--;
return FALSE;
return false;
}
else
@ -385,12 +391,14 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
wxList::compatibility_iterator node;
wxString src = wxEmptyString;
#if wxUSE_STATUSBAR
if (m_RelatedStatusBar != -1)
{
wxString msg = _("Loading : ") + location;
m_RelatedFrame->SetStatusText(msg, m_RelatedStatusBar);
Refresh(FALSE);
Refresh(false);
}
#endif // wxUSE_STATUSBAR
node = m_Filters.GetFirst();
while (node)
@ -419,7 +427,10 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
delete f;
if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(_("Done"), m_RelatedStatusBar);
#if wxUSE_STATUSBAR
if (m_RelatedStatusBar != -1)
m_RelatedFrame->SetStatusText(_("Done"), m_RelatedStatusBar);
#endif // wxUSE_STATUSBAR
}
}
@ -1118,6 +1129,7 @@ void wxHtmlWindow::OnInternalIdle()
if (lnk != m_tmpLastLink)
{
#if wxUSE_STATUSBAR
if (lnk == NULL)
{
if (m_RelatedStatusBar != -1)
@ -1130,6 +1142,7 @@ void wxHtmlWindow::OnInternalIdle()
m_RelatedFrame->SetStatusText(lnk->GetHref(),
m_RelatedStatusBar);
}
#endif // wxUSE_STATUSBAR
m_tmpLastLink = lnk;
}

View File

@ -234,7 +234,9 @@ wxMDIParentFrame::~wxMDIParentFrame()
#if wxUSE_TOOLBAR
m_frameToolBar = NULL;
#endif
#if wxUSE_STATUSBAR
m_frameStatusBar = NULL;
#endif // wxUSE_STATUSBAR
DestroyChildren();
@ -732,7 +734,9 @@ wxMDIChildFrame::~wxMDIChildFrame()
#if wxUSE_TOOLBAR
m_frameToolBar = NULL;
#endif
#if wxUSE_STATUSBAR
m_frameStatusBar = NULL;
#endif // wxUSE_STATUSBAR
DestroyChildren();
@ -759,12 +763,14 @@ void wxMDIChildFrame::DoSetClientSize(int width, int height)
int actual_width = rect2.right - rect2.left - rect.right + width;
int actual_height = rect2.bottom - rect2.top - rect.bottom + height;
#if wxUSE_STATUSBAR
if (GetStatusBar() && GetStatusBar()->IsShown())
{
int sx, sy;
GetStatusBar()->GetSize(&sx, &sy);
actual_height += sy;
}
#endif // wxUSE_STATUSBAR
POINT point;
point.x = rect2.left;

View File

@ -259,7 +259,9 @@ void wxFrame::DoSetClientSize(int width, int height)
#if wxUSE_TOOLBAR
if ( m_frameToolBar )
{
#if wxUSE_STATUSBAR
height += m_frameStatusBar->GetSize().y;
#endif // wxUSE_STATUSBAR
if ( m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL )
width += m_frameToolBar->GetSize().x;

View File

@ -311,7 +311,9 @@ bool MyApp::OnInit()
// Create the main frame window
frame = new MyFrame(NULL, wxID_ANY, _T("Tex2RTF"), wxDefaultPosition, wxSize(400, 300));
#if wxUSE_STATUSBAR
frame->CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
// Give it an icon
// TODO: uncomment this when we have tex2rtf.xpm
@ -391,16 +393,26 @@ bool MyApp::OnInit()
if (path != _T(""))
ReadCustomMacros((wxChar *)path.c_str());
#if wxUSE_STATUSBAR
wxStrcpy(buf, _T("In "));
if (winHelp && (convertMode == TEX_RTF))
wxStrcat(buf, _T("WinHelp RTF"));
else if (!winHelp && (convertMode == TEX_RTF))
wxStrcat(buf, _T("linear RTF"));
else if (convertMode == TEX_HTML) wxStrcat(buf, _T("HTML"));
else if (convertMode == TEX_XLP) wxStrcat(buf, _T("XLP"));
wxStrcat(buf, _T(" mode."));
switch (convertMode)
{
case TEX_RTF:
wxStrcat(buf, (winHelp) ? _T("WinHelp RTF"), _T("linear RTF"));
break;
case TEX_HTML:
wxStrcat(buf, _T("HTML"));
break;
case TEX_XLP:
wxStrcat(buf, _T("XLP"));
break;
default:
wxStrcat(buf, _T("unknown"));
break;
}
wxStrcat(buf, _T(" mode."));
frame->SetStatusText(buf, 1);
#endif // wxUSE_STATUSBAR
frame->Show(true);
return true;
@ -649,7 +661,9 @@ void MyFrame::OnGo(wxCommandEvent& WXUNUSED(event))
if (stopRunning)
{
#if wxUSE_STATUSBAR
SetStatusText(_T("Build aborted!"));
#endif // wxUSE_STATUSBAR
wxString errBuf;
errBuf.Printf(_T("\nErrors encountered during this pass: %lu\n"), errorCount);
OnInform((wxChar *)errBuf.c_str());
@ -683,9 +697,11 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
if (s != _T(""))
{
textWindow->SaveFile(s);
#if wxUSE_STATUSBAR
wxChar buf[350];
wxSnprintf(buf, sizeof(buf), _T("Saved text to %s"), (const wxChar*) s.c_str());
frame->SetStatusText(buf, 0);
#endif // wxUSE_STATUSBAR
}
}
@ -740,7 +756,9 @@ void MyFrame::OnModeRTF(wxCommandEvent& WXUNUSED(event))
winHelp = false;
InputFile = NULL;
OutputFile = NULL;
#if wxUSE_STATUSBAR
SetStatusText(_T("In linear RTF mode."), 1);
#endif // wxUSE_STATUSBAR
}
void MyFrame::OnModeWinHelp(wxCommandEvent& WXUNUSED(event))
@ -749,7 +767,9 @@ void MyFrame::OnModeWinHelp(wxCommandEvent& WXUNUSED(event))
winHelp = true;
InputFile = NULL;
OutputFile = NULL;
#if wxUSE_STATUSBAR
SetStatusText(_T("In WinHelp RTF mode."), 1);
#endif // wxUSE_STATUSBAR
}
void MyFrame::OnModeHTML(wxCommandEvent& WXUNUSED(event))
@ -758,7 +778,9 @@ void MyFrame::OnModeHTML(wxCommandEvent& WXUNUSED(event))
winHelp = false;
InputFile = NULL;
OutputFile = NULL;
#if wxUSE_STATUSBAR
SetStatusText(_T("In HTML mode."), 1);
#endif // wxUSE_STATUSBAR
}
void MyFrame::OnModeXLP(wxCommandEvent& WXUNUSED(event))
@ -766,12 +788,15 @@ void MyFrame::OnModeXLP(wxCommandEvent& WXUNUSED(event))
convertMode = TEX_XLP;
InputFile = NULL;
OutputFile = NULL;
#if wxUSE_STATUSBAR
SetStatusText(_T("In XLP mode."), 1);
#endif // wxUSE_STATUSBAR
}
void MyFrame::OnOptionsCurleyBrace(wxCommandEvent& WXUNUSED(event))
{
checkCurleyBraces = !checkCurleyBraces;
#if wxUSE_STATUSBAR
if (checkCurleyBraces)
{
SetStatusText(_T("Checking curley braces: YES"), 1);
@ -780,12 +805,14 @@ void MyFrame::OnOptionsCurleyBrace(wxCommandEvent& WXUNUSED(event))
{
SetStatusText(_T("Checking curley braces: NO"), 1);
}
#endif // wxUSE_STATUSBAR
}
void MyFrame::OnOptionsSyntaxChecking(wxCommandEvent& WXUNUSED(event))
{
checkSyntax = !checkSyntax;
#if wxUSE_STATUSBAR
if (checkSyntax)
{
SetStatusText(_T("Checking syntax: YES"), 1);
@ -794,6 +821,7 @@ void MyFrame::OnOptionsSyntaxChecking(wxCommandEvent& WXUNUSED(event))
{
SetStatusText(_T("Checking syntax: NO"), 1);
}
#endif // wxUSE_STATUSBAR
}
@ -955,7 +983,7 @@ bool Go(void)
TexCleanUp();
return false;
}
#ifndef NO_GUI
#if !defined(NO_GUI) && wxUSE_STATUSBAR
if (isInteractive)
{
wxString buf;
@ -1018,11 +1046,13 @@ bool Go(void)
OnInform((wxChar *)buf.c_str());
}
#if wxUSE_STATUSBAR
if (isInteractive)
{
buf.Printf(_T("Done, %d %s."), passNumber, (passNumber > 1) ? _T("passes") : _T("pass"));
frame->SetStatusText((wxChar *)buf.c_str());
}
#endif // wxUSE_STATUSBAR
#else
buf.Printf(_T("Done, %d %s."), passNumber, (passNumber > 1) ? _T("passes") : _T("pass"));
OnInform((wxChar *)buf.c_str());
@ -1041,7 +1071,7 @@ bool Go(void)
TexCleanUp();
startedSections = false;
#ifndef NO_GUI
#if !defined(NO_GUI) && wxUSE_STATUSBAR
frame->SetStatusText(_T("Aborted by user."));
#endif // GUI
@ -1276,7 +1306,7 @@ bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data,
{
// Try for a setting
wxStrcpy(Tex2RTFLastStatus, RegisterSetting(firstArg, secondArg, false));
#ifndef NO_GUI
#if !defined(NO_GUI) && wxUSE_STATUSBAR
if (frame && wxStrcmp(firstArg, _T("conversionMode")) == 0)
{
wxChar buf[100];