Improve build and widget storage
There are no longer any qt headers included in wx/qt headers. Applications do not need to link with qt librarys anymore, only wxqt libraries. wxWindow and derived widgets only contain one pointer to their qtwidget, no longer carrying both base and derived pointers in parallel as was before.
This commit is contained in:
committed by
Vadim Zeitlin
parent
88e134ef81
commit
35bc8f449b
@@ -27,39 +27,40 @@ wxMessageDialog::wxMessageDialog( wxWindow *parent, const wxString& message,
|
||||
const wxString& caption, long style, const wxPoint& pos )
|
||||
: wxMessageDialogBase( parent, message, caption, style )
|
||||
{
|
||||
m_qtWindow = new wxQtMessageDialog( parent, this );
|
||||
wxQtMessageDialog *dlg = new wxQtMessageDialog( parent, this );
|
||||
m_qtWindow = dlg;
|
||||
|
||||
// Set properties
|
||||
Move( pos );
|
||||
GetHandle()->setText( wxQtConvertString( message ) );
|
||||
GetHandle()->setWindowTitle( wxQtConvertString( caption ) );
|
||||
dlg->setText( wxQtConvertString( message ) );
|
||||
dlg->setWindowTitle( wxQtConvertString( caption ) );
|
||||
|
||||
// Apply the style
|
||||
SetWindowStyleFlag( style );
|
||||
|
||||
// Buttons
|
||||
if ( style & wxOK )
|
||||
GetHandle()->addButton( QMessageBox::Ok );
|
||||
dlg->addButton( QMessageBox::Ok );
|
||||
if ( style & wxCANCEL )
|
||||
GetHandle()->addButton( QMessageBox::Cancel );
|
||||
dlg->addButton( QMessageBox::Cancel );
|
||||
if ( style & wxYES_NO )
|
||||
{
|
||||
GetHandle()->addButton( QMessageBox::Yes );
|
||||
GetHandle()->addButton( QMessageBox::No );
|
||||
dlg->addButton( QMessageBox::Yes );
|
||||
dlg->addButton( QMessageBox::No );
|
||||
}
|
||||
|
||||
// Default button
|
||||
if ( style & wxNO_DEFAULT )
|
||||
GetHandle()->setDefaultButton( QMessageBox::No );
|
||||
dlg->setDefaultButton( QMessageBox::No );
|
||||
else if ( style & wxCANCEL_DEFAULT )
|
||||
GetHandle()->setDefaultButton( QMessageBox::Cancel );
|
||||
dlg->setDefaultButton( QMessageBox::Cancel );
|
||||
else
|
||||
{
|
||||
// Default to OK or Yes
|
||||
if ( style & wxOK )
|
||||
GetHandle()->setDefaultButton( QMessageBox::Ok );
|
||||
dlg->setDefaultButton( QMessageBox::Ok );
|
||||
else
|
||||
GetHandle()->setDefaultButton( QMessageBox::Yes );
|
||||
dlg->setDefaultButton( QMessageBox::Yes );
|
||||
}
|
||||
|
||||
// Icon
|
||||
@@ -67,31 +68,31 @@ wxMessageDialog::wxMessageDialog( wxWindow *parent, const wxString& message,
|
||||
if ( style & wxICON_NONE )
|
||||
{
|
||||
numIcons++;
|
||||
GetHandle()->setIcon( QMessageBox::NoIcon );
|
||||
dlg->setIcon( QMessageBox::NoIcon );
|
||||
}
|
||||
|
||||
if ( style & wxICON_EXCLAMATION )
|
||||
{
|
||||
numIcons++;
|
||||
GetHandle()->setIcon( QMessageBox::Warning );
|
||||
dlg->setIcon( QMessageBox::Warning );
|
||||
}
|
||||
|
||||
if ( style & wxICON_ERROR || style & wxICON_HAND )
|
||||
{
|
||||
numIcons++;
|
||||
GetHandle()->setIcon( QMessageBox::Critical );
|
||||
dlg->setIcon( QMessageBox::Critical );
|
||||
}
|
||||
|
||||
if ( style & wxICON_QUESTION )
|
||||
{
|
||||
numIcons++;
|
||||
GetHandle()->setIcon( QMessageBox::Question );
|
||||
dlg->setIcon( QMessageBox::Question );
|
||||
}
|
||||
|
||||
if ( style & wxICON_INFORMATION )
|
||||
{
|
||||
numIcons++;
|
||||
GetHandle()->setIcon( QMessageBox::Information );
|
||||
dlg->setIcon( QMessageBox::Information );
|
||||
}
|
||||
|
||||
wxCHECK_RET( numIcons <= 1, "Multiple icon definitions" );
|
||||
@@ -99,23 +100,23 @@ wxMessageDialog::wxMessageDialog( wxWindow *parent, const wxString& message,
|
||||
{
|
||||
// Use default
|
||||
if ( style & wxYES_NO )
|
||||
GetHandle()->setIcon( QMessageBox::Question );
|
||||
dlg->setIcon( QMessageBox::Question );
|
||||
else
|
||||
GetHandle()->setIcon( QMessageBox::Information );
|
||||
dlg->setIcon( QMessageBox::Information );
|
||||
}
|
||||
|
||||
if ( style & wxSTAY_ON_TOP )
|
||||
GetHandle()->setWindowModality( Qt::ApplicationModal );
|
||||
dlg->setWindowModality( Qt::ApplicationModal );
|
||||
|
||||
PostCreation();
|
||||
}
|
||||
|
||||
int wxMessageDialog::ShowModal()
|
||||
{
|
||||
wxCHECK_MSG( GetHandle(), -1, "Invalid dialog" );
|
||||
wxCHECK_MSG( m_qtWindow, -1, "Invalid dialog" );
|
||||
|
||||
// Exec may return a wx identifier if a close event is generated
|
||||
int ret = GetHandle()->exec();
|
||||
int ret = static_cast<QDialog*>(m_qtWindow)->exec();
|
||||
switch ( ret )
|
||||
{
|
||||
case QMessageBox::Ok:
|
||||
@@ -132,11 +133,6 @@ int wxMessageDialog::ShowModal()
|
||||
}
|
||||
}
|
||||
|
||||
QMessageBox *wxMessageDialog::GetHandle() const
|
||||
{
|
||||
return static_cast<QMessageBox*>(m_qtWindow);
|
||||
}
|
||||
|
||||
wxMessageDialog::~wxMessageDialog()
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user