void ScrollView::initialiseOverride() { Base::initialiseOverride(); // FIXME нам нужен фокус клавы setNeedKeyFocus(true); assignWidget(mClient, "Client"); if (mClient != nullptr) { mClient->eventMouseWheel += newDelegate(this, &ScrollView::notifyMouseWheel); // создаем холcт, реальный владелец детей mRealClient = mClient->createWidget<Widget>("Default", IntCoord(), Align::Default); mRealClient->eventMouseWheel += newDelegate(this, &ScrollView::notifyMouseWheel); setWidgetClient(mRealClient); } assignWidget(mVScroll, "VScroll"); if (mVScroll != nullptr) { mVScroll->eventScrollChangePosition += newDelegate(this, &ScrollView::notifyScrollChangePosition); } assignWidget(mHScroll, "HScroll"); if (mHScroll != nullptr) { mHScroll->eventScrollChangePosition += newDelegate(this, &ScrollView::notifyScrollChangePosition); } updateView(); }
void MenuControl::initialiseOverride() { Base::initialiseOverride(); // инициализируем овнера Widget* parent = getParent(); if (parent) { mOwner = parent->castType<MenuItem>(false); if (!mOwner) { Widget* client = parent; parent = client->getParent(); if (parent && parent->getClientWidget()) { mOwner = parent->castType<MenuItem>(false); } } } // FIXME нам нужен фокус клавы setNeedKeyFocus(true); ///@wskin_child{MenuControl, Widget, Client} Клиентская зона. assignWidget(mClient, "Client"); if (mClient != nullptr) { setWidgetClient(mClient); } //OBSOLETE if (isUserString("SkinLine")) { mItemNormalSkin = getUserString("SkinLine"); mItemPopupSkin = mItemNormalSkin; } if (isUserString("SeparatorSkin")) mItemSeparatorSkin = getUserString("SeparatorSkin"); if (isUserString("NormalSkin")) mItemNormalSkin = getUserString("NormalSkin"); if (isUserString("PopupSkin")) mItemPopupSkin = getUserString("PopupSkin"); if (isUserString("DistanceButton")) mDistanceButton = utility::parseValue<int>(getUserString("DistanceButton")); if (isUserString("SubMenuSkin")) mSubMenuSkin = getUserString("SubMenuSkin"); if (isUserString("SubMenuLayer")) mSubMenuLayer = getUserString("SubMenuLayer"); // FIXME добавленно, так как шетдаун вызывается и при смене скина mShutdown = false; }
void MultiListBox::initialiseOverride() { Base::initialiseOverride(); std::string skinButtonEmpty; if (isUserString("SkinButton")) mSkinButton = getUserString("SkinButton"); if (isUserString("SkinList")) mSkinList = getUserString("SkinList"); if (isUserString("SkinSeparator")) mSkinSeparator = getUserString("SkinSeparator"); if (isUserString("WidthSeparator")) mWidthSeparator = utility::parseValue<int>(getUserString("WidthSeparator")); // OBSOLETE if (isUserString("HeightButton")) mHeightButton = utility::parseValue<int>(getUserString("HeightButton")); if (mHeightButton < 0) mHeightButton = 0; ///@wskin_child{MultiListBox, Widget, HeaderPlace} Место для заголовков колонок. assignWidget(mHeaderPlace, "HeaderPlace"); ///@wskin_child{MultiListBox, Widget, Client} Клиентская зона. assignWidget(mClient, "Client"); if (mClient != nullptr) setWidgetClient(mClient); if (nullptr == mClient) mClient = this; ///@wskin_child{MultiListBox, Widget, Empty} Виджет для заголовка в месте где нет списков. assignWidget(mWidgetEmpty, "Empty"); if (mWidgetEmpty == nullptr) { if (isUserString("SkinButtonEmpty")) skinButtonEmpty = getUserString("SkinButtonEmpty"); if (!skinButtonEmpty.empty()) mWidgetEmpty = mClient->createWidget<Widget>(skinButtonEmpty, IntCoord(0, 0, mClient->getWidth(), getButtonHeight()), Align::Default); } if (getUpdateByResize()) updateColumns(); }
void ItemBox::initialiseOverride() { Base::initialiseOverride(); // FIXME нам нужен фокус клавы setNeedKeyFocus(true); mDragLayer = "DragAndDrop"; if (isUserString("DragLayer")) mDragLayer = getUserString("DragLayer"); ///@wskin_child{ItemBox, Widget, Client} Клиентская зона. assignWidget(mClient, "Client"); if (mClient != nullptr) { mClient->eventMouseWheel += newDelegate(this, &ItemBox::notifyMouseWheel); mClient->eventMouseButtonPressed += newDelegate(this, &ItemBox::notifyMouseButtonPressed); mClient->eventMouseButtonReleased += newDelegate(this, &ItemBox::notifyMouseButtonReleased); setWidgetClient(mClient); } ///@wskin_child{ItemBox, ScrollBar, VScroll} Вертикальная полоса прокрутки. assignWidget(mVScroll, "VScroll"); if (mVScroll != nullptr) { mVScroll->eventScrollChangePosition += newDelegate(this, &ItemBox::notifyScrollChangePosition); } ///@wskin_child{ItemBox, ScrollBar, HScroll} Горизонтальная полоса прокрутки. assignWidget(mHScroll, "HScroll"); if (mHScroll != nullptr) { mHScroll->eventScrollChangePosition += newDelegate(this, &ItemBox::notifyScrollChangePosition); } // подписываем клиент для драгэндропа if (mClient != nullptr) mClient->_setContainer(this); requestItemSize(); updateScrollSize(); updateScrollPosition(); }
void MultiListBox::initialiseOverride() { Base::initialiseOverride(); std::string skinButtonEmpty; if (isUserString("SkinButton")) mSkinButton = getUserString("SkinButton"); if (isUserString("SkinList")) mSkinList = getUserString("SkinList"); if (isUserString("SkinSeparator")) mSkinSeparator = getUserString("SkinSeparator"); if (isUserString("WidthSeparator")) mWidthSeparator = utility::parseValue<int>(getUserString("WidthSeparator")); // OBSOLETE if (isUserString("HeightButton")) mHeightButton = utility::parseValue<int>(getUserString("HeightButton")); if (mHeightButton < 0) mHeightButton = 0; assignWidget(mHeaderPlace, "HeaderPlace"); assignWidget(mClient, "Client"); if (mClient != nullptr) setWidgetClient(mClient); if (nullptr == mClient) mClient = this; assignWidget(mWidgetEmpty, "Empty"); if (mWidgetEmpty == nullptr) { if (isUserString("SkinButtonEmpty")) skinButtonEmpty = getUserString("SkinButtonEmpty"); if (!skinButtonEmpty.empty()) mWidgetEmpty = mClient->createWidget<Widget>(skinButtonEmpty, IntCoord(0, 0, mClient->getWidth(), getButtonHeight()), Align::Default); } if (getUpdateByResize()) updateColumns(); }
void ScrollView::initialiseOverride() { Base::initialiseOverride(); // FIXME нам нужен фокус клавы setNeedKeyFocus(true); ///@wskin_child{ScrollView, Widget, Client} Клиентская зона. assignWidget(mClient, "Client"); MyGUI::Widget* realClientOwner = this; if (mClient != nullptr) { mClient->eventMouseWheel += newDelegate(this, &ScrollView::notifyMouseWheel); realClientOwner = mClient; } // создаем холcт, реальный владелец детей mRealClient = realClientOwner->createWidget<Widget>("Default", IntCoord(), Align::Default); mRealClient->eventMouseWheel += newDelegate(this, &ScrollView::notifyMouseWheel); setWidgetClient(mRealClient); ///@wskin_child{ScrollView, ScrollBar, VScroll} Вертикальная полоса прокрутки. assignWidget(mVScroll, "VScroll"); if (mVScroll != nullptr) { mVScroll->eventScrollChangePosition += newDelegate(this, &ScrollView::notifyScrollChangePosition); } ///@wskin_child{ScrollView, ScrollBar, HScroll} Горизонтальная полоса прокрутки. assignWidget(mHScroll, "HScroll"); if (mHScroll != nullptr) { mHScroll->eventScrollChangePosition += newDelegate(this, &ScrollView::notifyScrollChangePosition); } updateView(); }
void ListCtrl::initialiseOverride() { Base::initialiseOverride(); // FIXME нам нужен фокус клавы setNeedKeyFocus(true); mDragLayer = "DragAndDrop"; if (isUserString("DragLayer")) mDragLayer = getUserString("DragLayer"); assignWidget(mClient, "Client"); if (mClient != nullptr) { mClient->eventMouseWheel += newDelegate(this, &ListCtrl::notifyMouseWheel); mClient->eventMouseButtonPressed += newDelegate(this, &ListCtrl::notifyMouseButtonPressed); setWidgetClient(mClient); } assignWidget(mVScroll, "VScroll"); if (mVScroll != nullptr) { mVScroll->eventScrollChangePosition += newDelegate(this, &ListCtrl::notifyScrollChangePosition); } assignWidget(mHScroll, "HScroll"); if (mHScroll != nullptr) { mHScroll->eventScrollChangePosition += newDelegate(this, &ListCtrl::notifyScrollChangePosition); } // подписываем клиент для драгэндропа _getClientWidget()->_setContainer(this); updateFromResize(); }
void ListBox::initialiseOverride() { Base::initialiseOverride(); // FIXME нам нужен фокус клавы setNeedKeyFocus(true); // парсим свойства if (isUserString("SkinLine")) mSkinLine = getUserString("SkinLine"); if (isUserString("HeightLine")) mHeightLine = utility::parseInt(getUserString("HeightLine")); if (mHeightLine < 1) mHeightLine = 1; assignWidget(mClient, "Client"); if (mClient != nullptr) { mClient->eventMouseButtonPressed += newDelegate(this, &ListBox::notifyMousePressed); setWidgetClient(mClient); } assignWidget(mWidgetScroll, "VScroll"); if (mWidgetScroll != nullptr) { mWidgetScroll->eventScrollChangePosition += newDelegate(this, &ListBox::notifyScrollChangePosition); mWidgetScroll->eventMouseButtonPressed += newDelegate(this, &ListBox::notifyMousePressed); mWidgetScroll->setScrollPage((size_t)mHeightLine); mWidgetScroll->setScrollViewPage((size_t)mHeightLine); } updateScroll(); updateLine(); }
void Window::initialiseOverride() { Base::initialiseOverride(); // FIXME нам нужен фокус клавы setNeedKeyFocus(true); // дефолтные размеры mMinmax.set( (std::numeric_limits<int>::min)(), (std::numeric_limits<int>::min)(), (std::numeric_limits<int>::max)(), (std::numeric_limits<int>::max)()); bool main_move = false; if (isUserString("MainMove")) { setUserString("Scale", "1 1 0 0"); main_move = true; } ///@wskin_child{Window, Widget, Client} Клиентская зона. assignWidget(mClient, "Client"); if (mClient != nullptr) { if (main_move) { mClient->setUserString("Scale", "1 1 0 0"); mClient->eventMouseButtonPressed += newDelegate(this, &Window::notifyMousePressed); mClient->eventMouseButtonReleased += newDelegate(this, &Window::notifyMouseReleased); mClient->eventMouseDrag += newDelegate(this, &Window::notifyMouseDrag); } setWidgetClient(mClient); } ///@wskin_child{Window, TextBox, Caption} Caption for window. assignWidget(mWidgetCaption, "Caption"); if (mWidgetCaption != nullptr) { mWidgetCaption->setUserString("Scale", "1 1 0 0"); mWidgetCaption->eventMouseButtonPressed += newDelegate(this, &Window::notifyMousePressed); mWidgetCaption->eventMouseButtonReleased += newDelegate(this, &Window::notifyMouseReleased); mWidgetCaption->eventMouseDrag += newDelegate(this, &Window::notifyMouseDrag); } VectorWidgetPtr buttons = getSkinWidgetsByName("Button"); for (VectorWidgetPtr::iterator iter = buttons.begin(); iter != buttons.end(); ++iter) { (*iter)->eventMouseButtonClick += newDelegate(this, &Window::notifyPressedButtonEvent); } VectorWidgetPtr actions = getSkinWidgetsByName("Action"); for (VectorWidgetPtr::iterator iter = actions.begin(); iter != actions.end(); ++iter) { (*iter)->eventMouseButtonPressed += newDelegate(this, &Window::notifyMousePressed); (*iter)->eventMouseButtonReleased += newDelegate(this, &Window::notifyMouseReleased); (*iter)->eventMouseDrag += newDelegate(this, &Window::notifyMouseDrag); (*iter)->eventMouseWheel += newDelegate(this, &Window::notifyMouseWheel); } const size_t countNames = 8; const char* resizers[2][countNames] = { {"ResizeLeftTop", "ResizeTop", "ResizeRightTop", "ResizeRight", "ResizeRightBottom", "ResizeBottom", "ResizeLeftBottom", "ResizeLeft"}, {"Left Top", "Top", "Right Top", "Right", "Right Bottom", "Bottom", "Left Bottom", "Left"} }; for (size_t index = 0; index < countNames; ++ index) { Widget* widget = nullptr; assignWidget(widget, resizers[0][index]); if (widget != nullptr) { widget->eventMouseButtonPressed += newDelegate(this, &Window::notifyMousePressed); widget->eventMouseButtonReleased += newDelegate(this, &Window::notifyMouseReleased); widget->eventMouseDrag += newDelegate(this, &Window::notifyMouseDrag); widget->eventMouseWheel += newDelegate(this, &Window::notifyMouseWheel); widget->setUserString("Action", resizers[1][index]); } } }