Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions ChangeLog_rus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -378,3 +378,23 @@
- Demo_ScrollView - демонстрация прокручиваемого поля
- Demo_Themes - демонстрация различных тем
- Demo_StaticImage - демонстрация простейшего вьювера ImageSet

-----Changelog 2023------
MyGUI_ComboBox:
- set/getItemHeight
- void setAutoHideList(bool autoHide); - Manually control whether to close the list

MyGUI_InputManager:
- Changed double click threshold from 0.25 seconds to 0.5 seconds. Else it was often not possible to trigger an double click, but two times a single click has been triggered.

MyGUI_ListBox:
- set/getItemHeight

MyGUI_ScrollBar:
- Fixed mouse release: Additional Rising mouse release, so that it also can be used outside this scrollbar.

MyGUI_Widget:
- Added x, y pixel threshold, because else lost focus is triggered in each input field to early and its not possible to adapt values properly
- Usage: void Widget::setMouseHitThreshold(int xLeftThreshold, int xRightThreshold, int yLeftThreshold, int yRightThreshold)
E.g. MyGUI::EditBox* edit;
edit->setMouseHitThreshold(6, 6, 3, 3);
7 changes: 7 additions & 0 deletions MyGUIEngine/include/MyGUI_ComboBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ namespace MyGUI

//------------------------------------------------------------------------------//
// манипуляции айтемами
//////// Lax 26.10.2020 /////////////////
void setItemHeight(int itemHeight);

ListBox* getList(void) const;
//////// Lax 26.10.2020 /////////////////

//! Get number of items
size_t getItemCount() const;
Expand Down Expand Up @@ -138,6 +143,7 @@ namespace MyGUI
//! Get direction, where drop down list appears.
FlowDirection getFlowDirection() const;

void setAutoHideList(bool autoHide);
/*events:*/
/** Event : Enter pressed in combo mode or item selected in drop down list
and combo mode drop enabled (see void ComboBox::setComboModeDrop(bool _value)).\n
Expand Down Expand Up @@ -196,6 +202,7 @@ namespace MyGUI
ListBox* mList;

bool mListShow;
bool mAutoHideList;
int mMaxListLength;
size_t mItemIndex;
bool mModeDrop;
Expand Down
4 changes: 4 additions & 0 deletions MyGUIEngine/include/MyGUI_ListBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace MyGUI
MYGUI_RTTI_DERIVED( ListBox )

public:
friend class ComboBox;

ListBox();

//------------------------------------------------------------------------------//
Expand All @@ -41,6 +43,7 @@ namespace MyGUI
Methods used to manipulate items.
*/
//@{
void setItemHeight(int itemHeight);
//! Get number of items
size_t getItemCount() const;

Expand Down Expand Up @@ -308,6 +311,7 @@ namespace MyGUI
bool mActivateOnClick; // Require a full mouse click rather than only mouse press to activate an item

int mHeightLine; // высота одной строки
int mItemHeight;
int mTopIndex; // индекс самого верхнего элемента
int mOffsetTop; // текущее смещение
int mRangeIndex; // размерность скрола
Expand Down
6 changes: 6 additions & 0 deletions MyGUIEngine/include/MyGUI_Widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ namespace MyGUI
// перерисовывает детей
void _updateChilds();

void setMouseHitThreshold(int xLeftThreshold, int xRightThreshold, int yLeftThreshold, int yRightThreshold);

protected:
// все создание только через фабрику
~Widget() override = default;
Expand Down Expand Up @@ -421,6 +423,10 @@ namespace MyGUI

Align mAlign;
int mDepth;
int mXLeftThreshold;
int mXRightThreshold;
int mYLeftThreshold;
int mYRightThreshold;
};

} // namespace MyGUI
Expand Down
27 changes: 22 additions & 5 deletions MyGUIEngine/src/MyGUI_ComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace MyGUI
mButton(nullptr),
mList(nullptr),
mListShow(false),
mAutoHideList(true),
mMaxListLength(-1),
mItemIndex(ITEM_NONE),
mModeDrop(false),
Expand Down Expand Up @@ -88,6 +89,7 @@ namespace MyGUI

void ComboBox::shutdownOverride()
{
mList->shutdownOverride();
mList = nullptr;
mButton = nullptr;

Expand Down Expand Up @@ -123,7 +125,8 @@ namespace MyGUI
return;
}

hideList();
if (true == mAutoHideList)
hideList();
}

void ComboBox::notifyListSelectAccept(ListBox* _widget, size_t _position)
Expand Down Expand Up @@ -269,8 +272,6 @@ namespace MyGUI
if (mList->getItemCount() == 0)
return;

if (mListShow)
return;
mListShow = true;

IntCoord coord = calculateListPosition();
Expand All @@ -297,8 +298,6 @@ namespace MyGUI

void ComboBox::hideList()
{
if (!mListShow)
return;
mListShow = false;

if (mShowSmooth)
Expand All @@ -313,6 +312,11 @@ namespace MyGUI
}
}

void ComboBox::setAutoHideList(bool autoHide)
{
mAutoHideList = autoHide;
}

