/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlgg.h
+// Name: wx/generic/msgdlgg.h
// Purpose: Generic wxMessageDialog
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
-// Copyright: (c)
+// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
extern WXDLLEXPORT_DATA(const wxChar*) wxMessageBoxCaptionStr;
-class WXDLLEXPORT wxGenericMessageDialog: public wxDialog
+class WXDLLEXPORT wxGenericMessageDialog: public wxDialog, public wxMessageDialogBase
{
DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog)
void OnCancel(wxCommandEvent& event);
private:
- long m_dialogStyle;
-
DECLARE_EVENT_TABLE()
};
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.h
+// Name: wx/gtk/msgdlg.h
// Purpose: wxMessageDialog for GTK+2
// Author: Vaclav Slavik
// Modified by:
// Created: 2003/02/28
// RCS-ID: $Id$
// Copyright: (c) Vaclav Slavik, 2003
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __MSGDLG_H__
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
-class WXDLLEXPORT wxMessageDialog: public wxDialog
+class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
{
public:
wxMessageDialog(wxWindow *parent, const wxString& message,
private:
wxString m_caption;
wxString m_message;
- long m_dialogStyle;
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
};
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.h
+// Name: wx/gtk/msgdlg.h
// Purpose: wxMessageDialog for GTK+2
// Author: Vaclav Slavik
// Modified by:
// Created: 2003/02/28
// RCS-ID: $Id$
// Copyright: (c) Vaclav Slavik, 2003
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __MSGDLG_H__
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
-class WXDLLEXPORT wxMessageDialog: public wxDialog
+class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
{
public:
wxMessageDialog(wxWindow *parent, const wxString& message,
private:
wxString m_caption;
wxString m_message;
- long m_dialogStyle;
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
};
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.h
+// Name: wx/mac/carbon/msgdlg.h
// Purpose: wxMessageDialog class. Use generic version if no
// platform-specific implementation.
// Author: Stefan Csomor
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
-class WXDLLEXPORT wxMessageDialog: public wxDialog
+class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
{
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
-
+
protected:
wxString m_caption;
wxString m_message;
- long m_dialogStyle;
wxWindow * m_parent;
public:
wxMessageDialog(wxWindow *parent,
const wxPoint& pos = wxDefaultPosition);
int ShowModal();
-
+
// not supported for message dialog, RR
virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height),
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.h
+// Name: wx/mac/classic/msgdlg.h
// Purpose: wxMessageDialog class. Use generic version if no
// platform-specific implementation.
// Author: Stefan Csomor
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
-class WXDLLEXPORT wxMessageDialog: public wxDialog
+class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
{
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
-
+
protected:
wxString m_caption;
wxString m_message;
- long m_dialogStyle;
wxWindow * m_parent;
public:
wxMessageDialog(wxWindow *parent,
const wxPoint& pos = wxDefaultPosition);
int ShowModal();
-
+
// not supported for message dialog, RR
virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height),
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.h
+// Name: wx/motif/msgdlg.h
// Purpose: wxMessageDialog class. Use generic version if no
// platform-specific implementation.
// Author: Julian Smart
WXDLLEXPORT_DATA(extern const char*) wxMessageBoxCaptionStr;
-class WXDLLEXPORT wxMessageDialog: public wxDialog
+class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
{
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
-
+
public:
wxMessageDialog(wxWindow *parent,
const wxString& message,
const wxString& caption = wxMessageBoxCaptionStr,
long style = wxOK | wxCENTRE,
const wxPoint& pos = wxDefaultPosition);
-
+
int ShowModal();
-
+
// implementation only from now on
// called by the Motif callback
void SetResult(long result) { m_result = result; }
-
+
protected:
wxString m_caption;
wxString m_message;
- long m_dialogStyle;
wxWindow * m_parent;
long m_result;
};
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/msgdlgg.h
+// Purpose: common header and base class for wxMessageDialog
+// Author: wxWidgets Team
+// Modified by:
+// Created:
+// RCS-ID: $Id$
+// Copyright: (c) wxWidgets
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_MSGDLG_H_BASE_
#define _WX_MSGDLG_H_BASE_
#if wxUSE_MSGDLG
+class WXDLLEXPORT wxMessageDialogBase
+{
+protected:
+ // common validation of wxMessageDialog style
+ void SetMessageDialogStyle(long style)
+ {
+ wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || ((style & wxYES_NO) == 0),
+ _T("wxYES and wxNO may only be used together in wxMessageDialog") );
+
+ wxASSERT_MSG( (style & wxID_OK) != wxID_OK,
+ _T("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") );
+
+ m_dialogStyle = style;
+ }
+ inline long GetMessageDialogStyle() const
+ {
+ return m_dialogStyle;
+ }
+
+private:
+ long m_dialogStyle;
+};
+
#if defined(__WXUNIVERSAL__) || defined(__WXGPE__)
#include "wx/generic/msgdlgg.h"
#elif defined(__WXPALMOS__)
// ----------------------------------------------------------------------------
int WXDLLEXPORT wxMessageBox(const wxString& message,
- const wxString& caption = wxMessageBoxCaptionStr,
- long style = wxOK | wxCENTRE,
- wxWindow *parent = NULL,
- int x = wxDefaultCoord, int y = wxDefaultCoord);
+ const wxString& caption = wxMessageBoxCaptionStr,
+ long style = wxOK | wxCENTRE,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord, int y = wxDefaultCoord);
#endif // wxUSE_MSGDLG
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.h
+// Name: wx/msw/msgdlg.h
// Purpose: wxMessageDialog class
// Author: Julian Smart
// Modified by:
extern WXDLLEXPORT_DATA(const wxChar*) wxMessageBoxCaptionStr;
-class WXDLLEXPORT wxMessageDialog: public wxDialog
+class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
{
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
protected:
wxString m_caption;
wxString m_message;
- long m_dialogStyle;
wxWindow * m_parent;
public:
wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.h
+// Name: wx/os2/msgdlg.h
// Purpose: wxMessageDialog class. Use generic version if no
// platform-specific implementation.
// Author: David Webster
// Modified by:
// Created: 10/12/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
+// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
* Message box dialog
*/
-class WXDLLEXPORT wxMessageDialog : public wxDialog
+class WXDLLEXPORT wxMessageDialog : public wxDialog, public wxMessageDialogBase
{
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
public:
protected:
wxString m_sCaption;
wxString m_sMessage;
- long m_lDialogStyle;
wxWindow* m_pParent;
}; // end of CLASS wxMessageDialog
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
-class WXDLLEXPORT wxMessageDialog: public wxDialog
+class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
{
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
protected:
wxString m_caption;
wxString m_message;
- long m_dialogStyle;
wxWindow * m_parent;
public:
wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlgg.cpp
+// Name: src/generic/msgdlgg.cpp
// Purpose: wxGenericMessageDialog
// Author: Julian Smart, Robert Roebling
// Modified by:
const wxPoint& pos)
: wxDialog( parent, wxID_ANY, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE )
{
- m_dialogStyle = style;
+ SetMessageDialogStyle(style);
bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
{
// Allow cancellation via ESC/Close button except if
// only YES and NO are specified.
- if ( (m_dialogStyle & wxYES_NO) != wxYES_NO || (m_dialogStyle & wxCANCEL) )
+ const long style = GetMessageDialogStyle();
+ if ( (style & wxYES_NO) != wxYES_NO || (style & wxCANCEL) )
{
EndModal( wxID_CANCEL );
}
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.cpp
+// Name: src/gtk/msgdlg.cpp
// Purpose: wxMessageDialog for GTK+2
// Author: Vaclav Slavik
// Modified by:
// Created: 2003/02/28
// RCS-ID: $Id$
// Copyright: (c) Vaclav Slavik, 2003
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
{
m_caption = caption;
m_message = message;
- m_dialogStyle = style;
+ SetMessageDialogStyle(style);
m_parent = wxGetTopLevelParent(parent);
GtkMessageType type = GTK_MESSAGE_ERROR;
GtkButtonsType buttons = GTK_BUTTONS_OK;
- if (m_dialogStyle & wxYES_NO)
+ if (style & wxYES_NO)
{
buttons = GTK_BUTTONS_YES_NO;
}
- if (m_dialogStyle & wxOK)
+ if (style & wxOK)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
buttons = GTK_BUTTONS_OK_CANCEL;
else
buttons = GTK_BUTTONS_OK;
}
- if (m_dialogStyle & wxICON_EXCLAMATION)
+ if (style & wxICON_EXCLAMATION)
type = GTK_MESSAGE_WARNING;
- else if (m_dialogStyle & wxICON_ERROR)
+ else if (style & wxICON_ERROR)
type = GTK_MESSAGE_ERROR;
- else if (m_dialogStyle & wxICON_INFORMATION)
+ else if (style & wxICON_INFORMATION)
type = GTK_MESSAGE_INFO;
- else if (m_dialogStyle & wxICON_QUESTION)
+ else if (style & wxICON_QUESTION)
type = GTK_MESSAGE_QUESTION;
else
{
// GTK+ doesn't have a "typeless" msg box, so try to auto detect...
- type = m_dialogStyle & wxYES ? GTK_MESSAGE_QUESTION : GTK_MESSAGE_INFO;
+ type = style & wxYES ? GTK_MESSAGE_QUESTION : GTK_MESSAGE_INFO;
}
m_widget = gtk_message_dialog_new(m_parent ?
if (m_caption != wxMessageBoxCaptionStr)
gtk_window_set_title(GTK_WINDOW(m_widget), wxGTK_CONV(m_caption));
- if (m_dialogStyle & wxYES_NO)
+ if (style & wxYES_NO)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
gtk_dialog_add_button(GTK_DIALOG(m_widget), GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
- if (m_dialogStyle & wxNO_DEFAULT)
+ if (style & wxNO_DEFAULT)
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_NO);
else
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_YES);
gtk_window_set_transient_for(GTK_WINDOW(m_widget),
GTK_WINDOW(m_parent->m_widget));
}
-
+
wxMessageDialog::~wxMessageDialog()
{
}
// parent TLW will disappear..
if (m_parent)
gtk_window_present( GTK_WINDOW(m_parent->m_widget) );
-
+
gint result = gtk_dialog_run(GTK_DIALOG(m_widget));
gtk_widget_destroy(m_widget);
m_widget = NULL;
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.cpp
+// Name: src/gtk/msgdlg.cpp
// Purpose: wxMessageDialog for GTK+2
// Author: Vaclav Slavik
// Modified by:
// Created: 2003/02/28
// RCS-ID: $Id$
// Copyright: (c) Vaclav Slavik, 2003
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
{
m_caption = caption;
m_message = message;
- m_dialogStyle = style;
+ SetMessageDialogStyle(style);
m_parent = wxGetTopLevelParent(parent);
GtkMessageType type = GTK_MESSAGE_ERROR;
GtkButtonsType buttons = GTK_BUTTONS_OK;
- if (m_dialogStyle & wxYES_NO)
+ if (style & wxYES_NO)
{
buttons = GTK_BUTTONS_YES_NO;
}
- if (m_dialogStyle & wxOK)
+ if (style & wxOK)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
buttons = GTK_BUTTONS_OK_CANCEL;
else
buttons = GTK_BUTTONS_OK;
}
- if (m_dialogStyle & wxICON_EXCLAMATION)
+ if (style & wxICON_EXCLAMATION)
type = GTK_MESSAGE_WARNING;
- else if (m_dialogStyle & wxICON_ERROR)
+ else if (style & wxICON_ERROR)
type = GTK_MESSAGE_ERROR;
- else if (m_dialogStyle & wxICON_INFORMATION)
+ else if (style & wxICON_INFORMATION)
type = GTK_MESSAGE_INFO;
- else if (m_dialogStyle & wxICON_QUESTION)
+ else if (style & wxICON_QUESTION)
type = GTK_MESSAGE_QUESTION;
else
{
// GTK+ doesn't have a "typeless" msg box, so try to auto detect...
- type = m_dialogStyle & wxYES ? GTK_MESSAGE_QUESTION : GTK_MESSAGE_INFO;
+ type = style & wxYES ? GTK_MESSAGE_QUESTION : GTK_MESSAGE_INFO;
}
m_widget = gtk_message_dialog_new(m_parent ?
if (m_caption != wxMessageBoxCaptionStr)
gtk_window_set_title(GTK_WINDOW(m_widget), wxGTK_CONV(m_caption));
- if (m_dialogStyle & wxYES_NO)
+ if (style & wxYES_NO)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
gtk_dialog_add_button(GTK_DIALOG(m_widget), GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
- if (m_dialogStyle & wxNO_DEFAULT)
+ if (style & wxNO_DEFAULT)
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_NO);
else
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_YES);
gtk_window_set_transient_for(GTK_WINDOW(m_widget),
GTK_WINDOW(m_parent->m_widget));
}
-
+
wxMessageDialog::~wxMessageDialog()
{
}
// parent TLW will disappear..
if (m_parent)
gtk_window_present( GTK_WINDOW(m_parent->m_widget) );
-
+
gint result = gtk_dialog_run(GTK_DIALOG(m_widget));
gtk_widget_destroy(m_widget);
m_widget = NULL;
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.cpp
+// Name: src/mac/carbon/msgdlg.cpp
// Purpose: wxMessageDialog
// Author: Stefan Csomor
// Modified by:
// Created: 04/01/98
-// RCS-ID: $$
+// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
{
m_caption = caption;
m_message = message;
- m_dialogStyle = style;
m_parent = parent;
+ SetMessageDialogStyle(style);
}
int wxMessageDialog::ShowModal()
{
int resultbutton = wxID_CANCEL ;
-
+
short result ;
-
- wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , wxT("this style is not supported on mac") ) ;
-
+
+ const long style = GetMessageDialogStyle();
+
+ wxASSERT_MSG( ( style & 0x3F ) != wxYES , wxT("this style is not supported on mac") ) ;
+
AlertType alertType = kAlertPlainAlert ;
- if (m_dialogStyle & wxICON_EXCLAMATION)
+ if (style & wxICON_EXCLAMATION)
alertType = kAlertNoteAlert ;
- else if (m_dialogStyle & wxICON_HAND)
+ else if (style & wxICON_HAND)
alertType = kAlertStopAlert ;
- else if (m_dialogStyle & wxICON_INFORMATION)
+ else if (style & wxICON_INFORMATION)
alertType = kAlertNoteAlert ;
- else if (m_dialogStyle & wxICON_QUESTION)
+ else if (style & wxICON_QUESTION)
alertType = kAlertCautionAlert ;
-
+
#if TARGET_CARBON
if ( UMAGetSystemVersion() >= 0x1000 )
{
AlertStdCFStringAlertParamRec param ;
wxMacCFStringHolder cfNoString(_("No") , m_font.GetEncoding()) ;
wxMacCFStringHolder cfYesString( _("Yes") , m_font.GetEncoding()) ;
-
+
wxMacCFStringHolder cfTitle(m_caption , m_font.GetEncoding());
wxMacCFStringHolder cfText(m_message , m_font.GetEncoding());
-
+
param.movable = true;
param.flags = 0 ;
param.version = kStdCFStringAlertVersionOne ;
-
+
bool skipDialog = false ;
-
- if (m_dialogStyle & wxYES_NO)
+
+ if (style & wxYES_NO)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
param.defaultText = cfYesString ;
param.cancelText = (CFStringRef) kAlertDefaultCancelText;
param.otherText = cfNoString ;
param.helpButton = false ;
- param.defaultButton = m_dialogStyle & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton;
+ param.defaultButton = style & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton;
param.cancelButton = kAlertStdAlertCancelButton;
}
else
param.cancelText = NULL;
param.otherText = cfNoString ;
param.helpButton = false ;
- param.defaultButton = m_dialogStyle & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton;
+ param.defaultButton = style & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton;
param.cancelButton = 0;
}
}
// the msw implementation even shows an ok button if it is not specified, we'll do the same
- else
+ else
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
// thats a cancel missing
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
skipDialog = true ;
}
*/
-
+
param.position = kWindowDefaultPosition;
if ( !skipDialog )
{
CreateStandardAlert( alertType , cfTitle , cfText , ¶m , &alertRef ) ;
RunStandardAlert( alertRef , NULL , &result ) ;
}
- if ( skipDialog )
+ if ( skipDialog )
return wxID_CANCEL ;
}
else
#endif
{
AlertStdAlertParamRec param;
-
+
Str255 yesPString ;
Str255 noPString ;
-
+
Str255 pascalTitle ;
Str255 pascalText ;
wxMacStringToPascal( m_caption , pascalTitle ) ;
wxMacStringToPascal( _("Yes") , yesPString ) ;
wxMacStringToPascal( _("No") , noPString ) ;
wxMacStringToPascal( m_message , pascalText ) ;
-
+
param.movable = true;
param.filterProc = NULL ;
- if (m_dialogStyle & wxYES_NO)
+ if (style & wxYES_NO)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
param.defaultText = yesPString ;
param.cancelText = (StringPtr) kAlertDefaultCancelText;
param.cancelButton = 0;
}
}
- else if (m_dialogStyle & wxOK)
+ else if (style & wxOK)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
param.defaultText = (StringPtr) kAlertDefaultOKText ;
param.cancelText = (StringPtr) kAlertDefaultCancelText ;
{
return resultbutton ;
}
-
+
param.position = 0;
-
+
StandardAlert( alertType, pascalTitle, pascalText, ¶m, &result );
}
-
- if (m_dialogStyle & wxOK)
+
+ if (style & wxOK)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
//TODO add Cancelbutton
switch( result )
}
}
}
- else if (m_dialogStyle & wxYES_NO)
+ else if (style & wxYES_NO)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
switch( result )
{
break ;
}
}
- }
-
+ }
+
return resultbutton ;
}
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.cpp
+// Name: src/mac/classic/msgdlg.cpp
// Purpose: wxMessageDialog
// Author: Stefan Csomor
// Modified by:
// Created: 04/01/98
-// RCS-ID: $$
+// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
{
m_caption = caption;
m_message = message;
- m_dialogStyle = style;
m_parent = parent;
+ SetMessageDialogStyle(style);
}
int wxMessageDialog::ShowModal()
{
int resultbutton = wxID_CANCEL ;
-
+
short result ;
-
- wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , wxT("this style is not supported on mac") ) ;
-
+
+ const long style = GetMessageDialogStyle();
+
+ wxASSERT_MSG( ( style & 0x3F ) != wxYES , wxT("this style is not supported on mac") ) ;
+
AlertType alertType = kAlertPlainAlert ;
- if (m_dialogStyle & wxICON_EXCLAMATION)
+ if (style & wxICON_EXCLAMATION)
alertType = kAlertNoteAlert ;
- else if (m_dialogStyle & wxICON_HAND)
+ else if (style & wxICON_HAND)
alertType = kAlertStopAlert ;
- else if (m_dialogStyle & wxICON_INFORMATION)
+ else if (style & wxICON_INFORMATION)
alertType = kAlertNoteAlert ;
- else if (m_dialogStyle & wxICON_QUESTION)
+ else if (style & wxICON_QUESTION)
alertType = kAlertCautionAlert ;
-
+
#if TARGET_CARBON
if ( UMAGetSystemVersion() >= 0x1000 )
{
AlertStdCFStringAlertParamRec param ;
wxMacCFStringHolder cfNoString(_("No") , m_font.GetEncoding()) ;
wxMacCFStringHolder cfYesString( _("Yes") , m_font.GetEncoding()) ;
-
+
wxMacCFStringHolder cfTitle(m_caption , m_font.GetEncoding());
wxMacCFStringHolder cfText(m_message , m_font.GetEncoding());
-
+
param.movable = true;
param.flags = 0 ;
-
+
bool skipDialog = false ;
-
- if (m_dialogStyle & wxYES_NO)
+
+ if (style & wxYES_NO)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
param.defaultText = cfYesString ;
param.cancelText = (CFStringRef) kAlertDefaultCancelText;
}
}
// the msw implementation even shows an ok button if it is not specified, we'll do the same
- else
+ else
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
// thats a cancel missing
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
skipDialog = true ;
}
*/
-
+
param.position = kWindowDefaultPosition;
if ( !skipDialog )
{
CreateStandardAlert( alertType , cfTitle , cfText , ¶m , &alertRef ) ;
RunStandardAlert( alertRef , NULL , &result ) ;
}
- if ( skipDialog )
+ if ( skipDialog )
return wxID_CANCEL ;
}
else
#endif
{
AlertStdAlertParamRec param;
-
+
Str255 yesPString ;
Str255 noPString ;
-
+
Str255 pascalTitle ;
Str255 pascalText ;
wxMacStringToPascal( m_caption , pascalTitle ) ;
wxMacStringToPascal( _("Yes") , yesPString ) ;
wxMacStringToPascal( _("No") , noPString ) ;
wxMacStringToPascal( m_message , pascalText ) ;
-
+
param.movable = true;
param.filterProc = NULL ;
- if (m_dialogStyle & wxYES_NO)
+ if (style & wxYES_NO)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
param.defaultText = yesPString ;
param.cancelText = (StringPtr) kAlertDefaultCancelText;
param.cancelButton = 0;
}
}
- else if (m_dialogStyle & wxOK)
+ else if (style & wxOK)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
param.defaultText = (StringPtr) kAlertDefaultOKText ;
param.cancelText = (StringPtr) kAlertDefaultCancelText ;
{
return resultbutton ;
}
-
+
param.position = 0;
-
+
StandardAlert( alertType, pascalTitle, pascalText, ¶m, &result );
}
-
- if (m_dialogStyle & wxOK)
+
+ if (style & wxOK)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
//TODO add Cancelbutton
switch( result )
}
}
}
- else if (m_dialogStyle & wxYES_NO)
+ else if (style & wxYES_NO)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
{
switch( result )
{
break ;
}
}
- }
-
+ }
+
return resultbutton ;
}
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.cpp
+// Name: src/motif/msgdlg.cpp
// Purpose: wxMessageDialog
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
-// RCS-ID: $$
+// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
{
m_caption = caption;
m_message = message;
- m_dialogStyle = style;
m_parent = parent;
+ SetMessageDialogStyle(style);
}
int wxMessageDialog::ShowModal()
{
Widget (*dialogCreateFunction)(Widget, String, ArgList, Cardinal) = NULL;
- if ( m_dialogStyle & wxYES_NO )
+ const long style = GetMessageDialogStyle();
+
+ if ( style & wxYES_NO )
{
// if we have [Yes], it must be a question
dialogCreateFunction = XmCreateQuestionDialog;
}
- else if ( m_dialogStyle & wxICON_STOP )
+ else if ( style & wxICON_STOP )
{
// error dialog is the one with error icon...
dialogCreateFunction = XmCreateErrorDialog;
}
- else if ( m_dialogStyle & wxICON_EXCLAMATION )
+ else if ( style & wxICON_EXCLAMATION )
{
// ...and the warning dialog too
dialogCreateFunction = XmCreateWarningDialog;
Widget wBtnHelp = XmMessageBoxGetChild(wMsgBox, XmDIALOG_HELP_BUTTON);
Widget wBtnCancel = XmMessageBoxGetChild(wMsgBox, XmDIALOG_CANCEL_BUTTON);
- if ( m_dialogStyle & wxYES_NO )
+ if ( style & wxYES_NO )
{
- wxXmString yes(_("Yes")), no(_("No")), cancel(_("Cancel"));
+ wxXmString yes(_("Yes")), no(_("No")), cancel(_("Cancel"));
- if ( m_dialogStyle & wxCANCEL )
+ if ( style & wxCANCEL )
{
// use the cancel button for No and the help button for
// Cancel Yuk :-) MB
// requested)
//
XtUnmanageChild(wBtnHelp);
- if ( !(m_dialogStyle & wxCANCEL ) ) XtUnmanageChild(wBtnCancel);
+ if ( !(style & wxCANCEL ) ) XtUnmanageChild(wBtnCancel);
}
// set the callbacks for the message box buttons
}
// translate the result if necessary
- if ( m_dialogStyle & wxYES_NO )
+ if ( style & wxYES_NO )
{
if ( m_result == wxID_OK )
m_result = wxID_YES;
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.cpp
+// Name: src/msw/msgdlg.cpp
// Purpose: wxMessageDialog
// Author: Julian Smart
// Modified by:
long style,
const wxPoint& WXUNUSED(pos))
{
-#ifdef __WXDEBUG__
- // check for common programming errors
- if ( (style & wxID_OK) == wxID_OK )
- {
- // programmer probably confused wxID_OK with wxOK. Correct one is wxOK.
- wxFAIL_MSG( _T("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") );
- }
-#endif // __WXDEBUG__
-
m_caption = caption;
m_message = message;
- m_dialogStyle = style;
m_parent = parent;
+ SetMessageDialogStyle(style);
}
int wxMessageDialog::ShowModal()
// translate wx style in MSW
unsigned int msStyle = MB_OK;
- if (m_dialogStyle & wxYES_NO)
+ const long wxStyle = GetMessageDialogStyle();
+ if (wxStyle & wxYES_NO)
{
- wxASSERT_MSG( (m_dialogStyle & wxYES_NO) == wxYES_NO,
- _T("wxYES and wxNO may only be used together under MSW") );
-
#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__))
- if (m_dialogStyle & wxCANCEL)
+ if (wxStyle & wxCANCEL)
msStyle = MB_YESNOCANCEL;
else
#endif // !(__SMARTPHONE__ && __WXWINCE__)
msStyle = MB_YESNO;
- if (m_dialogStyle & wxNO_DEFAULT)
+ if (wxStyle & wxNO_DEFAULT)
msStyle |= MB_DEFBUTTON2;
}
- if (m_dialogStyle & wxOK)
+ if (wxStyle & wxOK)
{
- if (m_dialogStyle & wxCANCEL)
+ if (wxStyle & wxCANCEL)
msStyle = MB_OKCANCEL;
else
msStyle = MB_OK;
}
- if (m_dialogStyle & wxICON_EXCLAMATION)
+ if (wxStyle & wxICON_EXCLAMATION)
msStyle |= MB_ICONEXCLAMATION;
- else if (m_dialogStyle & wxICON_HAND)
+ else if (wxStyle & wxICON_HAND)
msStyle |= MB_ICONHAND;
- else if (m_dialogStyle & wxICON_INFORMATION)
+ else if (wxStyle & wxICON_INFORMATION)
msStyle |= MB_ICONINFORMATION;
- else if (m_dialogStyle & wxICON_QUESTION)
+ else if (wxStyle & wxICON_QUESTION)
msStyle |= MB_ICONQUESTION;
- if ( m_dialogStyle & wxSTAY_ON_TOP )
+ if ( wxStyle & wxSTAY_ON_TOP )
msStyle |= MB_TOPMOST;
if (hWnd)
/////////////////////////////////////////////////////////////////////////////
-// Name: msgdlg.cpp
+// Name: src/os2/msgdlg.cpp
// Purpose: wxMessageDialog
// Author: David Webster
// Modified by:
// Created: 10/10/99
-// RCS-ID: $$
+// RCS-ID: $Id$
// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
{
m_sCaption = rsCaption;
m_sMessage = rsMessage;
- m_lDialogStyle = lStyle;
m_pParent = NULL; // pParent;
+ SetMessageDialogStyle(lStyle);
} // end of wxMessageDialog::wxMessageDialog
int wxMessageDialog::ShowModal()
HWND hWnd = 0;
ULONG ulStyle = MB_OK;
int nAns = wxOK;
+ const long lStyle = GetMessageDialogStyle();
if (!wxTheApp->GetTopWindow())
{
hWnd = (HWND) m_pParent->GetHWND();
else
hWnd = HWND_DESKTOP;
- if (m_lDialogStyle & wxYES_NO)
+ if (lStyle & wxYES_NO)
{
- if (m_lDialogStyle & wxCANCEL)
+ if (lStyle & wxCANCEL)
ulStyle = MB_YESNOCANCEL;
else
ulStyle = MB_YESNO;
- if (m_lDialogStyle & wxNO_DEFAULT)
+ if (lStyle & wxNO_DEFAULT)
ulStyle |= MB_DEFBUTTON2;
}
- if (m_lDialogStyle & wxOK)
+ if (lStyle & wxOK)
{
- if (m_lDialogStyle & wxCANCEL)
+ if (lStyle & wxCANCEL)
ulStyle = MB_OKCANCEL;
else
ulStyle = MB_OK;
}
- if (m_lDialogStyle & wxICON_EXCLAMATION)
+ if (lStyle & wxICON_EXCLAMATION)
ulStyle |= MB_ICONEXCLAMATION;
- else if (m_lDialogStyle & wxICON_HAND)
+ else if (lStyle & wxICON_HAND)
ulStyle |= MB_ICONHAND;
- else if (m_lDialogStyle & wxICON_INFORMATION)
+ else if (lStyle & wxICON_INFORMATION)
ulStyle |= MB_ICONEXCLAMATION;
- else if (m_lDialogStyle & wxICON_QUESTION)
+ else if (lStyle & wxICON_QUESTION)
ulStyle |= MB_ICONQUESTION;
if (hWnd != HWND_DESKTOP)
long style,
const wxPoint& WXUNUSED(pos))
{
-#ifdef __WXDEBUG__
- // check for common programming errors
- if ( (style & wxID_OK) == wxID_OK )
- {
- // programmer probably confused wxID_OK with wxOK. Correct one is wxOK.
- wxFAIL_MSG( _T("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") );
- }
-#endif // __WXDEBUG__
-
m_caption = caption;
m_message = message;
- m_dialogStyle = style;
m_parent = parent;
+ SetMessageDialogStyle(style);
}
int wxMessageDialog::ShowModal()
int AlertID=1000;
int Result=0;
int wxResult=wxID_OK;
+ const long style = GetMessageDialogStyle();
// Handle to the currently running application database
DmOpenRef AppDB;
SysGetModuleDatabase(SysGetRefNum(), NULL, &AppDB);
// Translate wx styles into Palm OS styles
- if (m_dialogStyle & wxYES_NO)
+ if (style & wxYES_NO)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
AlertID=1300; // Yes No Cancel
else
AlertID=1200; // Yes No
}
- if (m_dialogStyle & wxOK)
+ if (style & wxOK)
{
- if (m_dialogStyle & wxCANCEL)
+ if (style & wxCANCEL)
AlertID=1100; // Ok Cancel
else
AlertID=1000; // Ok
}
// Add the icon styles
- if (m_dialogStyle & wxICON_EXCLAMATION)
+ if (style & wxICON_EXCLAMATION)
AlertID=AlertID+0; // Warning
- else if (m_dialogStyle & wxICON_HAND)
+ else if (style & wxICON_HAND)
AlertID=AlertID+1; // Error
- else if (m_dialogStyle & wxICON_INFORMATION)
+ else if (style & wxICON_INFORMATION)
AlertID=AlertID+2; // Information
- else if (m_dialogStyle & wxICON_QUESTION)
+ else if (style & wxICON_QUESTION)
AlertID=AlertID+3; // Confirmation
// The Palm OS Dialog API does not support custom titles in a dialog box.