Replaced default font.

Added beginPropertiesTransaction() and endPropertiesTransaction().
Added UILayout.
Added EventOnDragStart and EventOnDragStop.
Renamed MsgDragEnd to MsgDragStop.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2017-10-16 01:33:34 -03:00
parent f64b2719ef
commit 4e1f476ee1
46 changed files with 219 additions and 25 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -46,7 +46,7 @@ class EE_API UIDragableControl : public UIControl {
virtual Uint32 onDragStart( const Vector2i& position );
virtual Uint32 onDragEnd( const Vector2i& position );
virtual Uint32 onDragStop( const Vector2i& position );
};
}}

View File

@@ -50,6 +50,8 @@ class EE_API UIEvent {
EventMsgBoxConfirmClick,
EventOnTabSelected,
EventOnClose, // Warning: Only some controls will report this event.
EventOnDragStart,
EventOnDragStop,
EventUser,
EventForceDWord = eeINDEX_NOT_FOUND
};

View File

@@ -1,11 +1,11 @@
#ifndef EE_UI_UIGRIDLAYOUT
#define EE_UI_UIGRIDLAYOUT
#include <eepp/ui/uiwidget.hpp>
#include <eepp/ui/uilayout.hpp>
namespace EE { namespace UI {
class EE_API UIGridLayout : public UIWidget {
class EE_API UIGridLayout : public UILayout {
public:
enum ElementMode
{

View File

@@ -109,6 +109,7 @@ enum UI_CONTROL_TYPES {
UI_TYPE_RELATIVE_LAYOUT,
UI_TYPE_TOUCH_DRAGABLE_WIDGET,
UI_TYPE_GRID_LAYOUT,
UI_TYPE_LAYOUT,
UI_TYPE_USER = 10000
};

View File

@@ -0,0 +1,19 @@
#ifndef EE_GRAPHICS_UILAYOUT_HPP
#define EE_GRAPHICS_UILAYOUT_HPP
#include <eepp/ui/uiwidget.hpp>
namespace EE { namespace UI {
class EE_API UILayout : public UIWidget {
public:
UILayout();
virtual Uint32 getType() const;
virtual bool isType( const Uint32& type ) const;
};
}}
#endif

View File

@@ -1,11 +1,11 @@
#ifndef UI_UILINEARLAYOUT_HPP
#define UI_UILINEARLAYOUT_HPP
#include <eepp/ui/uiwidget.hpp>
#include <eepp/ui/uilayout.hpp>
namespace EE { namespace UI {
class EE_API UILinearLayout : public UIWidget {
class EE_API UILinearLayout : public UILayout {
public:
static UILinearLayout * New();

View File

@@ -23,7 +23,7 @@ class EE_API UIMessage {
MsgCellClicked,
MsgSelected,
MsgDragStart,
MsgDragEnd,
MsgDragStop,
MsgLayoutAttributeChange,
MsgUser,
MsgForceDWord = eeINDEX_NOT_FOUND

View File

@@ -1,11 +1,11 @@
#ifndef UI_UIRELATIVELAYOUT_HPP
#define UI_UIRELATIVELAYOUT_HPP
#include <eepp/ui/uiwidget.hpp>
#include <eepp/ui/uilayout.hpp>
namespace EE { namespace UI {
class EE_API UIRelativeLayout : public UIWidget {
class EE_API UIRelativeLayout : public UILayout {
public:
static UIRelativeLayout * New();

View File

@@ -96,6 +96,7 @@ class EE_API UIWidget : public UIControlAnim {
LayoutSizeRules mLayoutHeightRules;
LayoutPositionRules mLayoutPositionRule;
UIWidget * mLayoutPositionRuleWidget;
int mPropertiesTransactionCount;
void createTooltip();
@@ -109,6 +110,10 @@ class EE_API UIWidget : public UIControlAnim {
virtual void onWidgetCreated();
void beginPropertiesTransaction();
void endPropertiesTransaction();
void notifyLayoutAttrChange();
void notifyLayoutAttrChangeParent();

View File

@@ -34,6 +34,7 @@
../../include/eepp/ui/uieventmouse.hpp
../../include/eepp/ui/uigridlayout.hpp
../../include/eepp/ui/uiimage.hpp
../../include/eepp/ui/uilayout.hpp
../../include/eepp/ui/uilinearlayout.hpp
../../include/eepp/ui/uimenuseparator.hpp
../../include/eepp/ui/uirelativelayout.hpp
@@ -82,6 +83,7 @@
../../src/eepp/ui/uidragablecontrol.cpp
../../src/eepp/ui/uigridlayout.cpp
../../src/eepp/ui/uiimage.cpp
../../src/eepp/ui/uilayout.cpp
../../src/eepp/ui/uilinearlayout.cpp
../../src/eepp/ui/uiloader.cpp
../../src/eepp/ui/uimenuseparator.cpp

View File

@@ -167,6 +167,8 @@ void UICheckBox::setTextSeparation(const Int32 & textSeparation) {
}
void UICheckBox::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -177,6 +179,8 @@ void UICheckBox::loadFromXmlNode(const pugi::xml_node & node) {
setActive( ait->as_bool() );
}
}
endPropertiesTransaction();
}
Uint32 UICheckBox::onKeyDown( const UIEventKey& Event ) {

View File

@@ -75,9 +75,13 @@ const String& UIComboBox::getText() {
}
void UIComboBox::loadFromXmlNode(const pugi::xml_node& node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
mDropDownList->loadFromXmlNode( node );
endPropertiesTransaction();
}
void UIComboBox::updateControls() {

View File

@@ -92,10 +92,12 @@ Uint32 UIDragableControl::onDrag( const Vector2i& Pos ) {
}
Uint32 UIDragableControl::onDragStart( const Vector2i& Pos ) {
sendCommonEvent( UIEvent::EventOnDragStart );
return 1;
}
Uint32 UIDragableControl::onDragEnd( const Vector2i& Pos ) {
Uint32 UIDragableControl::onDragStop( const Vector2i& Pos ) {
sendCommonEvent( UIEvent::EventOnDragStop );
return 1;
}
@@ -112,7 +114,7 @@ bool UIDragableControl::isDragging() const {
}
void UIDragableControl::setDragging( const bool& dragging ) {
writeCtrlFlag( UI_CTRL_FLAG_DRAGGING, true == dragging );
writeCtrlFlag( UI_CTRL_FLAG_DRAGGING, dragging );
if ( dragging ) {
UIMessage tMsg( this, UIMessage::MsgDragStart, 0 );
@@ -120,10 +122,10 @@ void UIDragableControl::setDragging( const bool& dragging ) {
onDragStart( UIManager::instance()->getMousePos() );
} else {
UIMessage tMsg( this, UIMessage::MsgDragEnd, 0 );
UIMessage tMsg( this, UIMessage::MsgDragStop, 0 );
messagePost( &tMsg );
onDragEnd( UIManager::instance()->getMousePos() );
onDragStop( UIManager::instance()->getMousePos() );
}
}

View File

@@ -287,6 +287,8 @@ void UIDropDownList::destroyListBox() {
}
void UIDropDownList::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UITextInput::loadFromXmlNode( node );
mListBox->loadFromXmlNode( node );
@@ -301,6 +303,8 @@ void UIDropDownList::loadFromXmlNode(const pugi::xml_node & node) {
setMaxNumVisibleItems( ait->as_uint() );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -8,7 +8,7 @@ UIGridLayout * UIGridLayout::New() {
}
UIGridLayout::UIGridLayout() :
UIWidget(),
UILayout(),
mColumnMode( Weight ),
mRowMode( Weight ),
mColumnWeight( 0.25f ),
@@ -198,6 +198,8 @@ Sizei UIGridLayout::getTargetElementSize() {
}
void UIGridLayout::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -241,6 +243,8 @@ void UIGridLayout::loadFromXmlNode(const pugi::xml_node & node) {
setReverseDraw( ait->as_bool() );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -170,6 +170,8 @@ const Vector2i& UIImage::getAlignOffset() const {
}
void UIImage::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -198,6 +200,8 @@ void UIImage::loadFromXmlNode(const pugi::xml_node & node) {
}
}
}
endPropertiesTransaction();
}
Uint32 UIImage::getScaleType() const {

18
src/eepp/ui/uilayout.cpp Normal file
View File

@@ -0,0 +1,18 @@
#include <eepp/ui/uilayout.hpp>
namespace EE { namespace UI {
UILayout::UILayout() :
UIWidget()
{
}
Uint32 UILayout::getType() const {
return UI_TYPE_LAYOUT;
}
bool UILayout::isType( const Uint32& type ) const {
return UIWidget::getType() == type ? true : UIWidget::isType( type );
}
}}

View File

@@ -16,7 +16,7 @@ UILinearLayout * UILinearLayout::NewHorizontal() {
}
UILinearLayout::UILinearLayout() :
UIWidget(),
UILayout(),
mOrientation( UI_VERTICAL )
{
setFlags( UI_CLIP_ENABLE );
@@ -326,6 +326,8 @@ Sizei UILinearLayout::getTotalUsedSize() {
}
void UILinearLayout::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -342,6 +344,8 @@ void UILinearLayout::loadFromXmlNode(const pugi::xml_node & node) {
setOrientation( UI_VERTICAL );
}
}
endPropertiesTransaction();
}
Uint32 UILinearLayout::onMessage(const UIMessage * Msg) {

View File

@@ -971,6 +971,8 @@ void UIListBox::setFontStyleConfig(const UIFontStyleConfig & fontStyleConfig) {
}
void UIListBox::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UITouchDragableWidget::loadFromXmlNode( node );
std::vector<String> items;
@@ -1045,6 +1047,8 @@ void UIListBox::loadFromXmlNode(const pugi::xml_node & node) {
}
}
}
endPropertiesTransaction();
}
}}

View File

@@ -164,6 +164,8 @@ UILoader * UILoader::setArcStartAngle( const Float& arcStartAngle ) {
}
void UILoader::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -188,6 +190,8 @@ void UILoader::loadFromXmlNode(const pugi::xml_node & node) {
setArcStartAngle( ait->as_float() );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -545,6 +545,8 @@ static Drawable * getIconDrawable( const std::string& name ) {
}
void UIMenu::loadFromXmlNode( const pugi::xml_node& node ) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for ( pugi::xml_node item = node.first_child(); item; item = item.next_sibling() ) {
@@ -573,6 +575,8 @@ void UIMenu::loadFromXmlNode( const pugi::xml_node& node ) {
addSubMenu( UIManager::instance()->getTranslatorString( text ), getIconDrawable( icon ), subMenu );
}
}
endPropertiesTransaction();
}
void UIMenu::fixMenuPos( Vector2i& Pos, UIMenu * Menu, UIMenu * Parent, UIMenuSubMenu * SubMenu ) {

View File

@@ -207,6 +207,8 @@ UITextView * UIProgressBar::getTextBox() const {
}
void UIProgressBar::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -234,6 +236,8 @@ void UIProgressBar::loadFromXmlNode(const pugi::xml_node & node) {
setFillerPadding( Rectf( mStyleConfig.FillerPadding.Left, mStyleConfig.FillerPadding.Top, mStyleConfig.FillerPadding.Right, PixelDensity::toDpFromString( ait->as_string() ) ) );
}
}
endPropertiesTransaction();
}
void UIProgressBar::onAlphaChange() {

View File

@@ -338,6 +338,8 @@ void UIPushButton::setStyleConfig(const UIPushButtonStyleConfig & styleConfig) {
}
void UIPushButton::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
mTextBox->loadFromXmlNode( node );
@@ -362,6 +364,8 @@ void UIPushButton::loadFromXmlNode(const pugi::xml_node & node) {
}
}
}
endPropertiesTransaction();
}
}}

View File

@@ -227,6 +227,8 @@ void UIRadioButton::setTextSeparation(const Int32 & textSeparation) {
}
void UIRadioButton::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -237,6 +239,8 @@ void UIRadioButton::loadFromXmlNode(const pugi::xml_node & node) {
setActive( ait->as_bool() );
}
}
endPropertiesTransaction();
}
Uint32 UIRadioButton::onKeyDown( const UIEventKey& Event ) {

View File

@@ -7,7 +7,7 @@ UIRelativeLayout * UIRelativeLayout::New() {
}
UIRelativeLayout::UIRelativeLayout() :
UIWidget()
UILayout()
{
}

View File

@@ -270,9 +270,13 @@ void UIScrollBar::setExpandBackground( bool expandBackground ) {
}
void UIScrollBar::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
mSlider->loadFromXmlNode( node );
endPropertiesTransaction();
}
UIScrollBar::ScrollBarType UIScrollBar::getScrollBarType() const {

View File

@@ -216,6 +216,8 @@ bool UIScrollView::isTouchOverAllowedChilds() {
}
void UIScrollView::loadFromXmlNode( const pugi::xml_node& node ) {
beginPropertiesTransaction();
UITouchDragableWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -255,6 +257,8 @@ void UIScrollView::loadFromXmlNode( const pugi::xml_node& node ) {
}
}
}
endPropertiesTransaction();
}
}}

View File

@@ -88,6 +88,8 @@ const Color &UISelectButton::getFontSelectedColor() const {
}
void UISelectButton::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIPushButton::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -98,6 +100,8 @@ void UISelectButton::loadFromXmlNode(const pugi::xml_node & node) {
setFontSelectedColor( Color::fromString( ait->as_string() ) );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -403,6 +403,8 @@ void UISlider::onAlphaChange() {
}
void UISlider::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -429,6 +431,8 @@ void UISlider::loadFromXmlNode(const pugi::xml_node & node) {
setPageStep( ait->as_float() );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -265,6 +265,8 @@ void UISpinBox::onAlphaChange() {
}
void UISpinBox::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
mInput->loadFromXmlNode( node );
@@ -283,6 +285,8 @@ void UISpinBox::loadFromXmlNode(const pugi::xml_node & node) {
setClickStep( ait->as_float() );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -168,6 +168,8 @@ void UISprite::onSizeChange() {
}
void UISprite::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -183,6 +185,8 @@ void UISprite::loadFromXmlNode(const pugi::xml_node & node) {
}
}
}
endPropertiesTransaction();
}
}}

View File

@@ -184,6 +184,8 @@ const Vector2i& UISubTexture::getAlignOffset() const {
}
void UISubTexture::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -209,6 +211,8 @@ void UISubTexture::loadFromXmlNode(const pugi::xml_node & node) {
}
}
}
endPropertiesTransaction();
}
Uint32 UISubTexture::getScaleType() const {

View File

@@ -176,6 +176,8 @@ void UITab::update() {
}
void UITab::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UISelectButton::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -187,6 +189,8 @@ void UITab::loadFromXmlNode(const pugi::xml_node & node) {
setOwnedControl();
}
}
endPropertiesTransaction();
}
void UITab::setOwnedControl() {

View File

@@ -618,6 +618,8 @@ bool UITable::isTouchOverAllowedChilds() {
}
void UITable::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UITouchDragableWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -660,6 +662,8 @@ void UITable::loadFromXmlNode(const pugi::xml_node & node) {
}
}
}
endPropertiesTransaction();
}
}}