void ComboBox::setIndexSelected(size_t _index)
{
MYGUI_ASSERT_RANGE_AND_NONE(_index, mList->getItemCount(), "ComboBox::setIndexSelected");
Expand Down Expand Up @@ -472,6 +476,19 @@ namespace MyGUI
eventChangeProperty(this, _key, _value);
}

void ComboBox::setItemHeight(int itemHeight)
{
if (nullptr != mList)
{
mList->setItemHeight(itemHeight);
}
}

ListBox* ComboBox::getList(void) const
{
return mList;
}

size_t ComboBox::getItemCount() const
{
return mList->getItemCount();
Expand Down
2 changes: 1 addition & 1 deletion MyGUIEngine/src/MyGUI_InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace MyGUI
{

// In seconds
const float INPUT_TIME_DOUBLE_CLICK = 0.25f;
const float INPUT_TIME_DOUBLE_CLICK = 0.5f;
const float INPUT_DELAY_FIRST_KEY = 0.4f;
const float INPUT_INTERVAL_KEY = 0.05f;

Expand Down
24 changes: 22 additions & 2 deletions MyGUIEngine/src/MyGUI_ListBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ namespace MyGUI
if (isUserString("SkinLine"))
mSkinLine = getUserString("SkinLine");

if (-1 == mItemHeight)
{
if (isUserString("HeightLine"))
mHeightLine = utility::parseInt(getUserString("HeightLine"));

}
else
{
mHeightLine = mItemHeight;
}
if (mHeightLine < 1)
mHeightLine = 1;

Expand All @@ -61,6 +67,7 @@ namespace MyGUI
{
mWidgetScroll->eventScrollChangePosition += newDelegate(this, &ListBox::notifyScrollChangePosition);
mWidgetScroll->setScrollPage((size_t)mHeightLine);
mWidgetScroll->setScrollViewPage((size_t)mHeightLine);
}

updateScroll();
Expand All @@ -69,6 +76,14 @@ namespace MyGUI

void ListBox::shutdownOverride()
{
for (size_t i = 0; i < mWidgetLines.size(); i++)
{
MyGUI::Button* button = mWidgetLines[i];
getClientWidget()->_destroyChildWidget(button);
}
mWidgetLines.clear();
mItemsInfo.clear();
_resetContainer(true);
mWidgetScroll = nullptr;

Base::shutdownOverride();
Expand Down Expand Up @@ -903,7 +918,12 @@ namespace MyGUI

int ListBox::getOptimalHeight() const
{
return (int)((mCoord.height - _getClientWidget()->getHeight()) + (mItemsInfo.size() * mHeightLine));
return (int)((mCoord.height - getClientWidget()->getHeight()) + (mItemsInfo.size() * mHeightLine));
}

void ListBox::setItemHeight(int itemHeight)
{
mItemHeight = itemHeight;
}

size_t ListBox::getItemCount() const
Expand Down
1 change: 1 addition & 0 deletions MyGUIEngine/src/MyGUI_ScrollBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ namespace MyGUI
{
updateTrack();
MyGUI::ControllerManager::getInstance().removeItem(_sender);
this->_riseMouseButtonReleased(_left, _top, _id);
}

void ScrollBar::notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id)
Expand Down
18 changes: 15 additions & 3 deletions MyGUIEngine/src/MyGUI_Widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ namespace MyGUI
mContainer(nullptr),
mAlign(Align::Default),
mVisible(true),
mDepth(0)
mDepth(0),
mXLeftThreshold(0),
mXRightThreshold(0),
mYLeftThreshold(0),
mYRightThreshold(0)
{
}

Expand Down Expand Up @@ -469,7 +473,7 @@ namespace MyGUI
|| (!getNeedMouseFocus() && !getInheritsPick())
|| !_checkPoint(_left, _top)
// если есть маска, проверяем еще и по маске
|| !isMaskPickInside(IntPoint(_left - mCoord.left, _top - mCoord.top), mCoord)
|| !isMaskPickInside(IntPoint(_left - mCoord.left - mXLeftThreshold, _top - mCoord.top - mYLeftThreshold), mCoord)
)
return nullptr;

Expand Down Expand Up @@ -1034,7 +1038,7 @@ namespace MyGUI

bool Widget::_checkPoint(int _left, int _top) const
{
return ! ((_getViewLeft() > _left) || (_getViewTop() > _top) || (_getViewRight() < _left) || (_getViewBottom() < _top));
return ! ((_getViewLeft() > _left - mXLeftThreshold) || (_getViewTop() > _top - mYLeftThreshold) || (_getViewRight() < _left + mXRightThreshold) || (_getViewBottom() < _top + mYRightThreshold));
}

void Widget::_linkChildWidget(Widget* _widget)
Expand Down Expand Up @@ -1387,6 +1391,14 @@ namespace MyGUI
mWidgetChild.push_back(_widget);
}

void Widget::setMouseHitThreshold(int xLeftThreshold, int xRightThreshold, int yLeftThreshold, int yRightThreshold)
{
this->mXLeftThreshold = xLeftThreshold;
this->mXRightThreshold = xRightThreshold;
this->mYLeftThreshold = yLeftThreshold;
this->mYRightThreshold = yRightThreshold;
}

void Widget::_updateChilds()
{
for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
Expand Down