Пример #1
0
	void VScroll::initialiseOverride()
	{
		Base::initialiseOverride();

		// при нуле, будет игнорировать кнопки
		mScrollPage = 1;
		mScrollViewPage = 1;
		mMinTrackSize = 0;
		mSkinRangeStart = 0;
		mSkinRangeEnd = 0;

		assignWidget(mWidgetStart, "Start");
		if (mWidgetStart != nullptr)
		{
			mWidgetStart->eventMouseButtonPressed += newDelegate(this, &VScroll::notifyMousePressed);
			mWidgetStart->eventMouseWheel += newDelegate(this, &VScroll::notifyMouseWheel);
		}

		assignWidget(mWidgetEnd, "End");
		if (mWidgetEnd != nullptr)
		{
			mWidgetEnd->eventMouseButtonPressed += newDelegate(this, &VScroll::notifyMousePressed);
			mWidgetEnd->eventMouseWheel += newDelegate(this, &VScroll::notifyMouseWheel);
		}

		assignWidget(mWidgetTrack, "Track");
		if (mWidgetTrack)
		{
			mWidgetTrack->eventMouseDrag += newDelegate(this, &VScroll::notifyMouseDrag);
			mWidgetTrack->eventMouseButtonPressed += newDelegate(this, &VScroll::notifyMousePressed);
			mWidgetTrack->eventMouseButtonReleased += newDelegate(this, &VScroll::notifyMouseReleased);
			mWidgetTrack->eventMouseWheel += newDelegate(this, &VScroll::notifyMouseWheel);
			mWidgetTrack->setVisible(false);
		}

		assignWidget(mWidgetFirstPart, "FirstPart");
		if (mWidgetFirstPart != nullptr)
		{
			mWidgetFirstPart->eventMouseButtonPressed += newDelegate(this, &VScroll::notifyMousePressed);
			mWidgetFirstPart->eventMouseWheel += newDelegate(this, &VScroll::notifyMouseWheel);
		}

		assignWidget(mWidgetSecondPart, "SecondPart");
		if (mWidgetSecondPart != nullptr)
		{
			mWidgetSecondPart->eventMouseButtonPressed += newDelegate(this, &VScroll::notifyMousePressed);
			mWidgetSecondPart->eventMouseWheel += newDelegate(this, &VScroll::notifyMouseWheel);
		}

		if (isUserString("MinTrackSize"))
			mMinTrackSize = utility::parseValue<int>(getUserString("MinTrackSize"));
		if (isUserString("TrackRangeMargins"))
			utility::parseComplex<size_t>(getUserString("TrackRangeMargins"), mSkinRangeStart, mSkinRangeEnd);
	}
	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;
	}
Пример #3
0
    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();
    }
Пример #4
0
	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();
	}
Пример #5
0
	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();
	}
Пример #6
0
	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();
	}
Пример #7
0
    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();
    }
Пример #8
0
	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]);
			}
		}
	}
