mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-13 04:42:12 +03:00
More clean up.
--HG-- branch : dev
This commit is contained in:
@@ -48,6 +48,6 @@
|
||||
#include <eepp/ui/uitabwidget.hpp>
|
||||
#include <eepp/ui/tools/textureatlaseditor.hpp>
|
||||
|
||||
#include <eepp/ui/uidefaulttheme.hpp>
|
||||
#include <eepp/ui/uithemedefault.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,24 +13,9 @@ namespace EE { namespace UI {
|
||||
|
||||
class EE_API UICommonDialog : public UIWindow {
|
||||
public:
|
||||
class CreateParams : public UIWindow::CreateParams {
|
||||
public:
|
||||
inline CreateParams() :
|
||||
UIWindow::CreateParams(),
|
||||
DefaultDirectory( Sys::getProcessPath() ),
|
||||
DefaultFilePattern( "*" ),
|
||||
CDLFlags( UI_CDL_DEFAULT_FLAGS )
|
||||
{
|
||||
}
|
||||
static UICommonDialog * New( Uint32 CDLFlags = UI_CDL_DEFAULT_FLAGS, std::string DefaultFilePattern = "*", std::string DefaultDirectory = Sys::getProcessPath() );
|
||||
|
||||
inline ~CreateParams() {}
|
||||
|
||||
std::string DefaultDirectory;
|
||||
std::string DefaultFilePattern;
|
||||
Uint32 CDLFlags;
|
||||
};
|
||||
|
||||
UICommonDialog( const UICommonDialog::CreateParams& Params );
|
||||
UICommonDialog( Uint32 CDLFlags = UI_CDL_DEFAULT_FLAGS, std::string DefaultFilePattern = "*", std::string DefaultDirectory = Sys::getProcessPath() );
|
||||
|
||||
virtual ~UICommonDialog();
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#ifndef EE_UICUIDEFAULTTHEME_HPP
|
||||
#define EE_UICUIDEFAULTTHEME_HPP
|
||||
|
||||
#include <eepp/ui/uitheme.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
class EE_API UIDefaultTheme : public UITheme {
|
||||
public:
|
||||
UIDefaultTheme( const std::string& name, const std::string& abbr, Graphics::Font * defaultFont = NULL );
|
||||
|
||||
TabWidgetStyleConfig getTabWidgetStyleConfig();
|
||||
|
||||
ProgressBarStyleConfig getProgressBarStyleConfig();
|
||||
|
||||
WinMenuStyleConfig getWinMenuStyleConfig();
|
||||
|
||||
WindowStyleConfig getWindowStyleConfig();
|
||||
|
||||
MenuStyleConfig getMenuStyleConfig();
|
||||
|
||||
virtual UICommonDialog * createCommonDialog( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255, Uint32 CDLFlags = UI_CDL_DEFAULT_FLAGS, std::string DefaultFilePattern = "*", std::string DefaultDirectory = Sys::getProcessPath() );
|
||||
|
||||
virtual UIMessageBox * createMessageBox( UI_MSGBOX_TYPE Type = MSGBOX_OKCANCEL, const String& Message = String(), Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 );
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -9,23 +9,9 @@ namespace EE { namespace UI {
|
||||
|
||||
class EE_API UIMessageBox : public UIWindow {
|
||||
public:
|
||||
class CreateParams : public UIWindow::CreateParams {
|
||||
public:
|
||||
inline CreateParams() :
|
||||
UIWindow::CreateParams(),
|
||||
Type( MSGBOX_OKCANCEL ),
|
||||
CloseWithKey( KEY_UNKNOWN )
|
||||
{
|
||||
}
|
||||
static UIMessageBox * New( UI_MSGBOX_TYPE type, String message );
|
||||
|
||||
inline ~CreateParams() {}
|
||||
|
||||
UI_MSGBOX_TYPE Type;
|
||||
String Message;
|
||||
Uint32 CloseWithKey;
|
||||
};
|
||||
|
||||
UIMessageBox( const UIMessageBox::CreateParams& Params );
|
||||
UIMessageBox( UI_MSGBOX_TYPE type, String message );
|
||||
|
||||
virtual ~UIMessageBox();
|
||||
|
||||
@@ -40,6 +26,10 @@ class EE_API UIMessageBox : public UIWindow {
|
||||
UIPushButton * getButtonCancel() const;
|
||||
|
||||
virtual bool show();
|
||||
|
||||
Uint32 getCloseWithKey() const;
|
||||
|
||||
void setCloseWithKey(const Uint32 & closeWithKey);
|
||||
protected:
|
||||
UI_MSGBOX_TYPE mMsgBoxType;
|
||||
UITextBox * mTextBox;
|
||||
|
||||
@@ -99,10 +99,6 @@ class EE_API UITheme : protected ResourceManager<UISkin> {
|
||||
|
||||
virtual UISelectButton * createSelectButton( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, SubTexture * Icon = NULL, Int32 IconHorizontalMargin = 0, bool IconAutoMargin = true );
|
||||
|
||||
virtual UICommonDialog * createCommonDialog( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255, Uint32 CDLFlags = UI_CDL_DEFAULT_FLAGS, std::string DefaultFilePattern = "*", std::string DefaultDirectory = Sys::getProcessPath() );
|
||||
|
||||
virtual UIMessageBox * createMessageBox( UI_MSGBOX_TYPE Type = MSGBOX_OKCANCEL, const String& Message = String(), Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 );
|
||||
|
||||
ColorA getTooltipFontColor() const;
|
||||
|
||||
void setTooltipFontColor(const ColorA & tooltipFontColor);
|
||||
|
||||
25
include/eepp/ui/uithemedefault.hpp
Normal file
25
include/eepp/ui/uithemedefault.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef EE_UICUIDEFAULTTHEME_HPP
|
||||
#define EE_UICUIDEFAULTTHEME_HPP
|
||||
|
||||
#include <eepp/ui/uitheme.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
class EE_API UIThemeDefault : public UITheme {
|
||||
public:
|
||||
UIThemeDefault( const std::string& name, const std::string& abbr, Graphics::Font * defaultFont = NULL );
|
||||
|
||||
TabWidgetStyleConfig getTabWidgetStyleConfig();
|
||||
|
||||
ProgressBarStyleConfig getProgressBarStyleConfig();
|
||||
|
||||
WinMenuStyleConfig getWinMenuStyleConfig();
|
||||
|
||||
WindowStyleConfig getWindowStyleConfig();
|
||||
|
||||
MenuStyleConfig getMenuStyleConfig();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -11,25 +11,6 @@ class EE_API UIWindow : public UIComplexControl {
|
||||
public:
|
||||
static UIWindow * New();
|
||||
|
||||
class CreateParams : public UIComplexControl::CreateParams {
|
||||
public:
|
||||
inline CreateParams() :
|
||||
UIComplexControl::CreateParams()
|
||||
{
|
||||
UITheme * theme = UIThemeManager::instance()->getDefaultTheme();
|
||||
|
||||
if ( NULL != theme ) {
|
||||
windowStyleConfig = theme->getWindowStyleConfig();
|
||||
}
|
||||
}
|
||||
|
||||
inline ~CreateParams() {}
|
||||
|
||||
WindowStyleConfig windowStyleConfig;
|
||||
};
|
||||
|
||||
UIWindow( const UIWindow::CreateParams& Params );
|
||||
|
||||
UIWindow();
|
||||
|
||||
virtual ~UIWindow();
|
||||
@@ -161,6 +142,10 @@ class EE_API UIWindow : public UIComplexControl {
|
||||
Vector2i mResizePos;
|
||||
KeyboardShortcuts mKbShortcuts;
|
||||
|
||||
Uint32 mCloseListener;
|
||||
Uint32 mMaximizeListener;
|
||||
Uint32 mMinimizeListener;
|
||||
|
||||
virtual void onSizeChange();
|
||||
|
||||
virtual void onAlphaChange();
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
../../include/eepp/graphics/font.hpp
|
||||
../../include/eepp/ui/uithemeconfig.hpp
|
||||
../../include/eepp/ui/uithemedefault.hpp
|
||||
../../src/eepp/gaming/mapobjectlayer.cpp
|
||||
../../src/eepp/graphics/globalbatchrenderer.cpp
|
||||
../../src/eepp/graphics/pixeldensity.cpp
|
||||
../../src/eepp/graphics/pixelperfect.cpp
|
||||
../../src/eepp/ui/uithemedefault.cpp
|
||||
ee.config
|
||||
ee.includes
|
||||
../../../eeiv/src/capp.cpp
|
||||
@@ -580,8 +582,6 @@ ee.includes
|
||||
../../include/eepp/core/noncopyable.hpp
|
||||
../../include/eepp/system/clock.hpp
|
||||
../../src/eepp/system/lock.cpp
|
||||
../../src/eepp/ui/uidefaulttheme.cpp
|
||||
../../include/eepp/ui/uidefaulttheme.hpp
|
||||
../../src/eepp/helper/SOIL2/src/SOIL2/stbi_pvr_c.h
|
||||
../../src/eepp/helper/SOIL2/src/SOIL2/stbi_pvr.h
|
||||
../../src/eepp/helper/SOIL2/src/SOIL2/stbi_pkm_c.h
|
||||
|
||||
@@ -904,15 +904,15 @@ void MapEditor::FileMenuClick( const UIEvent * Event ) {
|
||||
if ( "New..." == txt ) {
|
||||
CreateNewMap();
|
||||
} else if ( "Open..." == txt ) {
|
||||
UICommonDialog * TGDialog = mTheme->createCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS, "*.eem" );
|
||||
|
||||
UICommonDialog * TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS, "*.eem" );
|
||||
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
|
||||
TGDialog->setTitle( "Open Map" );
|
||||
TGDialog->addEventListener( UIEvent::EventOpenFile, cb::Make1( this, &MapEditor::MapOpen ) );
|
||||
TGDialog->center();
|
||||
TGDialog->show();
|
||||
} else if ( "Save As..." == txt ) {
|
||||
UICommonDialog * TGDialog = mTheme->createCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*.eem" );
|
||||
|
||||
UICommonDialog * TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*.eem" );
|
||||
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
|
||||
TGDialog->setTitle( "Save Map" );
|
||||
TGDialog->addEventListener( UIEvent::EventSaveFile, cb::Make1( this, &MapEditor::MapSave ) );
|
||||
TGDialog->center();
|
||||
@@ -922,7 +922,7 @@ void MapEditor::FileMenuClick( const UIEvent * Event ) {
|
||||
mUIMap->Map()->save( mUIMap->Map()->getPath() );
|
||||
}
|
||||
} else if ( "Close" == txt ) {
|
||||
UIMessageBox * MsgBox = mTheme->createMessageBox( MSGBOX_OKCANCEL, "Do you really want to close the current map?\nAll changes will be lost." );
|
||||
UIMessageBox * MsgBox = UIMessageBox::New( MSGBOX_OKCANCEL, "Do you really want to close the current map?\nAll changes will be lost." );
|
||||
MsgBox->addEventListener( UIEvent::EventMsgBoxConfirmClick, cb::Make1( this, &MapEditor::OnMapClose ) );
|
||||
MsgBox->setTitle( "Close Map?" );
|
||||
MsgBox->center();
|
||||
@@ -1041,8 +1041,8 @@ void MapEditor::MapMenuClick( const UIEvent * Event ) {
|
||||
tWin->center();
|
||||
tWin->show();
|
||||
} else if ( "Add External Texture Atlas..." == txt ) {
|
||||
UICommonDialog * TGDialog = mTheme->createCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION );
|
||||
|
||||
UICommonDialog * TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION );
|
||||
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
|
||||
TGDialog->setTitle( "Load Texture Atlas..." );
|
||||
TGDialog->addEventListener( UIEvent::EventOpenFile, cb::Make1( this, &MapEditor::TextureAtlasOpen ) );
|
||||
TGDialog->center();
|
||||
@@ -1088,7 +1088,7 @@ void MapEditor::LayerMenuClick( const UIEvent * Event ) {
|
||||
}
|
||||
|
||||
UIMessageBox * MapEditor::CreateAlert( const String& title, const String& text ) {
|
||||
UIMessageBox * MsgBox = mTheme->createMessageBox( MSGBOX_OK, text );
|
||||
UIMessageBox * MsgBox = UIMessageBox::New( MSGBOX_OK, text );
|
||||
MsgBox->setTitle( title );
|
||||
MsgBox->center();
|
||||
MsgBox->show();
|
||||
|
||||
@@ -250,8 +250,8 @@ void TextureAtlasEditor::fileMenuClick( const UIEvent * Event ) {
|
||||
if ( "New..." == txt ) {
|
||||
eeNew( TextureAtlasNew, ( cb::Make1( this, &TextureAtlasEditor::onTextureAtlasCreate ) ) );
|
||||
} else if ( "Open..." == txt ) {
|
||||
UICommonDialog * TGDialog = mTheme->createCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION );
|
||||
|
||||
UICommonDialog * TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION );
|
||||
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
|
||||
TGDialog->setTitle( "Open Texture Atlas" );
|
||||
TGDialog->addEventListener( UIEvent::EventOpenFile, cb::Make1( this, &TextureAtlasEditor::openTextureAtlas ) );
|
||||
TGDialog->center();
|
||||
@@ -262,7 +262,7 @@ void TextureAtlasEditor::fileMenuClick( const UIEvent * Event ) {
|
||||
}
|
||||
} else if ( "Close" == txt ) {
|
||||
if ( NULL != mTextureAtlasLoader && mTextureAtlasLoader->isLoaded() ) {
|
||||
UIMessageBox * MsgBox = mTheme->createMessageBox( MSGBOX_OKCANCEL, "Do you really want to close the current texture atlas?\nAll changes will be lost." );
|
||||
UIMessageBox * MsgBox = UIMessageBox::New( MSGBOX_OKCANCEL, "Do you really want to close the current texture atlas?\nAll changes will be lost." );
|
||||
MsgBox->addEventListener( UIEvent::EventMsgBoxConfirmClick, cb::Make1( this, &TextureAtlasEditor::onTextureAtlasClose ) );
|
||||
MsgBox->setTitle( "Close Texture Atlas?" );
|
||||
MsgBox->center();
|
||||
|
||||
@@ -114,8 +114,8 @@ void TextureAtlasNew::okClick( const UIEvent * Event ) {
|
||||
std::string ext( mSaveFileType->getText() );
|
||||
String::toLowerInPlace( ext );
|
||||
|
||||
UICommonDialog * TGDialog = mTheme->createCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*." + ext );
|
||||
|
||||
UICommonDialog * TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*." + ext );
|
||||
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
|
||||
TGDialog->setTitle( "Save Texture Atlas" );
|
||||
TGDialog->addEventListener( UIEvent::EventSaveFile, cb::Make1( this, &TextureAtlasNew::textureAtlasSave ) );
|
||||
TGDialog->center();
|
||||
@@ -182,8 +182,8 @@ void TextureAtlasNew::onDialogFolderSelect( const UIEvent * Event ) {
|
||||
const UIEventMouse * MouseEvent = reinterpret_cast<const UIEventMouse*>( Event );
|
||||
|
||||
if ( MouseEvent->getFlags() & EE_BUTTON_LMASK ) {
|
||||
UICommonDialog * TGDialog = mTheme->createCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_ALLOW_FOLDER_SELECT, "*" );
|
||||
|
||||
UICommonDialog * TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS | CDL_FLAG_ALLOW_FOLDER_SELECT, "*" );
|
||||
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
|
||||
TGDialog->setTitle( "Create Texture Atlas ( Select Folder Containing Textures )" );
|
||||
TGDialog->addEventListener( UIEvent::EventOpenFile, cb::Make1( this, &TextureAtlasNew::onSelectFolder ) );
|
||||
TGDialog->center();
|
||||
@@ -223,13 +223,13 @@ void TextureAtlasNew::onSelectFolder( const UIEvent * Event ) {
|
||||
if ( count ) {
|
||||
mTGPath->setText( FPath );
|
||||
} else {
|
||||
MsgBox = mTheme->createMessageBox( MSGBOX_OK, "The folder must contain at least one image!" );
|
||||
MsgBox = UIMessageBox::New( MSGBOX_OK, "The folder must contain at least one image!" );
|
||||
MsgBox->setTitle( "Error" );
|
||||
MsgBox->center();
|
||||
MsgBox->show();
|
||||
}
|
||||
} else {
|
||||
MsgBox = mTheme->createMessageBox( MSGBOX_OK, "You must select a folder!" );
|
||||
MsgBox = UIMessageBox::New( MSGBOX_OK, "You must select a folder!" );
|
||||
MsgBox->setTitle( "Error" );
|
||||
MsgBox->center();
|
||||
MsgBox->show();
|
||||
|
||||
@@ -10,10 +10,14 @@ namespace EE { namespace UI {
|
||||
#define CDLG_MIN_WIDTH 420
|
||||
#define CDLG_MIN_HEIGHT 320
|
||||
|
||||
UICommonDialog::UICommonDialog( const UICommonDialog::CreateParams& Params ) :
|
||||
UIWindow( Params ),
|
||||
mCurPath( Params.DefaultDirectory ),
|
||||
mCDLFlags( Params.CDLFlags )
|
||||
UICommonDialog * UICommonDialog::New(Uint32 CDLFlags, std::string DefaultFilePattern, std::string DefaultDirectory) {
|
||||
return eeNew( UICommonDialog, ( CDLFlags, DefaultFilePattern, DefaultDirectory ) );
|
||||
}
|
||||
|
||||
UICommonDialog::UICommonDialog( Uint32 CDLFlags , std::string DefaultFilePattern, std::__cxx11::string DefaultDirectory ) :
|
||||
UIWindow(),
|
||||
mCurPath( DefaultDirectory ),
|
||||
mCDLFlags( CDLFlags )
|
||||
{
|
||||
if ( mSize.getWidth() < CDLG_MIN_WIDTH ) {
|
||||
mSize.x = CDLG_MIN_WIDTH;
|
||||
@@ -123,7 +127,7 @@ UICommonDialog::UICommonDialog( const UICommonDialog::CreateParams& Params ) :
|
||||
mFiletype->setPosition( fileTypes->getPosition().x + fileTypes->getSize().getWidth(), fileTypes->getPosition().y );
|
||||
mFiletype->setAnchors( UI_ANCHOR_LEFT | UI_ANCHOR_RIGHT );
|
||||
mFiletype->setPopUpToMainControl( true );
|
||||
mFiletype->getListBox()->addListBoxItem( Params.DefaultFilePattern );
|
||||
mFiletype->getListBox()->addListBoxItem( DefaultFilePattern );
|
||||
mFiletype->getListBox()->setSelected(0);
|
||||
|
||||
applyDefaultTheme();
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
#include <eepp/ui/uidefaulttheme.hpp>
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/ui/uipopupmenu.hpp>
|
||||
#include <eepp/ui/uiprogressbar.hpp>
|
||||
#include <eepp/ui/uicommondialog.hpp>
|
||||
#include <eepp/ui/uimessagebox.hpp>
|
||||
#include <eepp/ui/uitabwidget.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
UIDefaultTheme::UIDefaultTheme( const std::string& name, const std::string& Abbr, Graphics::Font * defaultFont ) :
|
||||
UITheme( name, Abbr, defaultFont )
|
||||
{
|
||||
mFontStyleConfig.FontColor = ColorA( 230, 230, 230, 255 );
|
||||
mFontStyleConfig.FontOverColor = mFontStyleConfig.FontSelectedColor = ColorA( 255, 255, 255, 255 );
|
||||
mFontStyleConfig.FontShadowColor = ColorA( 50, 50, 50, 150 );
|
||||
mFontStyleConfig.FontSelectionBackColor = ColorA( 150, 150, 150, 255 );
|
||||
|
||||
setTooltipFontColor( ColorA( 0, 0, 0, 255 ) );
|
||||
setTooltipPadding( Recti( 4, 6, 4, 6) );
|
||||
}
|
||||
|
||||
TabWidgetStyleConfig UIDefaultTheme::getTabWidgetStyleConfig() {
|
||||
TabWidgetStyleConfig tabWidgetStyleConfig = UITheme::getTabWidgetStyleConfig();
|
||||
tabWidgetStyleConfig.TabSeparation = -1;
|
||||
tabWidgetStyleConfig.FontSelectedColor = ColorA( 255, 255, 255, 255 );
|
||||
tabWidgetStyleConfig.DrawLineBelowTabs = true;
|
||||
tabWidgetStyleConfig.LineBelowTabsColor = ColorA( 0, 0, 0, 255 );
|
||||
tabWidgetStyleConfig.LineBelowTabsYOffset = -1;
|
||||
return tabWidgetStyleConfig;
|
||||
}
|
||||
|
||||
ProgressBarStyleConfig UIDefaultTheme::getProgressBarStyleConfig() {
|
||||
ProgressBarStyleConfig progressBarStyleConfig = UITheme::getProgressBarStyleConfig();
|
||||
progressBarStyleConfig.DisplayPercent = true;
|
||||
progressBarStyleConfig.VerticalExpand = true;
|
||||
progressBarStyleConfig.FillerPadding = Rectf( 2, 2, 2, 2 );
|
||||
progressBarStyleConfig.MovementSpeed = Vector2f( 32, 0 );
|
||||
return progressBarStyleConfig;
|
||||
}
|
||||
|
||||
WinMenuStyleConfig UIDefaultTheme::getWinMenuStyleConfig() {
|
||||
WinMenuStyleConfig winMenuStyleConfig = UITheme::getWinMenuStyleConfig();
|
||||
winMenuStyleConfig.ButtonMargin = 12;
|
||||
return winMenuStyleConfig;
|
||||
}
|
||||
|
||||
WindowStyleConfig UIDefaultTheme::getWindowStyleConfig() {
|
||||
WindowStyleConfig windowStyleConfig = UITheme::getWindowStyleConfig();
|
||||
windowStyleConfig.WinFlags |= UI_WIN_DRAW_SHADOW;
|
||||
windowStyleConfig.ButtonsPositionFixer.x = -2;
|
||||
windowStyleConfig.TitleFontColor = ColorA( 230, 230, 230, 255 );
|
||||
return windowStyleConfig;
|
||||
}
|
||||
|
||||
MenuStyleConfig UIDefaultTheme::getMenuStyleConfig() {
|
||||
MenuStyleConfig menuStyleConfig = UITheme::getMenuStyleConfig();
|
||||
menuStyleConfig.MinWidth = 100;
|
||||
menuStyleConfig.MinSpaceForIcons = 24;
|
||||
menuStyleConfig.MinRightMargin = 8;
|
||||
menuStyleConfig.FontColor = ColorA( 230, 230, 230, 255 );
|
||||
menuStyleConfig.FontOverColor = ColorA( 255, 255, 255, 255 );
|
||||
return menuStyleConfig;
|
||||
}
|
||||
|
||||
UICommonDialog * UIDefaultTheme::createCommonDialog( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 WinFlags, Sizei MinWindowSize, Uint8 BaseAlpha, Uint32 CDLFlags, std::string DefaultFilePattern, std::string DefaultDirectory ) {
|
||||
UICommonDialog::CreateParams DLGParams;
|
||||
DLGParams.setParent( Parent );
|
||||
DLGParams.setPosition( Pos );
|
||||
DLGParams.setSize( Size );
|
||||
DLGParams.Flags = Flags;
|
||||
DLGParams.windowStyleConfig.WinFlags = WinFlags;
|
||||
DLGParams.windowStyleConfig.MinWindowSize = MinWindowSize;
|
||||
DLGParams.windowStyleConfig.BaseAlpha = BaseAlpha;
|
||||
DLGParams.DefaultDirectory = DefaultDirectory;
|
||||
DLGParams.DefaultFilePattern = DefaultFilePattern;
|
||||
DLGParams.CDLFlags = CDLFlags;
|
||||
|
||||
if ( getUseDefaultThemeValues() ) {
|
||||
DLGParams.Flags |= UI_DRAW_SHADOW;
|
||||
DLGParams.windowStyleConfig.WinFlags |= UI_WIN_DRAW_SHADOW;
|
||||
DLGParams.windowStyleConfig.ButtonsPositionFixer.x = -2;
|
||||
DLGParams.windowStyleConfig.TitleFontColor = ColorA( 230, 230, 230, 255 );
|
||||
}
|
||||
|
||||
return eeNew( UICommonDialog, ( DLGParams ) );
|
||||
}
|
||||
|
||||
UIMessageBox * UIDefaultTheme::createMessageBox( UI_MSGBOX_TYPE Type, const String& Message, Uint32 WinFlags, UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Sizei MinWindowSize, Uint8 BaseAlpha ) {
|
||||
UIMessageBox::CreateParams MsgBoxParams;
|
||||
MsgBoxParams.setParent( Parent );
|
||||
MsgBoxParams.setPosition( Pos );
|
||||
MsgBoxParams.setSize( Size );
|
||||
MsgBoxParams.Flags = Flags;
|
||||
MsgBoxParams.windowStyleConfig.WinFlags = WinFlags;
|
||||
MsgBoxParams.windowStyleConfig.MinWindowSize = MinWindowSize;
|
||||
MsgBoxParams.windowStyleConfig.BaseAlpha = BaseAlpha;
|
||||
MsgBoxParams.Type = Type;
|
||||
MsgBoxParams.Message = Message;
|
||||
|
||||
if ( getUseDefaultThemeValues() ) {
|
||||
MsgBoxParams.Flags |= UI_DRAW_SHADOW;
|
||||
MsgBoxParams.windowStyleConfig.WinFlags |= UI_WIN_DRAW_SHADOW;
|
||||
MsgBoxParams.windowStyleConfig.ButtonsPositionFixer.x = -2;
|
||||
MsgBoxParams.windowStyleConfig.TitleFontColor = ColorA( 230, 230, 230, 255 );
|
||||
}
|
||||
|
||||
return eeNew( UIMessageBox, ( MsgBoxParams ) );
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -48,17 +48,16 @@ void UIManager::init( Uint32 Flags, EE::Window::Window * window ) {
|
||||
|
||||
mInit = true;
|
||||
|
||||
UIWindow::CreateParams Params;
|
||||
Params.setParent( NULL );
|
||||
Params.setPosition( 0, 0 );
|
||||
Params.setSize( (Float)Engine::instance()->getWidth() / PixelDensity::getPixelDensity(), (Float)Engine::instance()->getHeight() / PixelDensity::getPixelDensity() );
|
||||
Params.Flags = UI_CONTROL_DEFAULT_FLAGS | UI_REPORT_SIZE_CHANGE_TO_CHILDS;
|
||||
Params.windowStyleConfig.WinFlags = UI_WIN_NO_BORDER | UI_WIN_RESIZEABLE;
|
||||
Params.windowStyleConfig.MinWindowSize = Sizei( 0, 0 );
|
||||
Params.windowStyleConfig.DecorationSize = Sizei( 0, 0 );
|
||||
Params.windowStyleConfig.DecorationAutoSize = false;
|
||||
|
||||
mControl = eeNew( UIWindow, ( Params ) );
|
||||
WindowStyleConfig windowStyleConfig;
|
||||
windowStyleConfig.WinFlags = UI_WIN_NO_BORDER | UI_WIN_RESIZEABLE;
|
||||
windowStyleConfig.MinWindowSize = Sizei( 0, 0 );
|
||||
windowStyleConfig.DecorationSize = Sizei( 0, 0 );
|
||||
windowStyleConfig.DecorationAutoSize = false;
|
||||
mControl = UIWindow::New();
|
||||
mControl->setFlags( UI_REPORT_SIZE_CHANGE_TO_CHILDS );
|
||||
mControl->setStyleConfig( windowStyleConfig );
|
||||
mControl->setSize( (Float)Engine::instance()->getWidth() / PixelDensity::getPixelDensity(), (Float)Engine::instance()->getHeight() / PixelDensity::getPixelDensity() );
|
||||
mControl->setVisible( true );
|
||||
mControl->setEnabled( true );
|
||||
mControl->getContainer()->setEnabled( false );
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
UIMessageBox::UIMessageBox( const UIMessageBox::CreateParams& Params ) :
|
||||
UIWindow( Params ),
|
||||
mMsgBoxType( Params.Type ),
|
||||
mCloseWithKey( Params.CloseWithKey )
|
||||
UIMessageBox * UIMessageBox::New(UI_MSGBOX_TYPE type, String message) {
|
||||
return eeNew( UIMessageBox, ( type, message ) );
|
||||
}
|
||||
|
||||
UIMessageBox::UIMessageBox( UI_MSGBOX_TYPE type , String message ) :
|
||||
UIWindow(),
|
||||
mMsgBoxType( type ),
|
||||
mCloseWithKey( KEY_UNKNOWN )
|
||||
{
|
||||
mButtonOK = UIPushButton::New();
|
||||
mButtonOK->setParent( getContainer() )
|
||||
@@ -28,7 +32,7 @@ UIMessageBox::UIMessageBox( const UIMessageBox::CreateParams& Params ) :
|
||||
mTextBox->setParent( getContainer() )
|
||||
->setSize( getContainer()->getSize().getWidth(), mButtonOK->getPosition().y )
|
||||
->setHorizontalAlign( UI_HALIGN_CENTER );
|
||||
mTextBox->setText( Params.Message );
|
||||
mTextBox->setText( message );
|
||||
|
||||
setSize( getContainer()->getSize().getWidth(), mTextBox->getTextHeight() + mButtonOK->getSize().getHeight() + 8 );
|
||||
|
||||
@@ -66,7 +70,6 @@ UIMessageBox::UIMessageBox( const UIMessageBox::CreateParams& Params ) :
|
||||
mButtonOK->toFront();
|
||||
|
||||
onAutoSize();
|
||||
|
||||
}
|
||||
|
||||
UIMessageBox::~UIMessageBox() {
|
||||
@@ -129,7 +132,7 @@ UIPushButton * UIMessageBox::getButtonCancel() const {
|
||||
}
|
||||
|
||||
void UIMessageBox::onAutoSize() {
|
||||
Sizei nSize( mTextBox->getTextWidth() + 48, mTextBox->getTextHeight() + mButtonOK->getSize().getHeight() + mStyleConfig.DecorationSize.getHeight() + 8 );
|
||||
Sizei nSize( PixelDensity::pxToDpI( mTextBox->getTextWidth() ) + 48, mTextBox->getTextHeight() + mButtonOK->getSize().getHeight() + mStyleConfig.DecorationSize.getHeight() + 8 );
|
||||
|
||||
if ( !( nSize.getWidth() > getContainer()->getSize().getWidth() ) ) {
|
||||
nSize.x = getContainer()->getSize().getWidth();
|
||||
@@ -162,4 +165,14 @@ bool UIMessageBox::show() {
|
||||
return b;
|
||||
}
|
||||
|
||||
Uint32 UIMessageBox::getCloseWithKey() const
|
||||
{
|
||||
return mCloseWithKey;
|
||||
}
|
||||
|
||||
void UIMessageBox::setCloseWithKey(const Uint32 & closeWithKey)
|
||||
{
|
||||
mCloseWithKey = closeWithKey;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -512,35 +512,6 @@ UISelectButton * UITheme::createSelectButton( UIControl * Parent, const Sizei& S
|
||||
return Ctrl;
|
||||
}
|
||||
|
||||
UICommonDialog * UITheme::createCommonDialog( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 WinFlags, Sizei MinWindowSize, Uint8 BaseAlpha, Uint32 CDLFlags, std::string DefaultFilePattern, std::string DefaultDirectory ) {
|
||||
UICommonDialog::CreateParams DLGParams;
|
||||
DLGParams.setParent( Parent );
|
||||
DLGParams.setPosition( Pos );
|
||||
DLGParams.setSize( Size );
|
||||
DLGParams.Flags = Flags;
|
||||
DLGParams.windowStyleConfig.WinFlags = WinFlags;
|
||||
DLGParams.windowStyleConfig.MinWindowSize = MinWindowSize;
|
||||
DLGParams.windowStyleConfig.BaseAlpha = BaseAlpha;
|
||||
DLGParams.DefaultDirectory = DefaultDirectory;
|
||||
DLGParams.DefaultFilePattern = DefaultFilePattern;
|
||||
DLGParams.CDLFlags = CDLFlags;
|
||||
return eeNew( UICommonDialog, ( DLGParams ) );
|
||||
}
|
||||
|
||||
UIMessageBox * UITheme::createMessageBox( UI_MSGBOX_TYPE Type, const String& Message, Uint32 WinFlags, UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Sizei MinWindowSize, Uint8 BaseAlpha ) {
|
||||
UIMessageBox::CreateParams MsgBoxParams;
|
||||
MsgBoxParams.setParent( Parent );
|
||||
MsgBoxParams.setPosition( Pos );
|
||||
MsgBoxParams.setSize( Size );
|
||||
MsgBoxParams.Flags = Flags;
|
||||
MsgBoxParams.windowStyleConfig.WinFlags = WinFlags;
|
||||
MsgBoxParams.windowStyleConfig.MinWindowSize = MinWindowSize;
|
||||
MsgBoxParams.windowStyleConfig.BaseAlpha = BaseAlpha;
|
||||
MsgBoxParams.Type = Type;
|
||||
MsgBoxParams.Message = Message;
|
||||
return eeNew( UIMessageBox, ( MsgBoxParams ) );
|
||||
}
|
||||
|
||||
ColorA UITheme::getTooltipFontColor() const {
|
||||
return mTooltipFontColor;
|
||||
}
|
||||
|
||||
67
src/eepp/ui/uithemedefault.cpp
Normal file
67
src/eepp/ui/uithemedefault.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
#include <eepp/ui/uithemedefault.hpp>
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/ui/uipopupmenu.hpp>
|
||||
#include <eepp/ui/uiprogressbar.hpp>
|
||||
#include <eepp/ui/uicommondialog.hpp>
|
||||
#include <eepp/ui/uimessagebox.hpp>
|
||||
#include <eepp/ui/uitabwidget.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
UIThemeDefault::UIThemeDefault( const std::string& name, const std::string& Abbr, Graphics::Font * defaultFont ) :
|
||||
UITheme( name, Abbr, defaultFont )
|
||||
{
|
||||
mFontStyleConfig.FontColor = ColorA( 230, 230, 230, 255 );
|
||||
mFontStyleConfig.FontOverColor = mFontStyleConfig.FontSelectedColor = ColorA( 255, 255, 255, 255 );
|
||||
mFontStyleConfig.FontShadowColor = ColorA( 50, 50, 50, 150 );
|
||||
mFontStyleConfig.FontSelectionBackColor = ColorA( 150, 150, 150, 255 );
|
||||
|
||||
setTooltipFontColor( ColorA( 0, 0, 0, 255 ) );
|
||||
setTooltipPadding( Recti( 4, 6, 4, 6) );
|
||||
}
|
||||
|
||||
TabWidgetStyleConfig UIThemeDefault::getTabWidgetStyleConfig() {
|
||||
TabWidgetStyleConfig tabWidgetStyleConfig = UITheme::getTabWidgetStyleConfig();
|
||||
tabWidgetStyleConfig.TabSeparation = -1;
|
||||
tabWidgetStyleConfig.FontSelectedColor = ColorA( 255, 255, 255, 255 );
|
||||
tabWidgetStyleConfig.DrawLineBelowTabs = true;
|
||||
tabWidgetStyleConfig.LineBelowTabsColor = ColorA( 0, 0, 0, 255 );
|
||||
tabWidgetStyleConfig.LineBelowTabsYOffset = -1;
|
||||
return tabWidgetStyleConfig;
|
||||
}
|
||||
|
||||
ProgressBarStyleConfig UIThemeDefault::getProgressBarStyleConfig() {
|
||||
ProgressBarStyleConfig progressBarStyleConfig = UITheme::getProgressBarStyleConfig();
|
||||
progressBarStyleConfig.DisplayPercent = true;
|
||||
progressBarStyleConfig.VerticalExpand = true;
|
||||
progressBarStyleConfig.FillerPadding = Rectf( 2, 2, 2, 2 );
|
||||
progressBarStyleConfig.MovementSpeed = Vector2f( 32, 0 );
|
||||
return progressBarStyleConfig;
|
||||
}
|
||||
|
||||
WinMenuStyleConfig UIThemeDefault::getWinMenuStyleConfig() {
|
||||
WinMenuStyleConfig winMenuStyleConfig = UITheme::getWinMenuStyleConfig();
|
||||
winMenuStyleConfig.ButtonMargin = 12;
|
||||
return winMenuStyleConfig;
|
||||
}
|
||||
|
||||
WindowStyleConfig UIThemeDefault::getWindowStyleConfig() {
|
||||
WindowStyleConfig windowStyleConfig = UITheme::getWindowStyleConfig();
|
||||
windowStyleConfig.WinFlags |= UI_WIN_DRAW_SHADOW;
|
||||
windowStyleConfig.ButtonsPositionFixer.x = -2;
|
||||
windowStyleConfig.TitleFontColor = ColorA( 230, 230, 230, 255 );
|
||||
return windowStyleConfig;
|
||||
}
|
||||
|
||||
MenuStyleConfig UIThemeDefault::getMenuStyleConfig() {
|
||||
MenuStyleConfig menuStyleConfig = UITheme::getMenuStyleConfig();
|
||||
menuStyleConfig.MinWidth = 100;
|
||||
menuStyleConfig.MinSpaceForIcons = 24;
|
||||
menuStyleConfig.MinRightMargin = 8;
|
||||
menuStyleConfig.FontColor = ColorA( 230, 230, 230, 255 );
|
||||
menuStyleConfig.FontOverColor = ColorA( 255, 255, 255, 255 );
|
||||
return menuStyleConfig;
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -8,35 +8,6 @@ UIWindow * UIWindow::New() {
|
||||
return eeNew( UIWindow, () );
|
||||
}
|
||||
|
||||
UIWindow::UIWindow( const UIWindow::CreateParams& Params ) :
|
||||
UIComplexControl( Params ),
|
||||
mStyleConfig( Params.windowStyleConfig ),
|
||||
mWindowDecoration( NULL ),
|
||||
mBorderLeft( NULL ),
|
||||
mBorderRight( NULL ),
|
||||
mBorderBottom( NULL ),
|
||||
mButtonClose( NULL ),
|
||||
mButtonMinimize( NULL ),
|
||||
mButtonMaximize( NULL ),
|
||||
mTitle( NULL ),
|
||||
mModalCtrl( NULL ),
|
||||
mResizeType( RESIZE_NONE )
|
||||
{
|
||||
UIManager::instance()->windowAdd( this );
|
||||
|
||||
mContainer = eeNew( UIComplexControl, () );
|
||||
mContainer->setParent( this );
|
||||
mContainer->setFlags( UI_REPORT_SIZE_CHANGE_TO_CHILDS );
|
||||
mContainer->setSize( mSize );
|
||||
mContainer->addEventListener( UIEvent::EventOnPosChange, cb::Make1( this, &UIWindow::onContainerPosChange ) );
|
||||
|
||||
updateWinFlags();
|
||||
|
||||
setAlpha( mStyleConfig.BaseAlpha );
|
||||
|
||||
applyDefaultTheme();
|
||||
}
|
||||
|
||||
UIWindow::UIWindow() :
|
||||
UIComplexControl(),
|
||||
mWindowDecoration( NULL ),
|
||||
@@ -48,7 +19,10 @@ UIWindow::UIWindow() :
|
||||
mButtonMaximize( NULL ),
|
||||
mTitle( NULL ),
|
||||
mModalCtrl( NULL ),
|
||||
mResizeType( RESIZE_NONE )
|
||||
mResizeType( RESIZE_NONE ),
|
||||
mCloseListener(0),
|
||||
mMaximizeListener(0),
|
||||
mMinimizeListener(0)
|
||||
{
|
||||
setHorizontalAlign( UI_HALIGN_CENTER );
|
||||
|
||||
@@ -60,7 +34,7 @@ UIWindow::UIWindow() :
|
||||
mStyleConfig = theme->getWindowStyleConfig();
|
||||
}
|
||||
|
||||
mContainer = eeNew( UIComplexControl, () );
|
||||
mContainer = UIComplexControl::New();
|
||||
mContainer->setParent( this );
|
||||
mContainer->setFlags( UI_REPORT_SIZE_CHANGE_TO_CHILDS );
|
||||
mContainer->setSize( mSize );
|
||||
@@ -82,6 +56,8 @@ UIWindow::~UIWindow() {
|
||||
}
|
||||
|
||||
void UIWindow::updateWinFlags() {
|
||||
bool needsUpdate = false;
|
||||
|
||||
if ( !( mStyleConfig.WinFlags & UI_WIN_NO_BORDER ) ) {
|
||||
if ( NULL == mWindowDecoration )
|
||||
mWindowDecoration = eeNew( UIControlAnim, () );
|
||||
@@ -115,50 +91,62 @@ void UIWindow::updateWinFlags() {
|
||||
mContainer->setDragEnabled( true );
|
||||
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_CLOSE_BUTTON ) {
|
||||
if ( NULL == mButtonClose )
|
||||
mButtonClose = eeNew( UIComplexControl, () );
|
||||
if ( NULL == mButtonClose ) {
|
||||
mButtonClose = UIComplexControl::New();
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
mButtonClose->setParent( this );
|
||||
mButtonClose->setVisible( true );
|
||||
mButtonClose->setEnabled( true );
|
||||
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS ) {
|
||||
mButtonClose->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::onButtonCloseClick ) );
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS && 0 == mCloseListener ) {
|
||||
mCloseListener = mButtonClose->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::onButtonCloseClick ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( mStyleConfig.WinFlags & UI_WIN_RESIZEABLE ) && ( mStyleConfig.WinFlags & UI_WIN_MAXIMIZE_BUTTON ) ) {
|
||||
if ( NULL == mButtonMaximize )
|
||||
mButtonMaximize = eeNew( UIComplexControl, () );
|
||||
if ( NULL == mButtonMaximize ) {
|
||||
mButtonMaximize = UIComplexControl::New();
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
mButtonMaximize->setParent( this );
|
||||
mButtonMaximize->setVisible( true );
|
||||
mButtonMaximize->setEnabled( true );
|
||||
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS ) {
|
||||
mButtonMaximize->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::onButtonMaximizeClick ) );
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS && 0 == mMaximizeListener ) {
|
||||
mMaximizeListener = mButtonMaximize->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::onButtonMaximizeClick ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_MINIMIZE_BUTTON ) {
|
||||
if ( NULL == mButtonMinimize )
|
||||
mButtonMinimize = eeNew( UIComplexControl, () );
|
||||
if ( NULL == mButtonMinimize ) {
|
||||
mButtonMinimize = UIComplexControl::New();
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
mButtonMinimize->setParent( this );
|
||||
mButtonMinimize->setVisible( true );
|
||||
mButtonMinimize->setEnabled( true );
|
||||
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS ) {
|
||||
mButtonMinimize->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::onButtonMinimizeClick ) );
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS && 0 == mMinimizeListener ) {
|
||||
mMinimizeListener = mButtonMinimize->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::onButtonMinimizeClick ) );
|
||||
}
|
||||
}
|
||||
|
||||
setDragEnabled( true );
|
||||
} else {
|
||||
setDragEnabled( false );
|
||||
}
|
||||
|
||||
if ( isModal() ) {
|
||||
createModalControl();
|
||||
}
|
||||
|
||||
if ( needsUpdate ) {
|
||||
applyDefaultTheme();
|
||||
}
|
||||
}
|
||||
|
||||
void UIWindow::createModalControl() {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
UIWinMenu *UIWinMenu::New() {
|
||||
UIWinMenu * UIWinMenu::New() {
|
||||
return eeNew( UIWinMenu, () );
|
||||
}
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ void EETest::createUI() {
|
||||
|
||||
TextureAtlasLoader tgl( MyPath + "ui/" + mThemeName + EE_TEXTURE_ATLAS_EXTENSION );
|
||||
|
||||
mTheme = UITheme::loadFromTextureAtlas( eeNew( UIDefaultTheme, ( mThemeName, mThemeName ) ), TextureAtlasManager::instance()->getByName( mThemeName ) );
|
||||
mTheme = UITheme::loadFromTextureAtlas( eeNew( UIThemeDefault, ( mThemeName, mThemeName ) ), TextureAtlasManager::instance()->getByName( mThemeName ) );
|
||||
|
||||
UIThemeManager::instance()->add( mTheme );
|
||||
UIThemeManager::instance()->setDefaultEffectsEnabled( true );
|
||||
@@ -770,7 +770,8 @@ void EETest::onETGEditorClose() {
|
||||
}
|
||||
|
||||
void EETest::createCommonDialog() {
|
||||
UICommonDialog * CDialog = mTheme->createCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON );
|
||||
UICommonDialog * CDialog = UICommonDialog::New();
|
||||
CDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON );
|
||||
CDialog->addFilePattern( "*.hpp;*.cpp", true );
|
||||
CDialog->center();
|
||||
CDialog->show();
|
||||
|
||||
Reference in New Issue
Block a user