mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-14 05:06:54 +03:00
Fixed modal UIWindow.
--HG-- branch : dev
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
#define UI_MESSAGE_BOX_DEFAULT_FLAGS UI_WIN_CLOSE_BUTTON | UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS | UI_WIN_MODAL | UI_WIN_SHARE_ALPHA_WITH_CHILDS
|
||||
|
||||
class EE_API UIMessageBox : public UIWindow {
|
||||
public:
|
||||
enum Type {
|
||||
@@ -16,9 +18,9 @@ class EE_API UIMessageBox : public UIWindow {
|
||||
OK
|
||||
};
|
||||
|
||||
static UIMessageBox * New( Type type, String message );
|
||||
static UIMessageBox * New( const Type& type, const String& message, const Uint32& windowFlags = UI_MESSAGE_BOX_DEFAULT_FLAGS );
|
||||
|
||||
UIMessageBox( Type type, String message );
|
||||
UIMessageBox( const Type& type, const String& message, const Uint32& windowFlags = UI_MESSAGE_BOX_DEFAULT_FLAGS );
|
||||
|
||||
virtual ~UIMessageBox();
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
UIMessageBox * UIMessageBox::New( UIMessageBox::Type type, String message) {
|
||||
return eeNew( UIMessageBox, ( type, message ) );
|
||||
UIMessageBox * UIMessageBox::New( const Type& type, const String& message, const Uint32& windowFlags ) {
|
||||
return eeNew( UIMessageBox, ( type, message, windowFlags ) );
|
||||
}
|
||||
|
||||
UIMessageBox::UIMessageBox( UIMessageBox::Type type , String message ) :
|
||||
UIMessageBox::UIMessageBox( const Type& type, const String& message, const Uint32& windowFlags ) :
|
||||
UIWindow(),
|
||||
mMsgBoxType( type ),
|
||||
mCloseWithKey( KEY_UNKNOWN )
|
||||
{
|
||||
mStyleConfig.WinFlags &= ~UI_WIN_RESIZEABLE;
|
||||
mStyleConfig.WinFlags = windowFlags;
|
||||
|
||||
updateWinFlags();
|
||||
|
||||
|
||||
@@ -372,7 +372,6 @@ void UIWindow::createModalControl() {
|
||||
|
||||
if ( NULL == mModalCtrl ) {
|
||||
mModalCtrl = UIWidget::NewWithTag( "window::modaldialog" );
|
||||
mModalCtrl->writeNodeFlag( NODE_FLAG_OWNED_BY_NODE, 1 );
|
||||
mModalCtrl->setParent( Ctrl )->setPosition(0,0)->setSize( Ctrl->getSize() );
|
||||
mModalCtrl->setAnchors( UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM );
|
||||
} else {
|
||||
|
||||
@@ -7,8 +7,8 @@ MapEditor * Editor = NULL;
|
||||
bool onCloseRequestCallback( EE::Window::Window * w ) {
|
||||
if ( NULL != Editor ) {
|
||||
MsgBox = UIMessageBox::New( UIMessageBox::OK_CANCEL, "Do you really want to close the current map?\nAll changes will be lost." );
|
||||
MsgBox->addEventListener( Event::MsgBoxConfirmClick, cb::Make1<void, const Event*>( []( const Event * event ) { win->close(); } ) );
|
||||
MsgBox->addEventListener( Event::OnClose, cb::Make1<void, const Event*>( []( const Event * event ) { MsgBox = NULL; } ) );
|
||||
MsgBox->addEventListener( Event::MsgBoxConfirmClick, []( const Event * event ) { win->close(); } );
|
||||
MsgBox->addEventListener( Event::OnClose, []( const Event * event ) { MsgBox = NULL; } );
|
||||
MsgBox->setTitle( "Close Map?" );
|
||||
MsgBox->center();
|
||||
MsgBox->show();
|
||||
|
||||
@@ -7,8 +7,8 @@ TextureAtlasEditor * Editor = NULL;
|
||||
bool onCloseRequestCallback( EE::Window::Window * w ) {
|
||||
if ( NULL != Editor && Editor->isEdited() ) {
|
||||
MsgBox = UIMessageBox::New( UIMessageBox::OK_CANCEL, "Do you really want to close the texture atlas editor?\nAll changes will be lost." );
|
||||
MsgBox->addEventListener( Event::MsgBoxConfirmClick, cb::Make1<void, const Event*>( []( const Event * event ) { win->close(); } ) );
|
||||
MsgBox->addEventListener( Event::OnClose, cb::Make1<void, const Event*>( []( const Event * event ) { MsgBox = NULL; } ) );
|
||||
MsgBox->addEventListener( Event::MsgBoxConfirmClick, []( const Event * event ) { win->close(); } );
|
||||
MsgBox->addEventListener( Event::OnClose, []( const Event * event ) { MsgBox = NULL; } );
|
||||
MsgBox->setTitle( "Close Texture Atlas Editor?" );
|
||||
MsgBox->center();
|
||||
MsgBox->show();
|
||||
|
||||
@@ -695,8 +695,8 @@ bool onCloseRequestCallback( EE::Window::Window * ) {
|
||||
|
||||
MsgBox = UIMessageBox::New( UIMessageBox::OK_CANCEL, "Do you really want to close the current file?\nAll changes will be lost." );
|
||||
MsgBox->setTheme( theme );
|
||||
MsgBox->addEventListener( Event::MsgBoxConfirmClick, cb::Make1<void, const Event*>( []( const Event * ) { window->close(); } ) );
|
||||
MsgBox->addEventListener( Event::OnClose, cb::Make1<void, const Event*>( []( const Event * ) { MsgBox = NULL; } ) );
|
||||
MsgBox->addEventListener( Event::MsgBoxConfirmClick, []( const Event * ) { window->close(); } );
|
||||
MsgBox->addEventListener( Event::OnClose, []( const Event * ) { MsgBox = NULL; } );
|
||||
MsgBox->setTitle( "Close Editor?" );
|
||||
MsgBox->center();
|
||||
MsgBox->show();
|
||||
|
||||
Reference in New Issue
Block a user