Base for wxMessageDialog with common checks for style.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlgg.h
|
// Name: wx/generic/msgdlgg.h
|
||||||
// Purpose: Generic wxMessageDialog
|
// Purpose: Generic wxMessageDialog
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c)
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
extern WXDLLEXPORT_DATA(const wxChar*) wxMessageBoxCaptionStr;
|
extern WXDLLEXPORT_DATA(const wxChar*) wxMessageBoxCaptionStr;
|
||||||
|
|
||||||
class WXDLLEXPORT wxGenericMessageDialog: public wxDialog
|
class WXDLLEXPORT wxGenericMessageDialog: public wxDialog, public wxMessageDialogBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog)
|
DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog)
|
||||||
|
|
||||||
@@ -38,8 +38,6 @@ public:
|
|||||||
void OnCancel(wxCommandEvent& event);
|
void OnCancel(wxCommandEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
long m_dialogStyle;
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.h
|
// Name: wx/gtk/msgdlg.h
|
||||||
// Purpose: wxMessageDialog for GTK+2
|
// Purpose: wxMessageDialog for GTK+2
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
||||||
|
|
||||||
class WXDLLEXPORT wxMessageDialog: public wxDialog
|
class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMessageDialog(wxWindow *parent, const wxString& message,
|
wxMessageDialog(wxWindow *parent, const wxString& message,
|
||||||
@@ -48,7 +48,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
wxString m_caption;
|
wxString m_caption;
|
||||||
wxString m_message;
|
wxString m_message;
|
||||||
long m_dialogStyle;
|
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
||||||
};
|
};
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.h
|
// Name: wx/gtk/msgdlg.h
|
||||||
// Purpose: wxMessageDialog for GTK+2
|
// Purpose: wxMessageDialog for GTK+2
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
||||||
|
|
||||||
class WXDLLEXPORT wxMessageDialog: public wxDialog
|
class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMessageDialog(wxWindow *parent, const wxString& message,
|
wxMessageDialog(wxWindow *parent, const wxString& message,
|
||||||
@@ -48,7 +48,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
wxString m_caption;
|
wxString m_caption;
|
||||||
wxString m_message;
|
wxString m_message;
|
||||||
long m_dialogStyle;
|
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
||||||
};
|
};
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.h
|
// Name: wx/mac/carbon/msgdlg.h
|
||||||
// Purpose: wxMessageDialog class. Use generic version if no
|
// Purpose: wxMessageDialog class. Use generic version if no
|
||||||
// platform-specific implementation.
|
// platform-specific implementation.
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
@@ -26,14 +26,13 @@
|
|||||||
|
|
||||||
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
||||||
|
|
||||||
class WXDLLEXPORT wxMessageDialog: public wxDialog
|
class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString m_caption;
|
wxString m_caption;
|
||||||
wxString m_message;
|
wxString m_message;
|
||||||
long m_dialogStyle;
|
|
||||||
wxWindow * m_parent;
|
wxWindow * m_parent;
|
||||||
public:
|
public:
|
||||||
wxMessageDialog(wxWindow *parent,
|
wxMessageDialog(wxWindow *parent,
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.h
|
// Name: wx/mac/classic/msgdlg.h
|
||||||
// Purpose: wxMessageDialog class. Use generic version if no
|
// Purpose: wxMessageDialog class. Use generic version if no
|
||||||
// platform-specific implementation.
|
// platform-specific implementation.
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
@@ -26,14 +26,13 @@
|
|||||||
|
|
||||||
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
||||||
|
|
||||||
class WXDLLEXPORT wxMessageDialog: public wxDialog
|
class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString m_caption;
|
wxString m_caption;
|
||||||
wxString m_message;
|
wxString m_message;
|
||||||
long m_dialogStyle;
|
|
||||||
wxWindow * m_parent;
|
wxWindow * m_parent;
|
||||||
public:
|
public:
|
||||||
wxMessageDialog(wxWindow *parent,
|
wxMessageDialog(wxWindow *parent,
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.h
|
// Name: wx/motif/msgdlg.h
|
||||||
// Purpose: wxMessageDialog class. Use generic version if no
|
// Purpose: wxMessageDialog class. Use generic version if no
|
||||||
// platform-specific implementation.
|
// platform-specific implementation.
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
WXDLLEXPORT_DATA(extern const char*) wxMessageBoxCaptionStr;
|
WXDLLEXPORT_DATA(extern const char*) wxMessageBoxCaptionStr;
|
||||||
|
|
||||||
class WXDLLEXPORT wxMessageDialog: public wxDialog
|
class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
||||||
|
|
||||||
@@ -46,7 +46,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
wxString m_caption;
|
wxString m_caption;
|
||||||
wxString m_message;
|
wxString m_message;
|
||||||
long m_dialogStyle;
|
|
||||||
wxWindow * m_parent;
|
wxWindow * m_parent;
|
||||||
long m_result;
|
long m_result;
|
||||||
};
|
};
|
||||||
|
@@ -1,3 +1,14 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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_
|
#ifndef _WX_MSGDLG_H_BASE_
|
||||||
#define _WX_MSGDLG_H_BASE_
|
#define _WX_MSGDLG_H_BASE_
|
||||||
|
|
||||||
@@ -5,6 +16,29 @@
|
|||||||
|
|
||||||
#if wxUSE_MSGDLG
|
#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__)
|
#if defined(__WXUNIVERSAL__) || defined(__WXGPE__)
|
||||||
#include "wx/generic/msgdlgg.h"
|
#include "wx/generic/msgdlgg.h"
|
||||||
#elif defined(__WXPALMOS__)
|
#elif defined(__WXPALMOS__)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.h
|
// Name: wx/msw/msgdlg.h
|
||||||
// Purpose: wxMessageDialog class
|
// Purpose: wxMessageDialog class
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -25,13 +25,12 @@
|
|||||||
|
|
||||||
extern WXDLLEXPORT_DATA(const wxChar*) wxMessageBoxCaptionStr;
|
extern WXDLLEXPORT_DATA(const wxChar*) wxMessageBoxCaptionStr;
|
||||||
|
|
||||||
class WXDLLEXPORT wxMessageDialog: public wxDialog
|
class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
||||||
protected:
|
protected:
|
||||||
wxString m_caption;
|
wxString m_caption;
|
||||||
wxString m_message;
|
wxString m_message;
|
||||||
long m_dialogStyle;
|
|
||||||
wxWindow * m_parent;
|
wxWindow * m_parent;
|
||||||
public:
|
public:
|
||||||
wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
|
wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.h
|
// Name: wx/os2/msgdlg.h
|
||||||
// Purpose: wxMessageDialog class. Use generic version if no
|
// Purpose: wxMessageDialog class. Use generic version if no
|
||||||
// platform-specific implementation.
|
// platform-specific implementation.
|
||||||
// Author: David Webster
|
// Author: David Webster
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 10/12/99
|
// Created: 10/12/99
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) AUTHOR
|
// Copyright: (c) David Webster
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
* Message box dialog
|
* Message box dialog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class WXDLLEXPORT wxMessageDialog : public wxDialog
|
class WXDLLEXPORT wxMessageDialog : public wxDialog, public wxMessageDialogBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
||||||
public:
|
public:
|
||||||
@@ -36,7 +36,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
wxString m_sCaption;
|
wxString m_sCaption;
|
||||||
wxString m_sMessage;
|
wxString m_sMessage;
|
||||||
long m_lDialogStyle;
|
|
||||||
wxWindow* m_pParent;
|
wxWindow* m_pParent;
|
||||||
}; // end of CLASS wxMessageDialog
|
}; // end of CLASS wxMessageDialog
|
||||||
|
|
||||||
|
@@ -25,13 +25,12 @@
|
|||||||
|
|
||||||
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
||||||
|
|
||||||
class WXDLLEXPORT wxMessageDialog: public wxDialog
|
class WXDLLEXPORT wxMessageDialog: public wxDialog, public wxMessageDialogBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
|
||||||
protected:
|
protected:
|
||||||
wxString m_caption;
|
wxString m_caption;
|
||||||
wxString m_message;
|
wxString m_message;
|
||||||
long m_dialogStyle;
|
|
||||||
wxWindow * m_parent;
|
wxWindow * m_parent;
|
||||||
public:
|
public:
|
||||||
wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
|
wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlgg.cpp
|
// Name: src/generic/msgdlgg.cpp
|
||||||
// Purpose: wxGenericMessageDialog
|
// Purpose: wxGenericMessageDialog
|
||||||
// Author: Julian Smart, Robert Roebling
|
// Author: Julian Smart, Robert Roebling
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -65,7 +65,7 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
|
|||||||
const wxPoint& pos)
|
const wxPoint& pos)
|
||||||
: wxDialog( parent, wxID_ANY, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE )
|
: wxDialog( parent, wxID_ANY, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE )
|
||||||
{
|
{
|
||||||
m_dialogStyle = style;
|
SetMessageDialogStyle(style);
|
||||||
|
|
||||||
bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
|
bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
|
||||||
|
|
||||||
@@ -151,7 +151,8 @@ void wxGenericMessageDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
// Allow cancellation via ESC/Close button except if
|
// Allow cancellation via ESC/Close button except if
|
||||||
// only YES and NO are specified.
|
// 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 );
|
EndModal( wxID_CANCEL );
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.cpp
|
// Name: src/gtk/msgdlg.cpp
|
||||||
// Purpose: wxMessageDialog for GTK+2
|
// Purpose: wxMessageDialog for GTK+2
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -38,37 +38,37 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
m_caption = caption;
|
m_caption = caption;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
SetMessageDialogStyle(style);
|
||||||
m_parent = wxGetTopLevelParent(parent);
|
m_parent = wxGetTopLevelParent(parent);
|
||||||
|
|
||||||
GtkMessageType type = GTK_MESSAGE_ERROR;
|
GtkMessageType type = GTK_MESSAGE_ERROR;
|
||||||
GtkButtonsType buttons = GTK_BUTTONS_OK;
|
GtkButtonsType buttons = GTK_BUTTONS_OK;
|
||||||
|
|
||||||
if (m_dialogStyle & wxYES_NO)
|
if (style & wxYES_NO)
|
||||||
{
|
{
|
||||||
buttons = GTK_BUTTONS_YES_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;
|
buttons = GTK_BUTTONS_OK_CANCEL;
|
||||||
else
|
else
|
||||||
buttons = GTK_BUTTONS_OK;
|
buttons = GTK_BUTTONS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dialogStyle & wxICON_EXCLAMATION)
|
if (style & wxICON_EXCLAMATION)
|
||||||
type = GTK_MESSAGE_WARNING;
|
type = GTK_MESSAGE_WARNING;
|
||||||
else if (m_dialogStyle & wxICON_ERROR)
|
else if (style & wxICON_ERROR)
|
||||||
type = GTK_MESSAGE_ERROR;
|
type = GTK_MESSAGE_ERROR;
|
||||||
else if (m_dialogStyle & wxICON_INFORMATION)
|
else if (style & wxICON_INFORMATION)
|
||||||
type = GTK_MESSAGE_INFO;
|
type = GTK_MESSAGE_INFO;
|
||||||
else if (m_dialogStyle & wxICON_QUESTION)
|
else if (style & wxICON_QUESTION)
|
||||||
type = GTK_MESSAGE_QUESTION;
|
type = GTK_MESSAGE_QUESTION;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// GTK+ doesn't have a "typeless" msg box, so try to auto detect...
|
// 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 ?
|
m_widget = gtk_message_dialog_new(m_parent ?
|
||||||
@@ -79,12 +79,12 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
|
|||||||
if (m_caption != wxMessageBoxCaptionStr)
|
if (m_caption != wxMessageBoxCaptionStr)
|
||||||
gtk_window_set_title(GTK_WINDOW(m_widget), wxGTK_CONV(m_caption));
|
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_dialog_add_button(GTK_DIALOG(m_widget), GTK_STOCK_CANCEL,
|
||||||
GTK_RESPONSE_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);
|
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_NO);
|
||||||
else
|
else
|
||||||
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_YES);
|
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_YES);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.cpp
|
// Name: src/gtk/msgdlg.cpp
|
||||||
// Purpose: wxMessageDialog for GTK+2
|
// Purpose: wxMessageDialog for GTK+2
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -38,37 +38,37 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
m_caption = caption;
|
m_caption = caption;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
SetMessageDialogStyle(style);
|
||||||
m_parent = wxGetTopLevelParent(parent);
|
m_parent = wxGetTopLevelParent(parent);
|
||||||
|
|
||||||
GtkMessageType type = GTK_MESSAGE_ERROR;
|
GtkMessageType type = GTK_MESSAGE_ERROR;
|
||||||
GtkButtonsType buttons = GTK_BUTTONS_OK;
|
GtkButtonsType buttons = GTK_BUTTONS_OK;
|
||||||
|
|
||||||
if (m_dialogStyle & wxYES_NO)
|
if (style & wxYES_NO)
|
||||||
{
|
{
|
||||||
buttons = GTK_BUTTONS_YES_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;
|
buttons = GTK_BUTTONS_OK_CANCEL;
|
||||||
else
|
else
|
||||||
buttons = GTK_BUTTONS_OK;
|
buttons = GTK_BUTTONS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dialogStyle & wxICON_EXCLAMATION)
|
if (style & wxICON_EXCLAMATION)
|
||||||
type = GTK_MESSAGE_WARNING;
|
type = GTK_MESSAGE_WARNING;
|
||||||
else if (m_dialogStyle & wxICON_ERROR)
|
else if (style & wxICON_ERROR)
|
||||||
type = GTK_MESSAGE_ERROR;
|
type = GTK_MESSAGE_ERROR;
|
||||||
else if (m_dialogStyle & wxICON_INFORMATION)
|
else if (style & wxICON_INFORMATION)
|
||||||
type = GTK_MESSAGE_INFO;
|
type = GTK_MESSAGE_INFO;
|
||||||
else if (m_dialogStyle & wxICON_QUESTION)
|
else if (style & wxICON_QUESTION)
|
||||||
type = GTK_MESSAGE_QUESTION;
|
type = GTK_MESSAGE_QUESTION;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// GTK+ doesn't have a "typeless" msg box, so try to auto detect...
|
// 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 ?
|
m_widget = gtk_message_dialog_new(m_parent ?
|
||||||
@@ -79,12 +79,12 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
|
|||||||
if (m_caption != wxMessageBoxCaptionStr)
|
if (m_caption != wxMessageBoxCaptionStr)
|
||||||
gtk_window_set_title(GTK_WINDOW(m_widget), wxGTK_CONV(m_caption));
|
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_dialog_add_button(GTK_DIALOG(m_widget), GTK_STOCK_CANCEL,
|
||||||
GTK_RESPONSE_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);
|
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_NO);
|
||||||
else
|
else
|
||||||
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_YES);
|
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_YES);
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.cpp
|
// Name: src/mac/carbon/msgdlg.cpp
|
||||||
// Purpose: wxMessageDialog
|
// Purpose: wxMessageDialog
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -29,8 +29,8 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, cons
|
|||||||
{
|
{
|
||||||
m_caption = caption;
|
m_caption = caption;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
|
SetMessageDialogStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxMessageDialog::ShowModal()
|
int wxMessageDialog::ShowModal()
|
||||||
@@ -39,16 +39,18 @@ int wxMessageDialog::ShowModal()
|
|||||||
|
|
||||||
short result ;
|
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 ;
|
AlertType alertType = kAlertPlainAlert ;
|
||||||
if (m_dialogStyle & wxICON_EXCLAMATION)
|
if (style & wxICON_EXCLAMATION)
|
||||||
alertType = kAlertNoteAlert ;
|
alertType = kAlertNoteAlert ;
|
||||||
else if (m_dialogStyle & wxICON_HAND)
|
else if (style & wxICON_HAND)
|
||||||
alertType = kAlertStopAlert ;
|
alertType = kAlertStopAlert ;
|
||||||
else if (m_dialogStyle & wxICON_INFORMATION)
|
else if (style & wxICON_INFORMATION)
|
||||||
alertType = kAlertNoteAlert ;
|
alertType = kAlertNoteAlert ;
|
||||||
else if (m_dialogStyle & wxICON_QUESTION)
|
else if (style & wxICON_QUESTION)
|
||||||
alertType = kAlertCautionAlert ;
|
alertType = kAlertCautionAlert ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -67,15 +69,15 @@ int wxMessageDialog::ShowModal()
|
|||||||
|
|
||||||
bool skipDialog = false ;
|
bool skipDialog = false ;
|
||||||
|
|
||||||
if (m_dialogStyle & wxYES_NO)
|
if (style & wxYES_NO)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
param.defaultText = cfYesString ;
|
param.defaultText = cfYesString ;
|
||||||
param.cancelText = (CFStringRef) kAlertDefaultCancelText;
|
param.cancelText = (CFStringRef) kAlertDefaultCancelText;
|
||||||
param.otherText = cfNoString ;
|
param.otherText = cfNoString ;
|
||||||
param.helpButton = false ;
|
param.helpButton = false ;
|
||||||
param.defaultButton = m_dialogStyle & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton;
|
param.defaultButton = style & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton;
|
||||||
param.cancelButton = kAlertStdAlertCancelButton;
|
param.cancelButton = kAlertStdAlertCancelButton;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -84,14 +86,14 @@ int wxMessageDialog::ShowModal()
|
|||||||
param.cancelText = NULL;
|
param.cancelText = NULL;
|
||||||
param.otherText = cfNoString ;
|
param.otherText = cfNoString ;
|
||||||
param.helpButton = false ;
|
param.helpButton = false ;
|
||||||
param.defaultButton = m_dialogStyle & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton;
|
param.defaultButton = style & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton;
|
||||||
param.cancelButton = 0;
|
param.cancelButton = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// the msw implementation even shows an ok button if it is not specified, we'll do the same
|
// 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
|
// thats a cancel missing
|
||||||
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
|
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
|
||||||
@@ -145,9 +147,9 @@ int wxMessageDialog::ShowModal()
|
|||||||
|
|
||||||
param.movable = true;
|
param.movable = true;
|
||||||
param.filterProc = NULL ;
|
param.filterProc = NULL ;
|
||||||
if (m_dialogStyle & wxYES_NO)
|
if (style & wxYES_NO)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
param.defaultText = yesPString ;
|
param.defaultText = yesPString ;
|
||||||
param.cancelText = (StringPtr) kAlertDefaultCancelText;
|
param.cancelText = (StringPtr) kAlertDefaultCancelText;
|
||||||
@@ -166,9 +168,9 @@ int wxMessageDialog::ShowModal()
|
|||||||
param.cancelButton = 0;
|
param.cancelButton = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_dialogStyle & wxOK)
|
else if (style & wxOK)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
param.defaultText = (StringPtr) kAlertDefaultOKText ;
|
param.defaultText = (StringPtr) kAlertDefaultOKText ;
|
||||||
param.cancelText = (StringPtr) kAlertDefaultCancelText ;
|
param.cancelText = (StringPtr) kAlertDefaultCancelText ;
|
||||||
@@ -197,9 +199,9 @@ int wxMessageDialog::ShowModal()
|
|||||||
StandardAlert( alertType, pascalTitle, pascalText, ¶m, &result );
|
StandardAlert( alertType, pascalTitle, pascalText, ¶m, &result );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dialogStyle & wxOK)
|
if (style & wxOK)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
//TODO add Cancelbutton
|
//TODO add Cancelbutton
|
||||||
switch( result )
|
switch( result )
|
||||||
@@ -227,9 +229,9 @@ int wxMessageDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_dialogStyle & wxYES_NO)
|
else if (style & wxYES_NO)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
switch( result )
|
switch( result )
|
||||||
{
|
{
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.cpp
|
// Name: src/mac/classic/msgdlg.cpp
|
||||||
// Purpose: wxMessageDialog
|
// Purpose: wxMessageDialog
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -27,8 +27,8 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, cons
|
|||||||
{
|
{
|
||||||
m_caption = caption;
|
m_caption = caption;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
|
SetMessageDialogStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxMessageDialog::ShowModal()
|
int wxMessageDialog::ShowModal()
|
||||||
@@ -37,16 +37,18 @@ int wxMessageDialog::ShowModal()
|
|||||||
|
|
||||||
short result ;
|
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 ;
|
AlertType alertType = kAlertPlainAlert ;
|
||||||
if (m_dialogStyle & wxICON_EXCLAMATION)
|
if (style & wxICON_EXCLAMATION)
|
||||||
alertType = kAlertNoteAlert ;
|
alertType = kAlertNoteAlert ;
|
||||||
else if (m_dialogStyle & wxICON_HAND)
|
else if (style & wxICON_HAND)
|
||||||
alertType = kAlertStopAlert ;
|
alertType = kAlertStopAlert ;
|
||||||
else if (m_dialogStyle & wxICON_INFORMATION)
|
else if (style & wxICON_INFORMATION)
|
||||||
alertType = kAlertNoteAlert ;
|
alertType = kAlertNoteAlert ;
|
||||||
else if (m_dialogStyle & wxICON_QUESTION)
|
else if (style & wxICON_QUESTION)
|
||||||
alertType = kAlertCautionAlert ;
|
alertType = kAlertCautionAlert ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -64,9 +66,9 @@ int wxMessageDialog::ShowModal()
|
|||||||
|
|
||||||
bool skipDialog = false ;
|
bool skipDialog = false ;
|
||||||
|
|
||||||
if (m_dialogStyle & wxYES_NO)
|
if (style & wxYES_NO)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
param.defaultText = cfYesString ;
|
param.defaultText = cfYesString ;
|
||||||
param.cancelText = (CFStringRef) kAlertDefaultCancelText;
|
param.cancelText = (CFStringRef) kAlertDefaultCancelText;
|
||||||
@@ -88,7 +90,7 @@ int wxMessageDialog::ShowModal()
|
|||||||
// the msw implementation even shows an ok button if it is not specified, we'll do the same
|
// 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
|
// thats a cancel missing
|
||||||
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
|
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
|
||||||
@@ -142,9 +144,9 @@ int wxMessageDialog::ShowModal()
|
|||||||
|
|
||||||
param.movable = true;
|
param.movable = true;
|
||||||
param.filterProc = NULL ;
|
param.filterProc = NULL ;
|
||||||
if (m_dialogStyle & wxYES_NO)
|
if (style & wxYES_NO)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
param.defaultText = yesPString ;
|
param.defaultText = yesPString ;
|
||||||
param.cancelText = (StringPtr) kAlertDefaultCancelText;
|
param.cancelText = (StringPtr) kAlertDefaultCancelText;
|
||||||
@@ -163,9 +165,9 @@ int wxMessageDialog::ShowModal()
|
|||||||
param.cancelButton = 0;
|
param.cancelButton = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_dialogStyle & wxOK)
|
else if (style & wxOK)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
param.defaultText = (StringPtr) kAlertDefaultOKText ;
|
param.defaultText = (StringPtr) kAlertDefaultOKText ;
|
||||||
param.cancelText = (StringPtr) kAlertDefaultCancelText ;
|
param.cancelText = (StringPtr) kAlertDefaultCancelText ;
|
||||||
@@ -194,9 +196,9 @@ int wxMessageDialog::ShowModal()
|
|||||||
StandardAlert( alertType, pascalTitle, pascalText, ¶m, &result );
|
StandardAlert( alertType, pascalTitle, pascalText, ¶m, &result );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dialogStyle & wxOK)
|
if (style & wxOK)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
//TODO add Cancelbutton
|
//TODO add Cancelbutton
|
||||||
switch( result )
|
switch( result )
|
||||||
@@ -224,9 +226,9 @@ int wxMessageDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_dialogStyle & wxYES_NO)
|
else if (style & wxYES_NO)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
switch( result )
|
switch( result )
|
||||||
{
|
{
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.cpp
|
// Name: src/motif/msgdlg.cpp
|
||||||
// Purpose: wxMessageDialog
|
// Purpose: wxMessageDialog
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -108,24 +108,26 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
m_caption = caption;
|
m_caption = caption;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
|
SetMessageDialogStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxMessageDialog::ShowModal()
|
int wxMessageDialog::ShowModal()
|
||||||
{
|
{
|
||||||
Widget (*dialogCreateFunction)(Widget, String, ArgList, Cardinal) = NULL;
|
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
|
// if we have [Yes], it must be a question
|
||||||
dialogCreateFunction = XmCreateQuestionDialog;
|
dialogCreateFunction = XmCreateQuestionDialog;
|
||||||
}
|
}
|
||||||
else if ( m_dialogStyle & wxICON_STOP )
|
else if ( style & wxICON_STOP )
|
||||||
{
|
{
|
||||||
// error dialog is the one with error icon...
|
// error dialog is the one with error icon...
|
||||||
dialogCreateFunction = XmCreateErrorDialog;
|
dialogCreateFunction = XmCreateErrorDialog;
|
||||||
}
|
}
|
||||||
else if ( m_dialogStyle & wxICON_EXCLAMATION )
|
else if ( style & wxICON_EXCLAMATION )
|
||||||
{
|
{
|
||||||
// ...and the warning dialog too
|
// ...and the warning dialog too
|
||||||
dialogCreateFunction = XmCreateWarningDialog;
|
dialogCreateFunction = XmCreateWarningDialog;
|
||||||
@@ -180,11 +182,11 @@ int wxMessageDialog::ShowModal()
|
|||||||
Widget wBtnHelp = XmMessageBoxGetChild(wMsgBox, XmDIALOG_HELP_BUTTON);
|
Widget wBtnHelp = XmMessageBoxGetChild(wMsgBox, XmDIALOG_HELP_BUTTON);
|
||||||
Widget wBtnCancel = XmMessageBoxGetChild(wMsgBox, XmDIALOG_CANCEL_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
|
// use the cancel button for No and the help button for
|
||||||
// Cancel Yuk :-) MB
|
// Cancel Yuk :-) MB
|
||||||
@@ -208,7 +210,7 @@ int wxMessageDialog::ShowModal()
|
|||||||
// requested)
|
// requested)
|
||||||
//
|
//
|
||||||
XtUnmanageChild(wBtnHelp);
|
XtUnmanageChild(wBtnHelp);
|
||||||
if ( !(m_dialogStyle & wxCANCEL ) ) XtUnmanageChild(wBtnCancel);
|
if ( !(style & wxCANCEL ) ) XtUnmanageChild(wBtnCancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the callbacks for the message box buttons
|
// set the callbacks for the message box buttons
|
||||||
@@ -238,7 +240,7 @@ int wxMessageDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// translate the result if necessary
|
// translate the result if necessary
|
||||||
if ( m_dialogStyle & wxYES_NO )
|
if ( style & wxYES_NO )
|
||||||
{
|
{
|
||||||
if ( m_result == wxID_OK )
|
if ( m_result == wxID_OK )
|
||||||
m_result = wxID_YES;
|
m_result = wxID_YES;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.cpp
|
// Name: src/msw/msgdlg.cpp
|
||||||
// Purpose: wxMessageDialog
|
// Purpose: wxMessageDialog
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -43,19 +43,10 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxPoint& WXUNUSED(pos))
|
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_caption = caption;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
|
SetMessageDialogStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxMessageDialog::ShowModal()
|
int wxMessageDialog::ShowModal()
|
||||||
@@ -77,39 +68,37 @@ int wxMessageDialog::ShowModal()
|
|||||||
|
|
||||||
// translate wx style in MSW
|
// translate wx style in MSW
|
||||||
unsigned int msStyle = MB_OK;
|
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 !(defined(__SMARTPHONE__) && defined(__WXWINCE__))
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (wxStyle & wxCANCEL)
|
||||||
msStyle = MB_YESNOCANCEL;
|
msStyle = MB_YESNOCANCEL;
|
||||||
else
|
else
|
||||||
#endif // !(__SMARTPHONE__ && __WXWINCE__)
|
#endif // !(__SMARTPHONE__ && __WXWINCE__)
|
||||||
msStyle = MB_YESNO;
|
msStyle = MB_YESNO;
|
||||||
|
|
||||||
if (m_dialogStyle & wxNO_DEFAULT)
|
if (wxStyle & wxNO_DEFAULT)
|
||||||
msStyle |= MB_DEFBUTTON2;
|
msStyle |= MB_DEFBUTTON2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dialogStyle & wxOK)
|
if (wxStyle & wxOK)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (wxStyle & wxCANCEL)
|
||||||
msStyle = MB_OKCANCEL;
|
msStyle = MB_OKCANCEL;
|
||||||
else
|
else
|
||||||
msStyle = MB_OK;
|
msStyle = MB_OK;
|
||||||
}
|
}
|
||||||
if (m_dialogStyle & wxICON_EXCLAMATION)
|
if (wxStyle & wxICON_EXCLAMATION)
|
||||||
msStyle |= MB_ICONEXCLAMATION;
|
msStyle |= MB_ICONEXCLAMATION;
|
||||||
else if (m_dialogStyle & wxICON_HAND)
|
else if (wxStyle & wxICON_HAND)
|
||||||
msStyle |= MB_ICONHAND;
|
msStyle |= MB_ICONHAND;
|
||||||
else if (m_dialogStyle & wxICON_INFORMATION)
|
else if (wxStyle & wxICON_INFORMATION)
|
||||||
msStyle |= MB_ICONINFORMATION;
|
msStyle |= MB_ICONINFORMATION;
|
||||||
else if (m_dialogStyle & wxICON_QUESTION)
|
else if (wxStyle & wxICON_QUESTION)
|
||||||
msStyle |= MB_ICONQUESTION;
|
msStyle |= MB_ICONQUESTION;
|
||||||
|
|
||||||
if ( m_dialogStyle & wxSTAY_ON_TOP )
|
if ( wxStyle & wxSTAY_ON_TOP )
|
||||||
msStyle |= MB_TOPMOST;
|
msStyle |= MB_TOPMOST;
|
||||||
|
|
||||||
if (hWnd)
|
if (hWnd)
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msgdlg.cpp
|
// Name: src/os2/msgdlg.cpp
|
||||||
// Purpose: wxMessageDialog
|
// Purpose: wxMessageDialog
|
||||||
// Author: David Webster
|
// Author: David Webster
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 10/10/99
|
// Created: 10/10/99
|
||||||
// RCS-ID: $$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) David Webster
|
// Copyright: (c) David Webster
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -46,8 +46,8 @@ wxMessageDialog::wxMessageDialog(
|
|||||||
{
|
{
|
||||||
m_sCaption = rsCaption;
|
m_sCaption = rsCaption;
|
||||||
m_sMessage = rsMessage;
|
m_sMessage = rsMessage;
|
||||||
m_lDialogStyle = lStyle;
|
|
||||||
m_pParent = NULL; // pParent;
|
m_pParent = NULL; // pParent;
|
||||||
|
SetMessageDialogStyle(lStyle);
|
||||||
} // end of wxMessageDialog::wxMessageDialog
|
} // end of wxMessageDialog::wxMessageDialog
|
||||||
|
|
||||||
int wxMessageDialog::ShowModal()
|
int wxMessageDialog::ShowModal()
|
||||||
@@ -55,6 +55,7 @@ int wxMessageDialog::ShowModal()
|
|||||||
HWND hWnd = 0;
|
HWND hWnd = 0;
|
||||||
ULONG ulStyle = MB_OK;
|
ULONG ulStyle = MB_OK;
|
||||||
int nAns = wxOK;
|
int nAns = wxOK;
|
||||||
|
const long lStyle = GetMessageDialogStyle();
|
||||||
|
|
||||||
if (!wxTheApp->GetTopWindow())
|
if (!wxTheApp->GetTopWindow())
|
||||||
{
|
{
|
||||||
@@ -72,31 +73,31 @@ int wxMessageDialog::ShowModal()
|
|||||||
hWnd = (HWND) m_pParent->GetHWND();
|
hWnd = (HWND) m_pParent->GetHWND();
|
||||||
else
|
else
|
||||||
hWnd = HWND_DESKTOP;
|
hWnd = HWND_DESKTOP;
|
||||||
if (m_lDialogStyle & wxYES_NO)
|
if (lStyle & wxYES_NO)
|
||||||
{
|
{
|
||||||
if (m_lDialogStyle & wxCANCEL)
|
if (lStyle & wxCANCEL)
|
||||||
ulStyle = MB_YESNOCANCEL;
|
ulStyle = MB_YESNOCANCEL;
|
||||||
else
|
else
|
||||||
ulStyle = MB_YESNO;
|
ulStyle = MB_YESNO;
|
||||||
|
|
||||||
if (m_lDialogStyle & wxNO_DEFAULT)
|
if (lStyle & wxNO_DEFAULT)
|
||||||
ulStyle |= MB_DEFBUTTON2;
|
ulStyle |= MB_DEFBUTTON2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_lDialogStyle & wxOK)
|
if (lStyle & wxOK)
|
||||||
{
|
{
|
||||||
if (m_lDialogStyle & wxCANCEL)
|
if (lStyle & wxCANCEL)
|
||||||
ulStyle = MB_OKCANCEL;
|
ulStyle = MB_OKCANCEL;
|
||||||
else
|
else
|
||||||
ulStyle = MB_OK;
|
ulStyle = MB_OK;
|
||||||
}
|
}
|
||||||
if (m_lDialogStyle & wxICON_EXCLAMATION)
|
if (lStyle & wxICON_EXCLAMATION)
|
||||||
ulStyle |= MB_ICONEXCLAMATION;
|
ulStyle |= MB_ICONEXCLAMATION;
|
||||||
else if (m_lDialogStyle & wxICON_HAND)
|
else if (lStyle & wxICON_HAND)
|
||||||
ulStyle |= MB_ICONHAND;
|
ulStyle |= MB_ICONHAND;
|
||||||
else if (m_lDialogStyle & wxICON_INFORMATION)
|
else if (lStyle & wxICON_INFORMATION)
|
||||||
ulStyle |= MB_ICONEXCLAMATION;
|
ulStyle |= MB_ICONEXCLAMATION;
|
||||||
else if (m_lDialogStyle & wxICON_QUESTION)
|
else if (lStyle & wxICON_QUESTION)
|
||||||
ulStyle |= MB_ICONQUESTION;
|
ulStyle |= MB_ICONQUESTION;
|
||||||
|
|
||||||
if (hWnd != HWND_DESKTOP)
|
if (hWnd != HWND_DESKTOP)
|
||||||
|
@@ -36,19 +36,10 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxPoint& WXUNUSED(pos))
|
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_caption = caption;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
|
SetMessageDialogStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxMessageDialog::ShowModal()
|
int wxMessageDialog::ShowModal()
|
||||||
@@ -56,35 +47,36 @@ int wxMessageDialog::ShowModal()
|
|||||||
int AlertID=1000;
|
int AlertID=1000;
|
||||||
int Result=0;
|
int Result=0;
|
||||||
int wxResult=wxID_OK;
|
int wxResult=wxID_OK;
|
||||||
|
const long style = GetMessageDialogStyle();
|
||||||
|
|
||||||
// Handle to the currently running application database
|
// Handle to the currently running application database
|
||||||
DmOpenRef AppDB;
|
DmOpenRef AppDB;
|
||||||
SysGetModuleDatabase(SysGetRefNum(), NULL, &AppDB);
|
SysGetModuleDatabase(SysGetRefNum(), NULL, &AppDB);
|
||||||
|
|
||||||
// Translate wx styles into Palm OS styles
|
// 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
|
AlertID=1300; // Yes No Cancel
|
||||||
else
|
else
|
||||||
AlertID=1200; // Yes No
|
AlertID=1200; // Yes No
|
||||||
}
|
}
|
||||||
if (m_dialogStyle & wxOK)
|
if (style & wxOK)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
AlertID=1100; // Ok Cancel
|
AlertID=1100; // Ok Cancel
|
||||||
else
|
else
|
||||||
AlertID=1000; // Ok
|
AlertID=1000; // Ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the icon styles
|
// Add the icon styles
|
||||||
if (m_dialogStyle & wxICON_EXCLAMATION)
|
if (style & wxICON_EXCLAMATION)
|
||||||
AlertID=AlertID+0; // Warning
|
AlertID=AlertID+0; // Warning
|
||||||
else if (m_dialogStyle & wxICON_HAND)
|
else if (style & wxICON_HAND)
|
||||||
AlertID=AlertID+1; // Error
|
AlertID=AlertID+1; // Error
|
||||||
else if (m_dialogStyle & wxICON_INFORMATION)
|
else if (style & wxICON_INFORMATION)
|
||||||
AlertID=AlertID+2; // Information
|
AlertID=AlertID+2; // Information
|
||||||
else if (m_dialogStyle & wxICON_QUESTION)
|
else if (style & wxICON_QUESTION)
|
||||||
AlertID=AlertID+3; // Confirmation
|
AlertID=AlertID+3; // Confirmation
|
||||||
|
|
||||||
// The Palm OS Dialog API does not support custom titles in a dialog box.
|
// The Palm OS Dialog API does not support custom titles in a dialog box.
|
||||||
|
Reference in New Issue
Block a user