26 mWidgetCaption(nullptr),
27 mMouseRootFocus(false),
31 mAnimateSmooth(false),
38 Base::initialiseOverride();
45 (std::numeric_limits<int>::min)(),
46 (std::numeric_limits<int>::min)(),
47 (std::numeric_limits<int>::max)(),
48 (std::numeric_limits<int>::max)());
50 bool main_move =
false;
70 if (mWidgetCaption !=
nullptr)
79 for (VectorWidgetPtr::iterator iter = buttons.begin(); iter != buttons.end(); ++iter)
85 for (VectorWidgetPtr::iterator iter = actions.begin(); iter != actions.end(); ++iter)
93 const size_t countNames = 8;
94 const char* resizers[2][countNames] =
96 {
"ResizeLeftTop",
"ResizeTop",
"ResizeRightTop",
"ResizeRight",
"ResizeRightBottom",
"ResizeBottom",
"ResizeLeftBottom",
"ResizeLeft"},
97 {
"Left Top",
"Top",
"Right Top",
"Right",
"Right Bottom",
"Bottom",
"Left Bottom",
"Left"}
100 for (
size_t index = 0; index < countNames; ++ index)
104 if (widget !=
nullptr)
117 mWidgetCaption =
nullptr;
119 Base::shutdownOverride();
124 mMouseRootFocus = _focus;
127 Base::onMouseChangeRootFocus(_focus);
132 mKeyRootFocus = _focus;
135 Base::onKeyChangeRootFocus(_focus);
143 Base::onMouseDrag(_left, _top, _id);
150 Base::onMouseButtonPressed(_left, _top, _id);
157 Base::onMouseButtonReleased(_left, _top, _id);
165 mCurrentActionScale = _getActionScale(_sender);
181 IntCoord coord = mCurrentActionScale;
183 coord.
top *= (_top - point.
top);
190 if (coord.
left == 0 && coord.
top == 0)
191 setSize((mPreActionCoord + coord).size());
209 else if (mMouseRootFocus)
220 mIsAutoAlpha = _auto;
227 else if (mMouseRootFocus)
241 getSnappedCoord(coord, Snap::Position);
242 point = coord.
point();
245 Base::setPosition(point);
267 getSnappedCoord(coord, Snap::Size);
320 getSnappedCoord(coord, Snap::Size);
326 Base::setCoord(coord);
331 if (mWidgetCaption !=
nullptr)
334 Base::setCaption(_caption);
339 if (mWidgetCaption !=
nullptr)
341 return Base::getCaption();
356 mAnimateSmooth =
false;
367 mAnimateSmooth =
false;
370 Base::setVisible(_visible);
373 float Window::getAlphaVisible()
const
378 void Window::getSnappedCoord(
IntCoord& _coord, Snap snapMode)
const
384 bool nearBottomSide = abs(_coord.top + _coord.height - view_size.height) <=
WINDOW_SNAP_DISTANSE;
395 _coord.left = view_size.width - _coord.width;
397 _coord.top = view_size.height - _coord.height;
402 _coord.width = _coord.right();
407 _coord.height = _coord.bottom();
412 _coord.width = view_size.width - _coord.left;
414 _coord.height = view_size.height - _coord.top;
421 mAnimateSmooth =
true;
430 Base::setVisible(
true);
445 ControllerFadeAlpha* Window::createControllerFadeAlpha(
float _alpha,
float _coef,
bool _enable)
482 if (_key ==
"AutoAlpha")
486 else if (_key ==
"Snap")
487 setSnap(utility::parseValue<bool>(_value));
490 else if (_key ==
"MinSize")
491 setMinSize(utility::parseValue<IntSize>(_value));
494 else if (_key ==
"MaxSize")
495 setMaxSize(utility::parseValue<IntSize>(_value));
498 else if (_key ==
"Movable")
499 setMovable(utility::parseValue<bool>(_value));
503 Base::setPropertyOverride(_key, _value);
512 return mCurrentActionScale;
522 return mWidgetCaption;
549 mCurrentActionScale.
clear();
559 if (result ==
IntCoord(1, 1, 0, 0) && !mMovable)
566 const std::string& action = _widget->
getUserString(
"Action");
567 if (action ==
"Move")
583 else if (align.isRight())
593 else if (align.isBottom())
static const std::string & getClassTypeName()
void setAlpha(float _value)
void setCoef(float _value)
void setEnabled(bool _value)
EventPairAddParameter< EventHandle_WidgetPtr, EventHandle_WidgetPtrControllerItemPtr > eventPostAction
ControllerItem * createItem(const std::string &_type)
static ControllerManager & getInstance()
void removeItem(Widget *_widget)
void addItem(Widget *_widget, ControllerItem *_item)
Type * castType(bool _throw=true)
widget description should be here.
virtual const UString & getCaption() const
virtual void setCaption(const UString &_value)
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
bool isUserString(const std::string &_key) const
const std::string & getUserString(const std::string &_key) const
void setUserString(const std::string &_key, const std::string &_value)
void onKeyChangeRootFocus(bool _focus) override
void setMovable(bool _value)
void setVisibleSmooth(bool _value)
void setSnap(bool _value)
EventPair< EventHandle_WidgetVoid, EventHandle_WindowPtr > eventWindowChangeCoord
void onMouseButtonReleased(int _left, int _top, MouseButton _id) override
IntSize getMaxSize() const
void setMinSize(const IntSize &_value)
void notifyMousePressed(MyGUI::Widget *_sender, int _left, int _top, MouseButton _id)
const UString & getCaption() const override
void setPosition(const IntPoint &_value) override
void animateStop(Widget *_widget, ControllerItem *_controller)
void notifyPressedButtonEvent(MyGUI::Widget *_sender)
void onMouseButtonPressed(int _left, int _top, MouseButton _id) override
const IntCoord & getActionScale() const
void setCaption(const UString &_value) override
void setMaxSize(const IntSize &_value)
void onMouseChangeRootFocus(bool _focus) override
void notifyMouseReleased(MyGUI::Widget *_sender, int _left, int _top, MouseButton _id)
TextBox * getCaptionWidget() const
void notifyMouseDrag(MyGUI::Widget *_sender, int _left, int _top, MouseButton _id)
void setCoord(const IntCoord &_value) override
void notifyMouseWheel(MyGUI::Widget *_sender, int _rel)
void setVisible(bool _value) override
void onMouseDrag(int _left, int _top, MouseButton _id) override
void shutdownOverride() override
EventPair< EventHandle_WidgetString, EventHandle_WindowPtrCStringRef > eventWindowButtonPressed
void initialiseOverride() override
void setPropertyOverride(const std::string &_key, const std::string &_value) override
void setAutoAlpha(bool _value)
IntSize getMinSize() const
bool getAutoAlpha() const
void setSize(const IntSize &_value) override
void actionWidgetDestroy(Widget *_widget, ControllerItem *_controller)
void actionWidgetHide(Widget *_widget, ControllerItem *_controller)
const float WINDOW_ALPHA_FOCUS
const float WINDOW_SPEED_COEF
const float WINDOW_ALPHA_ACTIVE
const float WINDOW_ALPHA_DEACTIVE
types::TCoord< int > IntCoord
std::vector< Widget * > VectorWidgetPtr
const int WINDOW_SNAP_DISTANSE
types::TSize< int > IntSize
delegates::DelegateFunction< Args... > * newDelegate(void(*_func)(Args... args))
static Align parse(const std::string &_value)
TPoint< T > point() const
static TCoord< int > parse(const std::string &_value)
void set(T const &_left, T const &_top, T const &_right, T const &_bottom)