Пример #9
0
	void ScrollBar::initialiseOverride()
	{
		Base::initialiseOverride();

		// при нуле, будет игнорировать кнопки
		mScrollPage = 1;
		mScrollViewPage = 1;
		mScrollWheelPage = 1;
		mMinTrackSize = 0;
		mSkinRangeStart = 0;
		mSkinRangeEnd = 0;

		mRepeatTriggerTime = 0.5f;
		mRepeatStepTime = 0.1f;

		///@wskin_child{ScrollBar, Button, Start} Кнопка начала диапазона.
		assignWidget(mWidgetStart, "Start");
		if (mWidgetStart != nullptr)
		{
			mWidgetStart->eventMouseButtonPressed += newDelegate(this, &ScrollBar::notifyMousePressed);
			mWidgetStart->eventMouseButtonReleased += newDelegate(this, &ScrollBar::notifyMouseReleased);
			mWidgetStart->eventMouseWheel += newDelegate(this, &ScrollBar::notifyMouseWheel);
		}

		///@wskin_child{ScrollBar, Button, End} Кнопка конца диапазона.
		assignWidget(mWidgetEnd, "End");
		if (mWidgetEnd != nullptr)
		{
			mWidgetEnd->eventMouseButtonPressed += newDelegate(this, &ScrollBar::notifyMousePressed);
			mWidgetEnd->eventMouseButtonReleased += newDelegate(this, &ScrollBar::notifyMouseReleased);
			mWidgetEnd->eventMouseWheel += newDelegate(this, &ScrollBar::notifyMouseWheel);
		}

		///@wskin_child{ScrollBar, Button, Track} Кнопка трекера.
		assignWidget(mWidgetTrack, "Track");
		if (mWidgetTrack)
		{
			mWidgetTrack->eventMouseDrag += newDelegate(this, &ScrollBar::notifyMouseDrag);
			mWidgetTrack->eventMouseButtonPressed += newDelegate(this, &ScrollBar::notifyMousePressed);
			mWidgetTrack->eventMouseButtonReleased += newDelegate(this, &ScrollBar::notifyMouseReleased);
			mWidgetTrack->eventMouseWheel += newDelegate(this, &ScrollBar::notifyMouseWheel);
			mWidgetTrack->setVisible(false);
		}

		///@wskin_child{ScrollBar, Widget, FirstPart} Виджет первой половины прокрутки от начала до трекера, при нажатии восприницмается как прокрутка страницы.
		assignWidget(mWidgetFirstPart, "FirstPart");
		if (mWidgetFirstPart != nullptr)
		{
			mWidgetFirstPart->eventMouseButtonPressed += newDelegate(this, &ScrollBar::notifyMousePressed);
			mWidgetFirstPart->eventMouseButtonReleased += newDelegate(this, &ScrollBar::notifyMouseReleased);
			mWidgetFirstPart->eventMouseWheel += newDelegate(this, &ScrollBar::notifyMouseWheel);
		}

		///@wskin_child{ScrollBar, Widget, SecondPart} Виджет второй половины прокрутки от трекера до конца, при нажатии восприницмается как прокрутка страницы.
		assignWidget(mWidgetSecondPart, "SecondPart");
		if (mWidgetSecondPart != nullptr)
		{
			mWidgetSecondPart->eventMouseButtonPressed += newDelegate(this, &ScrollBar::notifyMousePressed);
			mWidgetSecondPart->eventMouseButtonReleased += newDelegate(this, &ScrollBar::notifyMouseReleased);
			mWidgetSecondPart->eventMouseWheel += newDelegate(this, &ScrollBar::notifyMouseWheel);
		}

		if (isUserString("MinTrackSize"))
			mMinTrackSize = utility::parseValue<int>(getUserString("MinTrackSize"));

		if (isUserString("TrackRangeMargins"))
			utility::parseComplex<size_t>(getUserString("TrackRangeMargins"), mSkinRangeStart, mSkinRangeEnd);

		if (mWidgetTrack != nullptr)
		{
			if (mWidgetTrack->isUserString("MinTrackSize"))
				mMinTrackSize = utility::parseValue<int>(mWidgetTrack->getUserString("MinTrackSize"));
		}
	}
Пример #10
0
	void TabControl::initialiseOverride()
	{
		Base::initialiseOverride();

		if (isUserString("ButtonSkin"))
			mButtonSkinName = getUserString("ButtonSkin");

		// OBSOLETE
		if (isUserString("OffsetBar"))
			mOffsetTab = utility::parseValue<int>(getUserString("OffsetBar"));
		// OBSOLETE
		if (isUserString("EmptyBarSkin"))
			mEmptySkinName = getUserString("EmptyBarSkin");

		// OBSOLETE
		assignWidget(mWidgetBar, "Bar");
		if (mWidgetBar != nullptr)
		{
			mWidgetBar->setSize(mWidgetBar->getWidth() - mOffsetTab, mWidgetBar->getHeight());
		}

		assignWidget(mButtonLeft, "Left");
		if (mButtonLeft != nullptr)
		{
			mButtonLeft->eventMouseButtonClick += newDelegate(this, &TabControl::notifyPressedButtonEvent);
		}

		assignWidget(mButtonRight, "Right");
		if (mButtonRight != nullptr)
		{
			mButtonRight->eventMouseButtonClick += newDelegate(this, &TabControl::notifyPressedButtonEvent);
		}

		// OBSOLETE
		assignWidget(mButtonDecor, "ButtonDecor");
		if (mButtonDecor != nullptr)
		{
			mButtonDecor->setVisible(false);
		}

		assignWidget(mItemTemplate, "TabItem");
		if (mItemTemplate != nullptr)
		{
			mItemTemplate->setVisible(false);
		}

#ifndef MYGUI_DONT_USE_OBSOLETE
		if (mItemTemplate == nullptr)
		{
			assignWidget(mItemTemplate, "Sheet");
			if (mItemTemplate != nullptr)
			{
				mItemTemplate->setVisible(false);
			}
		}
#endif // MYGUI_DONT_USE_OBSOLETE

		// OBSOLETE
		Widget* showPatch = nullptr;
		assignWidget(showPatch, "ShowPatch");
		if (showPatch != nullptr)
		{
			mWidgetsPatch.push_back(showPatch);
			showPatch->setVisible(false);
		}

		assignWidget(mHeaderPlace, "HeaderPlace");
		assignWidget(mControls, "Controls");
		assignWidget(mEmpty, "Empty");

		if (mEmpty == nullptr)
		{
			// создаем виджет, носитель скина пустоты бара
			// OBSOLETE
			mEmptyBarWidget = _getWidgetBar()->createWidget<Widget>(mEmptySkinName, IntCoord(), Align::Left | Align::Top);
		}

		updateBar();

		// FIXME добавленно, так как шетдаун вызывается и при смене скина
		mShutdown = false;
	}