1. wxWizard supports setting images for each page, sample updated to show it
2. wxLogGui now uses a special dialog instead of a wxMsgBox 3. wxComboBox doesn't limit the text to its size under MSW 4. removed windows.h from dummy.cpp because I think it's unneeded git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5558 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
cded6e3c28
commit
f1df09276c
@ -13,7 +13,10 @@
|
|||||||
// wxWizard
|
// wxWizard
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxWizard : public wxWizardBase
|
class WXDLLEXPORT wxButton;
|
||||||
|
class WXDLLEXPORT wxStaticBitmap;
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxWizard : public wxWizardBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// ctor
|
// ctor
|
||||||
@ -52,10 +55,12 @@ private:
|
|||||||
|
|
||||||
// wizard state
|
// wizard state
|
||||||
wxWizardPage *m_page; // the current page or NULL
|
wxWizardPage *m_page; // the current page or NULL
|
||||||
|
wxBitmap m_bitmap; // the default bitmap to show
|
||||||
|
|
||||||
// wizard controls
|
// wizard controls
|
||||||
wxButton *m_btnPrev, // the "<Back" button
|
wxButton *m_btnPrev, // the "<Back" button
|
||||||
*m_btnNext; // the "Next>" or "Finish" button
|
*m_btnNext; // the "Next>" or "Finish" button
|
||||||
|
wxStaticBitmap *m_statbmp; // the control for the bitmap
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxWizard)
|
DECLARE_DYNAMIC_CLASS(wxWizard)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@ -286,8 +286,9 @@ protected:
|
|||||||
// empty everything
|
// empty everything
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
wxArrayString m_aMessages;
|
wxArrayString m_aMessages; // the log message texts
|
||||||
wxArrayLong m_aTimes;
|
wxArrayInt m_aSeverity; // one of wxLOG_XXX values
|
||||||
|
wxArrayLong m_aTimes; // the time of each message
|
||||||
bool m_bErrors, // do we have any errors?
|
bool m_bErrors, // do we have any errors?
|
||||||
m_bWarnings; // any warnings?
|
m_bWarnings; // any warnings?
|
||||||
};
|
};
|
||||||
|
@ -38,15 +38,26 @@ class WXDLLEXPORT wxWizard;
|
|||||||
class WXDLLEXPORT wxWizardPage : public wxPanel
|
class WXDLLEXPORT wxWizardPage : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// ctor: no other parameters are needed because the wizard will resize and
|
// ctor accepts an optional bitmap which will be used for this page instead
|
||||||
|
// of the default one for this wizard (should be of the same size). Notice
|
||||||
|
// that no other parameters are needed because the wizard will resize and
|
||||||
// reposition the page anyhow
|
// reposition the page anyhow
|
||||||
wxWizardPage(wxWizard *parent);
|
wxWizardPage(wxWizard *parent, const wxBitmap& bitmap = wxNullBitmap);
|
||||||
|
|
||||||
// these functions are used by the wizard to show another page when the
|
// these functions are used by the wizard to show another page when the
|
||||||
// user chooses "Back" or "Next" button
|
// user chooses "Back" or "Next" button
|
||||||
virtual wxWizardPage *GetPrev() const = 0;
|
virtual wxWizardPage *GetPrev() const = 0;
|
||||||
virtual wxWizardPage *GetNext() const = 0;
|
virtual wxWizardPage *GetNext() const = 0;
|
||||||
|
|
||||||
|
// default GetBitmap() will just return m_bitmap which is ok in 99% of
|
||||||
|
// cases - override this method if you want to create the bitmap to be used
|
||||||
|
// dynamically or to do something even more fancy. It's ok to return
|
||||||
|
// wxNullBitmap from here - the default one will be used then.
|
||||||
|
virtual wxBitmap GetBitmap() const { return m_bitmap; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxBitmap m_bitmap;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_ABSTRACT_CLASS(wxWizardPage)
|
DECLARE_ABSTRACT_CLASS(wxWizardPage)
|
||||||
};
|
};
|
||||||
|
@ -1995,7 +1995,6 @@ wxDbInf *wxDB::GetCatalog(char *userID)
|
|||||||
{
|
{
|
||||||
wxDbInf *pDbInf = NULL; // Array of catalog entries
|
wxDbInf *pDbInf = NULL; // Array of catalog entries
|
||||||
int noTab = 0; // Counter while filling table entries
|
int noTab = 0; // Counter while filling table entries
|
||||||
int i = 0;
|
|
||||||
int pass;
|
int pass;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
SDWORD cb;
|
SDWORD cb;
|
||||||
|
@ -47,9 +47,10 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString &message )
|
|||||||
|
|
||||||
// get line height for empty lines
|
// get line height for empty lines
|
||||||
int y = 0;
|
int y = 0;
|
||||||
wxFont new_font( GetFont() );
|
wxFont font( GetFont() );
|
||||||
if (!new_font.Ok()) new_font = *wxSWISS_FONT;
|
if (!font.Ok())
|
||||||
GetTextExtent( "H", (int*)NULL, &y, (int*)NULL, (int*)NULL, &new_font );
|
font = *wxSWISS_FONT;
|
||||||
|
GetTextExtent(_T("H"), (int*)NULL, &y, (int*)NULL, (int*)NULL, &font);
|
||||||
|
|
||||||
wxString line;
|
wxString line;
|
||||||
for (size_t pos = 0; pos < message.Len(); pos++)
|
for (size_t pos = 0; pos < message.Len(); pos++)
|
||||||
@ -59,13 +60,13 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString &message )
|
|||||||
if (!line.IsEmpty())
|
if (!line.IsEmpty())
|
||||||
{
|
{
|
||||||
wxStaticText *s1 = new wxStaticText( this, -1, line );
|
wxStaticText *s1 = new wxStaticText( this, -1, line );
|
||||||
box->Add( s1 );
|
box->Add( s1 );
|
||||||
line = wxT("");
|
line = wxT("");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
box->Add( 5, y );
|
box->Add( 5, y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -77,7 +78,7 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString &message )
|
|||||||
if (!line.IsEmpty())
|
if (!line.IsEmpty())
|
||||||
{
|
{
|
||||||
wxStaticText *s2 = new wxStaticText( this, -1, line );
|
wxStaticText *s2 = new wxStaticText( this, -1, line );
|
||||||
box->Add( s2 );
|
box->Add( s2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
@ -88,9 +89,9 @@ wxSizer *wxDialogBase::CreateButtonSizer( long flags )
|
|||||||
wxBoxSizer *box = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer *box = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
#if defined(__WXMSW__) || defined(__WXMAC__)
|
#if defined(__WXMSW__) || defined(__WXMAC__)
|
||||||
int margin = 6;
|
static const int margin = 6;
|
||||||
#else
|
#else
|
||||||
int margin = 10;
|
static const int margin = 10;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxButton *ok = (wxButton *) NULL;
|
wxButton *ok = (wxButton *) NULL;
|
||||||
|
@ -922,27 +922,22 @@ void wxWindowBase::SetSizer(wxSizer *sizer)
|
|||||||
|
|
||||||
bool wxWindowBase::Layout()
|
bool wxWindowBase::Layout()
|
||||||
{
|
{
|
||||||
int w, h;
|
|
||||||
GetClientSize(&w, &h);
|
|
||||||
|
|
||||||
// If there is a sizer, use it instead of the constraints
|
// If there is a sizer, use it instead of the constraints
|
||||||
if ( GetSizer() )
|
if ( GetSizer() )
|
||||||
{
|
{
|
||||||
GetSizer()->SetDimension( 0, 0, w, h );
|
int w, h;
|
||||||
return TRUE;
|
GetClientSize(&w, &h);
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetConstraints() )
|
GetSizer()->SetDimension( 0, 0, w, h );
|
||||||
{
|
}
|
||||||
GetConstraints()->width.SetValue(w);
|
else
|
||||||
GetConstraints()->height.SetValue(h);
|
{
|
||||||
|
// Evaluate child constraints
|
||||||
|
ResetConstraints(); // Mark all constraints as unevaluated
|
||||||
|
DoPhase(1); // Just one phase need if no sizers involved
|
||||||
|
DoPhase(2);
|
||||||
|
SetConstraintSizes(); // Recursively set the real window sizes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate child constraints
|
|
||||||
ResetConstraints(); // Mark all constraints as unevaluated
|
|
||||||
DoPhase(1); // Just one phase need if no sizers involved
|
|
||||||
DoPhase(2);
|
|
||||||
SetConstraintSizes(); // Recursively set the real window sizes
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1028,6 +1023,7 @@ void wxWindowBase::ResetConstraints()
|
|||||||
constr->centreX.SetDone(FALSE);
|
constr->centreX.SetDone(FALSE);
|
||||||
constr->centreY.SetDone(FALSE);
|
constr->centreY.SetDone(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindowList::Node *node = GetChildren().GetFirst();
|
wxWindowList::Node *node = GetChildren().GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@ -1064,21 +1060,12 @@ void wxWindowBase::SetConstraintSizes(bool recurse)
|
|||||||
}
|
}
|
||||||
else if ( constr )
|
else if ( constr )
|
||||||
{
|
{
|
||||||
wxChar *windowClass = GetClassInfo()->GetClassName();
|
wxString winName = GetName();
|
||||||
|
if ( !winName )
|
||||||
wxString winName;
|
|
||||||
if ( GetName() == wxT("") )
|
|
||||||
winName = wxT("unnamed");
|
winName = wxT("unnamed");
|
||||||
else
|
wxLogDebug(wxT("Constraint not satisfied for %s, name '%s'."),
|
||||||
winName = GetName();
|
GetClassInfo()->GetClassName(),
|
||||||
wxLogDebug( wxT("Constraint(s) not satisfied for window of type %s, name %s:\n"),
|
winName.c_str());
|
||||||
(const wxChar *)windowClass,
|
|
||||||
(const wxChar *)winName);
|
|
||||||
if ( !constr->left.GetDone()) wxLogDebug( wxT(" unsatisfied 'left' constraint.\n") );
|
|
||||||
if ( !constr->right.GetDone()) wxLogDebug( wxT(" unsatisfied 'right' constraint.\n") );
|
|
||||||
if ( !constr->width.GetDone()) wxLogDebug( wxT(" unsatisfied 'width' constraint.\n") );
|
|
||||||
if ( !constr->height.GetDone()) wxLogDebug( wxT(" unsatisfied 'height' constraint.\n") );
|
|
||||||
wxLogDebug( wxT("Please check constraints: try adding AsIs() constraints.\n") );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( recurse )
|
if ( recurse )
|
||||||
|
@ -38,8 +38,9 @@
|
|||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
#include "wx/msgdlg.h"
|
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
|
#include "wx/sizer.h"
|
||||||
|
#include "wx/statbmp.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/file.h"
|
#include "wx/file.h"
|
||||||
@ -50,6 +51,62 @@
|
|||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
#endif // Windows
|
#endif // Windows
|
||||||
|
|
||||||
|
// may be defined to 0 for old behavior (using wxMessageBox) - shouldn't be
|
||||||
|
// changed normally (that's why it's here and not in setup.h)
|
||||||
|
#define wxUSE_LOG_DIALOG 1
|
||||||
|
|
||||||
|
#if wxUSE_LOG_DIALOG
|
||||||
|
#include "wx/datetime.h"
|
||||||
|
#include "wx/listctrl.h"
|
||||||
|
#include "wx/image.h"
|
||||||
|
#else // !wxUSE_TEXTFILE
|
||||||
|
#include "wx/msgdlg.h"
|
||||||
|
#endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// private classes
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_LOG_DIALOG
|
||||||
|
|
||||||
|
class wxLogDialog : public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxLogDialog(wxWindow *parent,
|
||||||
|
const wxArrayString& messages,
|
||||||
|
const wxArrayInt& severity,
|
||||||
|
const wxArrayLong& timess,
|
||||||
|
const wxString& caption,
|
||||||
|
long style);
|
||||||
|
virtual ~wxLogDialog();
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
void OnOk(wxCommandEvent& event);
|
||||||
|
void OnDetails(wxCommandEvent& event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// the data for the listctrl
|
||||||
|
const wxArrayString& m_messages;
|
||||||
|
const wxArrayInt& m_severity;
|
||||||
|
const wxArrayLong& m_times;
|
||||||
|
|
||||||
|
// the "toggle" button and its state
|
||||||
|
wxButton *m_btnDetails;
|
||||||
|
bool m_showingDetails;
|
||||||
|
|
||||||
|
// the listctrl (not shown initially)
|
||||||
|
wxListCtrl *m_listctrl;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxLogDialog, wxDialog)
|
||||||
|
EVT_BUTTON(wxID_OK, wxLogDialog::OnOk)
|
||||||
|
EVT_BUTTON(wxID_MORE, wxLogDialog::OnDetails)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
#endif // wxUSE_LOG_DIALOG
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// global variables
|
// global variables
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -117,6 +174,7 @@ void wxLogGui::Clear()
|
|||||||
{
|
{
|
||||||
m_bErrors = m_bWarnings = FALSE;
|
m_bErrors = m_bWarnings = FALSE;
|
||||||
m_aMessages.Empty();
|
m_aMessages.Empty();
|
||||||
|
m_aSeverity.Empty();
|
||||||
m_aTimes.Empty();
|
m_aTimes.Empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +186,34 @@ void wxLogGui::Flush()
|
|||||||
// do it right now to block any new calls to Flush() while we're here
|
// do it right now to block any new calls to Flush() while we're here
|
||||||
m_bHasMessages = FALSE;
|
m_bHasMessages = FALSE;
|
||||||
|
|
||||||
|
wxString title = wxTheApp->GetAppName();
|
||||||
|
if ( !!title )
|
||||||
|
{
|
||||||
|
title[0u] = wxToupper(title[0u]);
|
||||||
|
title += _T(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
long style;
|
||||||
|
if ( m_bErrors ) {
|
||||||
|
title += _("Error");
|
||||||
|
style = wxICON_STOP;
|
||||||
|
}
|
||||||
|
else if ( m_bWarnings ) {
|
||||||
|
title += _("Warning");
|
||||||
|
style = wxICON_EXCLAMATION;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
title += _("Information");
|
||||||
|
style = wxICON_INFORMATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if wxUSE_LOG_DIALOG
|
||||||
|
wxLogDialog dlg(wxTheApp->GetTopWindow(),
|
||||||
|
m_aMessages, m_aSeverity, m_aTimes,
|
||||||
|
title, style);
|
||||||
|
(void)dlg.ShowModal();
|
||||||
|
|
||||||
|
#else // !wxUSE_LOG_DIALOG
|
||||||
// concatenate all strings (but not too many to not overfill the msg box)
|
// concatenate all strings (but not too many to not overfill the msg box)
|
||||||
wxString str;
|
wxString str;
|
||||||
size_t nLines = 0,
|
size_t nLines = 0,
|
||||||
@ -146,27 +232,12 @@ void wxLogGui::Flush()
|
|||||||
str << m_aMessages[n - 1] << wxT("\n");
|
str << m_aMessages[n - 1] << wxT("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxChar *title;
|
|
||||||
long style;
|
|
||||||
|
|
||||||
if ( m_bErrors ) {
|
|
||||||
title = _("Error");
|
|
||||||
style = wxICON_STOP;
|
|
||||||
}
|
|
||||||
else if ( m_bWarnings ) {
|
|
||||||
title = _("Warning");
|
|
||||||
style = wxICON_EXCLAMATION;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
title = _("Information");
|
|
||||||
style = wxICON_INFORMATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMessageBox(str, title, wxOK | style);
|
wxMessageBox(str, title, wxOK | style);
|
||||||
|
#endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG
|
||||||
|
|
||||||
// no undisplayed messages whatsoever
|
// no undisplayed messages whatsoever
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
// do it here again
|
// do it here again
|
||||||
m_bHasMessages = FALSE;
|
m_bHasMessages = FALSE;
|
||||||
}
|
}
|
||||||
@ -179,80 +250,88 @@ void wxLogGui::DoLog(wxLogLevel level, const wxChar *szString, time_t t)
|
|||||||
case wxLOG_Info:
|
case wxLOG_Info:
|
||||||
if ( GetVerbose() )
|
if ( GetVerbose() )
|
||||||
case wxLOG_Message:
|
case wxLOG_Message:
|
||||||
|
{
|
||||||
if ( !m_bErrors ) {
|
if ( !m_bErrors ) {
|
||||||
m_aMessages.Add(szString);
|
m_aMessages.Add(szString);
|
||||||
|
m_aSeverity.Add(wxLOG_Message);
|
||||||
m_aTimes.Add((long)t);
|
m_aTimes.Add((long)t);
|
||||||
m_bHasMessages = TRUE;
|
m_bHasMessages = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case wxLOG_Status:
|
case wxLOG_Status:
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
{
|
{
|
||||||
// find the top window and set it's status text if it has any
|
// find the top window and set it's status text if it has any
|
||||||
wxFrame *pFrame = gs_pFrame;
|
wxFrame *pFrame = gs_pFrame;
|
||||||
if ( pFrame == NULL ) {
|
if ( pFrame == NULL ) {
|
||||||
wxWindow *pWin = wxTheApp->GetTopWindow();
|
wxWindow *pWin = wxTheApp->GetTopWindow();
|
||||||
if ( pWin != NULL && pWin->IsKindOf(CLASSINFO(wxFrame)) ) {
|
if ( pWin != NULL && pWin->IsKindOf(CLASSINFO(wxFrame)) ) {
|
||||||
pFrame = (wxFrame *)pWin;
|
pFrame = (wxFrame *)pWin;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pFrame && pFrame->GetStatusBar() )
|
|
||||||
pFrame->SetStatusText(szString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( pFrame && pFrame->GetStatusBar() )
|
||||||
|
pFrame->SetStatusText(szString);
|
||||||
|
}
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxLOG_Trace:
|
case wxLOG_Trace:
|
||||||
case wxLOG_Debug:
|
case wxLOG_Debug:
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// don't prepend debug/trace here: it goes to the
|
// don't prepend debug/trace here: it goes to the
|
||||||
// debug window anyhow, but do put a timestamp
|
// debug window anyhow, but do put a timestamp
|
||||||
wxString str;
|
wxString str;
|
||||||
TimeStamp(&str);
|
TimeStamp(&str);
|
||||||
str << szString << wxT("\n\r");
|
str << szString << wxT("\n\r");
|
||||||
OutputDebugString(str);
|
OutputDebugString(str);
|
||||||
#else
|
#else
|
||||||
// send them to stderr
|
// send them to stderr
|
||||||
wxFprintf(stderr, wxT("%s: %s\n"),
|
wxFprintf(stderr, wxT("%s: %s\n"),
|
||||||
level == wxLOG_Trace ? wxT("Trace")
|
level == wxLOG_Trace ? wxT("Trace")
|
||||||
: wxT("Debug"),
|
: wxT("Debug"),
|
||||||
szString);
|
szString);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxLOG_FatalError:
|
case wxLOG_FatalError:
|
||||||
// show this one immediately
|
// show this one immediately
|
||||||
wxMessageBox(szString, _("Fatal error"), wxICON_HAND);
|
wxMessageBox(szString, _("Fatal error"), wxICON_HAND);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxLOG_Error:
|
case wxLOG_Error:
|
||||||
|
if ( !m_bErrors ) {
|
||||||
|
#if !wxUSE_LOG_DIALOG
|
||||||
// discard earlier informational messages if this is the 1st
|
// discard earlier informational messages if this is the 1st
|
||||||
// error because they might not make sense any more
|
// error because they might not make sense any more and showing
|
||||||
if ( !m_bErrors ) {
|
// them in a message box might be confusing
|
||||||
m_aMessages.Empty();
|
m_aMessages.Empty();
|
||||||
m_aTimes.Empty();
|
m_aSeverity.Empty();
|
||||||
m_bErrors = TRUE;
|
m_aTimes.Empty();
|
||||||
}
|
#endif // wxUSE_LOG_DIALOG
|
||||||
// fall through
|
m_bErrors = TRUE;
|
||||||
|
}
|
||||||
|
// fall through
|
||||||
|
|
||||||
case wxLOG_Warning:
|
case wxLOG_Warning:
|
||||||
if ( !m_bErrors ) {
|
if ( !m_bErrors ) {
|
||||||
// for the warning we don't discard the info messages
|
// for the warning we don't discard the info messages
|
||||||
m_bWarnings = TRUE;
|
m_bWarnings = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_aMessages.Add(szString);
|
m_aMessages.Add(szString);
|
||||||
m_aTimes.Add((long)t);
|
m_aSeverity.Add(level);
|
||||||
m_bHasMessages = TRUE;
|
m_aTimes.Add((long)t);
|
||||||
break;
|
m_bHasMessages = TRUE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,10 +546,7 @@ void wxLogWindow::DoLog(wxLogLevel level, const wxChar *szString, time_t t)
|
|||||||
{
|
{
|
||||||
// first let the previous logger show it
|
// first let the previous logger show it
|
||||||
if ( m_pOldLog != NULL && m_bPassMessages ) {
|
if ( m_pOldLog != NULL && m_bPassMessages ) {
|
||||||
// FIXME why can't we access protected wxLog method from here (we derive
|
// bogus cast just to access protected DoLog
|
||||||
// from wxLog)? gcc gives "DoLog is protected in this context", what
|
|
||||||
// does this mean? Anyhow, the cast is harmless and let's us do what
|
|
||||||
// we want.
|
|
||||||
((wxLogWindow *)m_pOldLog)->DoLog(level, szString, t);
|
((wxLogWindow *)m_pOldLog)->DoLog(level, szString, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,3 +621,168 @@ wxLogWindow::~wxLogWindow()
|
|||||||
delete m_pLogFrame;
|
delete m_pLogFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxLogDialog
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_LOG_DIALOG
|
||||||
|
|
||||||
|
static const size_t MARGIN = 10;
|
||||||
|
|
||||||
|
wxLogDialog::wxLogDialog(wxWindow *parent,
|
||||||
|
const wxArrayString& messages,
|
||||||
|
const wxArrayInt& severity,
|
||||||
|
const wxArrayLong& times,
|
||||||
|
const wxString& caption,
|
||||||
|
long style)
|
||||||
|
: wxDialog(parent, -1, caption),
|
||||||
|
m_messages(messages), m_severity(severity), m_times(times)
|
||||||
|
{
|
||||||
|
m_showingDetails = FALSE; // not initially
|
||||||
|
m_listctrl = (wxListCtrl *)NULL;
|
||||||
|
|
||||||
|
// create the controls which are always shown and layout them: we use
|
||||||
|
// sizers even though our window is not resizeable to calculate the size of
|
||||||
|
// the dialog properly
|
||||||
|
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||||
|
wxBoxSizer *sizerButtons = new wxBoxSizer(wxVERTICAL);
|
||||||
|
wxBoxSizer *sizerAll = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
wxButton *btnOk = new wxButton(this, wxID_OK, _T("Ok"));
|
||||||
|
m_btnDetails = new wxButton(this, wxID_MORE, _T("&Details >>"));
|
||||||
|
sizerButtons->Add(btnOk, 0, wxCENTRE|wxBOTTOM, MARGIN/2);
|
||||||
|
sizerButtons->Add(m_btnDetails, 0, wxCENTRE|wxTOP, MARGIN/2 - 1);
|
||||||
|
|
||||||
|
wxIcon icon = wxTheApp->GetStdIcon(style & wxICON_MASK);
|
||||||
|
sizerAll->Add(new wxStaticBitmap(this, -1, icon), 0, wxCENTRE);
|
||||||
|
const wxString& message = messages.Last();
|
||||||
|
sizerAll->Add(CreateTextSizer(message), 0, wxCENTRE|wxLEFT|wxRIGHT, MARGIN);
|
||||||
|
sizerAll->Add(sizerButtons, 0, wxALIGN_RIGHT|wxLEFT, MARGIN);
|
||||||
|
|
||||||
|
sizerTop->Add(sizerAll, 0, wxCENTRE|wxALL, MARGIN);
|
||||||
|
|
||||||
|
SetAutoLayout(TRUE);
|
||||||
|
SetSizer(sizerTop);
|
||||||
|
|
||||||
|
sizerTop->SetSizeHints(this);
|
||||||
|
sizerTop->Fit(this);
|
||||||
|
|
||||||
|
btnOk->SetFocus();
|
||||||
|
|
||||||
|
Centre();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxLogDialog::OnOk(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
EndModal(wxID_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
wxSizer *sizer = GetSizer();
|
||||||
|
|
||||||
|
if ( m_showingDetails )
|
||||||
|
{
|
||||||
|
m_btnDetails->SetLabel(_T("&Details >>"));
|
||||||
|
|
||||||
|
sizer->Remove(m_listctrl);
|
||||||
|
}
|
||||||
|
else // show details now
|
||||||
|
{
|
||||||
|
m_btnDetails->SetLabel(_T("<< &Details"));
|
||||||
|
|
||||||
|
if ( !m_listctrl )
|
||||||
|
{
|
||||||
|
// create it now
|
||||||
|
m_listctrl = new wxListCtrl(this, -1,
|
||||||
|
wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxLC_REPORT | wxLC_NO_HEADER);
|
||||||
|
m_listctrl->InsertColumn(0, _("Message"));
|
||||||
|
m_listctrl->InsertColumn(1, _("Time"));
|
||||||
|
|
||||||
|
// prepare the imagelist
|
||||||
|
static const int ICON_SIZE = 16;
|
||||||
|
wxImageList *imageList = new wxImageList(ICON_SIZE, ICON_SIZE);
|
||||||
|
|
||||||
|
// order should be the same as in the switch below!
|
||||||
|
static const int icons[] =
|
||||||
|
{
|
||||||
|
wxICON_ERROR,
|
||||||
|
wxICON_EXCLAMATION,
|
||||||
|
wxICON_INFORMATION
|
||||||
|
};
|
||||||
|
|
||||||
|
for ( size_t icon = 0; icon < WXSIZEOF(icons); icon++ )
|
||||||
|
{
|
||||||
|
wxBitmap bmp = wxTheApp->GetStdIcon(icons[icon]);
|
||||||
|
imageList->Add(wxImage(bmp).
|
||||||
|
Rescale(ICON_SIZE, ICON_SIZE).
|
||||||
|
ConvertToBitmap());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_listctrl->SetImageList(imageList, wxIMAGE_LIST_SMALL);
|
||||||
|
|
||||||
|
// and fill it
|
||||||
|
wxString fmt = wxLog::GetTimestamp();
|
||||||
|
if ( !fmt )
|
||||||
|
{
|
||||||
|
// default format
|
||||||
|
fmt = _T("%X");
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t count = m_messages.GetCount();
|
||||||
|
for ( size_t n = 0; n < count; n++ )
|
||||||
|
{
|
||||||
|
int image;
|
||||||
|
switch ( m_severity[n] )
|
||||||
|
{
|
||||||
|
case wxLOG_Error:
|
||||||
|
image = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxLOG_Warning:
|
||||||
|
image = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
image = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_listctrl->InsertItem(n, m_messages[n], image);
|
||||||
|
m_listctrl->SetItem(n, 1,
|
||||||
|
wxDateTime((time_t)m_times[n]).Format(fmt));
|
||||||
|
}
|
||||||
|
|
||||||
|
// let the columns size themselves (TODO does this work under GTK?)
|
||||||
|
m_listctrl->SetColumnWidth(0, wxLIST_AUTOSIZE);
|
||||||
|
m_listctrl->SetColumnWidth(1, wxLIST_AUTOSIZE);
|
||||||
|
|
||||||
|
// get the approx height of the listctrl
|
||||||
|
wxFont font = GetFont();
|
||||||
|
if ( !font.Ok() )
|
||||||
|
font = *wxSWISS_FONT;
|
||||||
|
|
||||||
|
int y;
|
||||||
|
GetTextExtent(_T("H"), (int*)NULL, &y, (int*)NULL, (int*)NULL, &font);
|
||||||
|
int height = wxMin(y*(count + 3), 100);
|
||||||
|
m_listctrl->SetSize(-1, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
sizer->Add(m_listctrl, 1, wxEXPAND|(wxALL & ~wxTOP), MARGIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_showingDetails = !m_showingDetails;
|
||||||
|
|
||||||
|
// in any case, our size changed - update
|
||||||
|
sizer->Fit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxLogDialog::~wxLogDialog()
|
||||||
|
{
|
||||||
|
if ( m_listctrl )
|
||||||
|
{
|
||||||
|
delete m_listctrl->GetImageList(wxIMAGE_LIST_SMALL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_LOG_DIALOG
|
||||||
|
@ -99,7 +99,7 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
|
|||||||
if (size.x < size.y*3/2)
|
if (size.x < size.y*3/2)
|
||||||
{
|
{
|
||||||
size.x = size.y*3/2;
|
size.x = size.y*3/2;
|
||||||
SetSize( size );
|
SetSize( size );
|
||||||
}
|
}
|
||||||
|
|
||||||
Centre( wxBOTH | wxCENTER_FRAME);
|
Centre( wxBOTH | wxCENTER_FRAME);
|
||||||
|
@ -66,7 +66,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxWizardEvent, wxNotifyEvent)
|
|||||||
// wxWizardPage
|
// wxWizardPage
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxWizardPage::wxWizardPage(wxWizard *parent) : wxPanel(parent)
|
wxWizardPage::wxWizardPage(wxWizard *parent, const wxBitmap& bitmap)
|
||||||
|
: wxPanel(parent), m_bitmap(bitmap)
|
||||||
{
|
{
|
||||||
// initially the page is hidden, it's shown only when it becomes current
|
// initially the page is hidden, it's shown only when it becomes current
|
||||||
Hide();
|
Hide();
|
||||||
@ -95,6 +96,7 @@ wxWizard::wxWizard(wxWindow *parent,
|
|||||||
const wxBitmap& bitmap,
|
const wxBitmap& bitmap,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size)
|
const wxSize& size)
|
||||||
|
: m_bitmap(bitmap)
|
||||||
{
|
{
|
||||||
// constants defining the dialog layout
|
// constants defining the dialog layout
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
@ -139,13 +141,15 @@ wxWizard::wxWizard(wxWindow *parent,
|
|||||||
m_y = Y_MARGIN;
|
m_y = Y_MARGIN;
|
||||||
if ( bitmap.Ok() )
|
if ( bitmap.Ok() )
|
||||||
{
|
{
|
||||||
(void)new wxStaticBitmap(this, -1, bitmap, wxPoint(m_x, m_y));
|
m_statbmp = new wxStaticBitmap(this, -1, bitmap, wxPoint(m_x, m_y));
|
||||||
|
|
||||||
m_x += bitmap.GetWidth() + BITMAP_X_MARGIN;
|
m_x += bitmap.GetWidth() + BITMAP_X_MARGIN;
|
||||||
m_height = bitmap.GetHeight();
|
m_height = bitmap.GetHeight();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_statbmp = (wxStaticBitmap *)NULL;
|
||||||
|
|
||||||
m_height = DEFAULT_PAGE_HEIGHT;
|
m_height = DEFAULT_PAGE_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +197,9 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
|
|||||||
// button or not (initially the label is "Next")
|
// button or not (initially the label is "Next")
|
||||||
bool btnLabelWasNext = TRUE;
|
bool btnLabelWasNext = TRUE;
|
||||||
|
|
||||||
|
// and this tells us whether we already had the default bitmap before
|
||||||
|
bool bmpWasDefault = TRUE;
|
||||||
|
|
||||||
if ( m_page )
|
if ( m_page )
|
||||||
{
|
{
|
||||||
// ask the current page first
|
// ask the current page first
|
||||||
@ -214,6 +221,7 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
|
|||||||
m_page->Hide();
|
m_page->Hide();
|
||||||
|
|
||||||
btnLabelWasNext = m_page->GetNext() != (wxWizardPage *)NULL;
|
btnLabelWasNext = m_page->GetNext() != (wxWizardPage *)NULL;
|
||||||
|
bmpWasDefault = !m_page->GetBitmap().Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the new one
|
// set the new one
|
||||||
@ -237,6 +245,13 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
|
|||||||
m_page->SetSize(m_x, m_y, m_width, m_height);
|
m_page->SetSize(m_x, m_y, m_width, m_height);
|
||||||
m_page->Show();
|
m_page->Show();
|
||||||
|
|
||||||
|
// change the bitmap if necessary (and if we have it at all)
|
||||||
|
bool bmpIsDefault = !m_page->GetBitmap().Ok();
|
||||||
|
if ( m_statbmp && (bmpIsDefault != bmpWasDefault) )
|
||||||
|
{
|
||||||
|
m_statbmp->SetBitmap(bmpIsDefault ? m_bitmap : m_page->GetBitmap());
|
||||||
|
}
|
||||||
|
|
||||||
// and update the buttons state
|
// and update the buttons state
|
||||||
m_btnPrev->Enable(m_page->GetPrev() != (wxWizardPage *)NULL);
|
m_btnPrev->Enable(m_page->GetPrev() != (wxWizardPage *)NULL);
|
||||||
|
|
||||||
|
@ -96,8 +96,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
int width = size.x;
|
int width = size.x;
|
||||||
int height = size.y;
|
int height = size.y;
|
||||||
|
|
||||||
long msStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL |
|
long msStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE |
|
||||||
CBS_NOINTEGRALHEIGHT;
|
CBS_AUTOHSCROLL | CBS_NOINTEGRALHEIGHT;
|
||||||
|
|
||||||
if (m_windowStyle & wxCB_READONLY)
|
if (m_windowStyle & wxCB_READONLY)
|
||||||
msStyle |= CBS_DROPDOWNLIST;
|
msStyle |= CBS_DROPDOWNLIST;
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include "wx/msw/msvcrt.h"
|
#include "wx/msw/msvcrt.h"
|
||||||
|
|
||||||
// Foils optimizations in Visual C++ (see also app.cpp). Without it,
|
// Foils optimizations in Visual C++ (see also app.cpp). Without it,
|
||||||
|
@ -20,11 +20,8 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
// Doesn't compile in WIN16 mode
|
||||||
#include "wx/defs.h"
|
#ifndef __WIN16__
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (wxUSE_FILE && wxUSE_TEXTFILE) || defined(__WXMSW__)
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
@ -33,9 +30,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif //WX_PRECOMP
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
// Doesn't compile in WIN16 mode
|
|
||||||
#ifndef __WIN16__
|
|
||||||
|
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/file.h"
|
#include "wx/file.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
@ -45,12 +39,6 @@
|
|||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
#include "wx/msw/registry.h"
|
#include "wx/msw/registry.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#elif defined(__UNIX__) || defined(__WXPM__)
|
|
||||||
#include "wx/ffile.h"
|
|
||||||
#include "wx/textfile.h"
|
|
||||||
#include "wx/dir.h"
|
|
||||||
#include "wx/utils.h"
|
|
||||||
#include "wx/tokenzr.h"
|
|
||||||
#endif // OS
|
#endif // OS
|
||||||
|
|
||||||
#include "wx/msw/mimetype.h"
|
#include "wx/msw/mimetype.h"
|
||||||
@ -61,7 +49,6 @@
|
|||||||
// in case we're compiling in non-GUI mode
|
// in case we're compiling in non-GUI mode
|
||||||
class WXDLLEXPORT wxIcon;
|
class WXDLLEXPORT wxIcon;
|
||||||
|
|
||||||
|
|
||||||
// These classes use Windows registry to retrieve the required information.
|
// These classes use Windows registry to retrieve the required information.
|
||||||
//
|
//
|
||||||
// Keys used (not all of them are documented, so it might actually stop working
|
// Keys used (not all of them are documented, so it might actually stop working
|
||||||
@ -86,9 +73,6 @@ class WXDLLEXPORT wxIcon;
|
|||||||
// location, uses it, so it isn't likely to change
|
// location, uses it, so it isn't likely to change
|
||||||
static const wxChar *MIME_DATABASE_KEY = wxT("MIME\\Database\\Content Type\\");
|
static const wxChar *MIME_DATABASE_KEY = wxT("MIME\\Database\\Content Type\\");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const
|
wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const
|
||||||
{
|
{
|
||||||
// suppress possible error messages
|
// suppress possible error messages
|
||||||
@ -447,8 +431,5 @@ size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// wxUSE_FILE && wxUSE_TEXTFILE
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// __WIN16__
|
// __WIN16__
|
||||||
|
Loading…
Reference in New Issue
Block a user