View File

@@ -183,6 +183,8 @@ void UITabWidget::setStyleConfig(const UITabWidgetStyleConfig & styleConfig) {
}
void UITabWidget::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -251,6 +253,8 @@ void UITabWidget::loadFromXmlNode(const pugi::xml_node & node) {
setLineBelowTabsYOffset( ait->as_int() );
}
}
endPropertiesTransaction();
}
Font * UITabWidget::getFont() const {

View File

@@ -437,6 +437,8 @@ void UITextEdit::setFontStyleConfig(const UIFontStyleConfig & fontStyleConfig) {
}
void UITextEdit::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
mTextInput->loadFromXmlNode( node );
@@ -461,6 +463,8 @@ void UITextEdit::loadFromXmlNode(const pugi::xml_node & node) {
else if ( "off" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_OFF );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -328,6 +328,8 @@ bool UITextInput::isFreeEditingEnabled() {
}
void UITextInput::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UITextView::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -348,6 +350,8 @@ void UITextInput::loadFromXmlNode(const pugi::xml_node & node) {
getInputTextBuffer()->setAllowOnlyNumbers( getInputTextBuffer()->onlyNumbersAllowed(), ait->as_bool() );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -493,6 +493,8 @@ void UITextView::onPaddingChange() {
}
void UITextView::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -564,6 +566,8 @@ void UITextView::loadFromXmlNode(const pugi::xml_node & node) {
setPadding( Rect( mPadding.Left, mPadding.Top, mPadding.Right, PixelDensity::toDpFromStringI( ait->as_string() ) ) );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -137,6 +137,8 @@ bool UITouchDragableWidget::isTouchOverAllowedChilds() {
}
void UITouchDragableWidget::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -149,6 +151,8 @@ void UITouchDragableWidget::loadFromXmlNode(const pugi::xml_node & node) {
setTouchDragDeceleration( Vector2f( ait->as_float(), ait->as_float() ) );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -19,7 +19,8 @@ UIWidget::UIWidget() :
mLayoutWidthRules(WRAP_CONTENT),
mLayoutHeightRules(WRAP_CONTENT),
mLayoutPositionRule(NONE),
mLayoutPositionRuleWidget(NULL)
mLayoutPositionRuleWidget(NULL),
mPropertiesTransactionCount(0)
{
mControlFlags |= UI_CTRL_FLAG_WIDGET;
@@ -286,12 +287,14 @@ void UIWidget::onWidgetCreated() {
}
void UIWidget::notifyLayoutAttrChange() {
UIMessage msg( this, UIMessage::MsgLayoutAttributeChange );
messagePost( &msg );
if ( 0 == mPropertiesTransactionCount ) {
UIMessage msg( this, UIMessage::MsgLayoutAttributeChange );
messagePost( &msg );
}
}
void UIWidget::notifyLayoutAttrChangeParent() {
if ( NULL != mParentCtrl ) {
if ( 0 == mPropertiesTransactionCount && NULL != mParentCtrl ) {
UIMessage msg( this, UIMessage::MsgLayoutAttributeChange );
mParentCtrl->messagePost( &msg );
}
@@ -363,7 +366,21 @@ void UIWidget::alignAgainstLayout() {
setInternalPosition( pos );
}
void UIWidget::beginPropertiesTransaction() {
mPropertiesTransactionCount++;
}
void UIWidget::endPropertiesTransaction() {
mPropertiesTransactionCount--;
if ( 0 == mPropertiesTransactionCount ) {
notifyLayoutAttrChange();
}
}
void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) {
beginPropertiesTransaction();
std::string skinName;
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -561,6 +578,8 @@ void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) {
unsetFlags( UI_CLIP_ENABLE );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -565,7 +565,7 @@ Uint32 UIWindow::onMessage( const UIMessage * Msg ) {
toFront();
break;
}
case UIMessage::MsgDragEnd:
case UIMessage::MsgDragStop:
{
UIManager::instance()->setCursor( EE_CURSOR_ARROW );
break;
@@ -1201,6 +1201,8 @@ void UIWindow::resizeCursor() {
}
void UIWindow::loadFromXmlNode(const pugi::xml_node & node) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
@@ -1246,6 +1248,8 @@ void UIWindow::loadFromXmlNode(const pugi::xml_node & node) {
}
}
endPropertiesTransaction();
show();
}

View File

@@ -293,6 +293,8 @@ void UIWinMenu::destroyMenues() {
}
void UIWinMenu::loadFromXmlNode( const pugi::xml_node& node ) {
beginPropertiesTransaction();
UIWidget::loadFromXmlNode( node );
for ( pugi::xml_node item = node.first_child(); item; item = item.next_sibling() ) {
@@ -309,6 +311,8 @@ void UIWinMenu::loadFromXmlNode( const pugi::xml_node& node ) {
addMenuButton( UIManager::instance()->getTranslatorString( text ), subMenu );
}
}
endPropertiesTransaction();
}
}}

View File

@@ -67,8 +67,8 @@ EE_MAIN_FUNC int main (int argc, char * argv []) {
text.setFillColor( Color(255*i/size,0,0,255), i, i+1 );
}
fontTest2 = FontTrueType::New( "Arial" );
fontTest2->loadFromFile( AppPath + "assets/fonts/arial.ttf" );
fontTest2 = FontTrueType::New( "NotoSans-Regular" );
fontTest2->loadFromFile( AppPath + "assets/fonts/NotoSans-Regular.ttf" );
text2.setFont( fontTest2 );
text2.setString( "Lorem ipsum dolor sit amet, consectetur adipisicing elit." );

View File

@@ -187,14 +187,14 @@ void EETest::createUIThemeTextureAtlas() {
void EETest::loadFonts() {
mFTE.restart();
mFontLoader.add( eeNew( FontTrueTypeLoader, ( "arial", MyPath + "fonts/arial.ttf" ) ) );
mFontLoader.add( eeNew( FontTrueTypeLoader, ( "NotoSans-Regular", MyPath + "fonts/NotoSans-Regular.ttf" ) ) );
mFontLoader.add( eeNew( FontTrueTypeLoader, ( "DejaVuSansMono", MyPath + "fonts/DejaVuSansMono.ttf" ) ) );
mFontLoader.load( cb::Make1( this, &EETest::onFontLoaded ) );
}
void EETest::onFontLoaded( ResourceLoader * ObjLoaded ) {
TTF = FontManager::instance()->getByName( "arial" );
TTF = FontManager::instance()->getByName( "NotoSans-Regular" );
Font * DBSM = FontManager::instance()->getByName( "DejaVuSansMono" );
eePRINTL( "Fonts loading time: %4.3f ms.", mFTE.getElapsed().asMilliseconds() );
@@ -834,13 +834,27 @@ void EETest::createCommonDialog() {
CDialog->show();
}
static void onWinDragStart( const UIEvent * event ) {
UIControl * ctrl = static_cast<UIControl*>( event->getControl() );
UIWindow * window = ctrl->isType(UI_TYPE_WINDOW) ? static_cast<UIWindow*>( ctrl ) : static_cast<UIWindow*>( ctrl->getWindowContainer()->getParent() );
window->startAlphaAnim( window->getAlpha(), 100, Seconds(0.2f) );
}
static void onWinDragStop( const UIEvent * event ) {
UIControl * ctrl = static_cast<UIControl*>( event->getControl() );
UIWindow * window = ctrl->isType(UI_TYPE_WINDOW) ? static_cast<UIWindow*>( ctrl ) : static_cast<UIWindow*>( ctrl->getWindowContainer()->getParent() );
window->startAlphaAnim( window->getAlpha(), 255, Seconds(0.2f) );
}
void EETest::createDecoratedWindow() {
mUIWindow = UIWindow::New();
mUIWindow->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_SHADOW )
mUIWindow->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_SHADOW | UI_WIN_FRAME_BUFFER )
->setMinWindowSize( 530, 350 )->setPosition( 200, 50 );
mUIWindow->addEventListener( UIEvent::EventOnWindowCloseClick, cb::Make1( this, &EETest::onCloseClick ) );
mUIWindow->setTitle( "Test Window" );
mUIWindow->addEventListener( UIEvent::EventOnDragStart, cb::Make1( &onWinDragStart ) );
mUIWindow->addEventListener( UIEvent::EventOnDragStop, cb::Make1( &onWinDragStop ) );
UILinearLayout * lay = UILinearLayout::NewVertical();
lay->setLayoutSizeRules( MATCH_PARENT, MATCH_PARENT );