Skip to content

Commit 419f6dd

Browse files
committed
Added custom changes. See ChangeLog_rus.txt
1 parent 6ff8910 commit 419f6dd

File tree

9 files changed

+100
-10
lines changed

9 files changed

+100
-10
lines changed

ChangeLog_rus.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,3 +378,23 @@
378378
- Demo_ScrollView - демонстрация прокручиваемого поля
379379
- Demo_Themes - демонстрация различных тем
380380
- Demo_StaticImage - демонстрация простейшего вьювера ImageSet
381+
382+
-----Changelog 2023------
383+
MyGUI_ComboBox:
384+
- set/getItemHeight
385+
- void setAutoHideList(bool autoHide); - Manually control whether to close the list
386+
387+
MyGUI_InputManager:
388+
- 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.
389+
390+
MyGUI_ListBox:
391+
- set/getItemHeight
392+
393+
MyGUI_ScrollBar:
394+
- Fixed mouse release: Additional Rising mouse release, so that it also can be used outside this scrollbar.
395+
396+
MyGUI_Widget:
397+
- 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
398+
- Usage: void Widget::setMouseHitThreshold(int xLeftThreshold, int xRightThreshold, int yLeftThreshold, int yRightThreshold)
399+
E.g. MyGUI::EditBox* edit;
400+
edit->setMouseHitThreshold(6, 6, 3, 3);

MyGUIEngine/include/MyGUI_ComboBox.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ namespace MyGUI
3737

3838
//------------------------------------------------------------------------------//
3939
// манипуляции айтемами
40+
//////// Lax 26.10.2020 /////////////////
41+
void setItemHeight(int itemHeight);
42+
43+
ListBox* getList(void) const;
44+
//////// Lax 26.10.2020 /////////////////
4045

4146
//! Get number of items
4247
size_t getItemCount() const;
@@ -138,6 +143,7 @@ namespace MyGUI
138143
//! Get direction, where drop down list appears.
139144
FlowDirection getFlowDirection() const;
140145

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

198204
bool mListShow;
205+
bool mAutoHideList;
199206
int mMaxListLength;
200207
size_t mItemIndex;
201208
bool mModeDrop;

MyGUIEngine/include/MyGUI_ListBox.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace MyGUI
4141
Methods used to manipulate items.
4242
*/
4343
//@{
44+
void setItemHeight(int itemHeight);
4445
//! Get number of items
4546
size_t getItemCount() const;
4647

@@ -308,6 +309,7 @@ namespace MyGUI
308309
bool mActivateOnClick; // Require a full mouse click rather than only mouse press to activate an item
309310

310311
int mHeightLine; // высота одной строки
312+
int mItemHeight;
311313
int mTopIndex; // индекс самого верхнего элемента
312314
int mOffsetTop; // текущее смещение
313315
int mRangeIndex; // размерность скрола

MyGUIEngine/include/MyGUI_Widget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ namespace MyGUI
421421

422422
Align mAlign;
423423
int mDepth;
424+
int mXLeftThreshold;
425+
int mXRightThreshold;
426+
int mYLeftThreshold;
427+
int mYRightThreshold;
424428
};
425429

426430
} // namespace MyGUI

MyGUIEngine/src/MyGUI_ComboBox.cpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace MyGUI
2727
mButton(nullptr),
2828
mList(nullptr),
2929
mListShow(false),
30+
mAutoHideList(true),
3031
mMaxListLength(-1),
3132
mItemIndex(ITEM_NONE),
3233
mModeDrop(false),
@@ -88,8 +89,10 @@ namespace MyGUI
8889

8990
void ComboBox::shutdownOverride()
9091
{
92+
mList->shutdownOverride();
9193
mList = nullptr;
9294
mButton = nullptr;
95+
mClient = nullptr;
9396

9497
Base::shutdownOverride();
9598
}
@@ -123,7 +126,8 @@ namespace MyGUI
123126
return;
124127
}
125128

126-
hideList();
129+
if (true == mAutoHideList)
130+
hideList();
127131
}
128132

129133
void ComboBox::notifyListSelectAccept(ListBox* _widget, size_t _position)
@@ -269,8 +273,6 @@ namespace MyGUI
269273
if (mList->getItemCount() == 0)
270274
return;
271275

272-
if (mListShow)
273-
return;
274276
mListShow = true;
275277

276278
IntCoord coord = calculateListPosition();
@@ -297,8 +299,6 @@ namespace MyGUI
297299

298300
void ComboBox::hideList()
299301
{
300-
if (!mListShow)
301-
return;
302302
mListShow = false;
303303

304304
if (mShowSmooth)
@@ -313,6 +313,11 @@ namespace MyGUI
313313
}
314314
}
315315

316+
void ComboBox::setAutoHideList(bool autoHide)
317+
{
318+
mAutoHideList = autoHide;
319+
}
320+
316321
void ComboBox::setIndexSelected(size_t _index)
317322
{
318323
MYGUI_ASSERT_RANGE_AND_NONE(_index, mList->getItemCount(), "ComboBox::setIndexSelected");
@@ -472,6 +477,19 @@ namespace MyGUI
472477
eventChangeProperty(this, _key, _value);
473478
}
474479

480+
void ComboBox::setItemHeight(int itemHeight)
481+
{
482+
if (nullptr != mList)
483+
{
484+
mList->setItemHeight(itemHeight);
485+
}
486+
}
487+
488+
ListBox* ComboBox::getList(void) const
489+
{
490+
return mList;
491+
}
492+
475493
size_t ComboBox::getItemCount() const
476494
{
477495
return mList->getItemCount();

MyGUIEngine/src/MyGUI_InputManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace MyGUI
1616
{
1717

1818
// In seconds
19-
const float INPUT_TIME_DOUBLE_CLICK = 0.25f;
19+
const float INPUT_TIME_DOUBLE_CLICK = 0.5f;
2020
const float INPUT_DELAY_FIRST_KEY = 0.4f;
2121
const float INPUT_INTERVAL_KEY = 0.05f;
2222

MyGUIEngine/src/MyGUI_ListBox.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,15 @@ namespace MyGUI
4141
if (isUserString("SkinLine"))
4242
mSkinLine = getUserString("SkinLine");
4343

44+
if (-1 == mItemHeight)
45+
{
4446
if (isUserString("HeightLine"))
4547
mHeightLine = utility::parseInt(getUserString("HeightLine"));
46-
48+
}
49+
else
50+
{
51+
mHeightLine = mItemHeight;
52+
}
4753
if (mHeightLine < 1)
4854
mHeightLine = 1;
4955

@@ -61,6 +67,7 @@ namespace MyGUI
6167
{
6268
mWidgetScroll->eventScrollChangePosition += newDelegate(this, &ListBox::notifyScrollChangePosition);
6369
mWidgetScroll->setScrollPage((size_t)mHeightLine);
70+
mWidgetScroll->setScrollViewPage((size_t)mHeightLine);
6471
}
6572

6673
updateScroll();
@@ -69,7 +76,16 @@ namespace MyGUI
6976

7077
void ListBox::shutdownOverride()
7178
{
79+
for (size_t i = 0; i < mWidgetLines.size(); i++)
80+
{
81+
MyGUI::Button* button = mWidgetLines[i];
82+
mClient->_destroyChildWidget(button);
83+
}
84+
mWidgetLines.clear();
85+
mItemsInfo.clear();
86+
_resetContainer(true);
7287
mWidgetScroll = nullptr;
88+
mClient = nullptr;
7389

7490
Base::shutdownOverride();
7591
}
@@ -906,6 +922,16 @@ namespace MyGUI
906922
return (int)((mCoord.height - _getClientWidget()->getHeight()) + (mItemsInfo.size() * mHeightLine));
907923
}
908924

925+
Widget* ListBox::_getClientWidget()
926+
{
927+
return mClient == nullptr ? this : mClient;
928+
}
929+
930+
void ListBox::setItemHeight(int itemHeight)
931+
{
932+
mItemHeight = itemHeight;
933+
}
934+
909935
size_t ListBox::getItemCount() const
910936
{
911937
return mItemsInfo.size();

MyGUIEngine/src/MyGUI_ScrollBar.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ namespace MyGUI
327327
{
328328
updateTrack();
329329
MyGUI::ControllerManager::getInstance().removeItem(_sender);
330+
this->_riseMouseButtonReleased(_left, _top, _id);
330331
}
331332

332333
void ScrollBar::notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id)

MyGUIEngine/src/MyGUI_Widget.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ namespace MyGUI
4141
mContainer(nullptr),
4242
mAlign(Align::Default),
4343
mVisible(true),
44-
mDepth(0)
44+
mDepth(0),
45+
mXLeftThreshold(0),
46+
mXRightThreshold(0),
47+
mYLeftThreshold(0),
48+
mYRightThreshold(0)
4549
{
4650
}
4751

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

@@ -1034,7 +1038,7 @@ namespace MyGUI
10341038

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

10401044
void Widget::_linkChildWidget(Widget* _widget)
@@ -1387,6 +1391,14 @@ namespace MyGUI
13871391
mWidgetChild.push_back(_widget);
13881392
}
13891393

1394+
void Widget::setMouseHitThreshold(int xLeftThreshold, int xRightThreshold, int yLeftThreshold, int yRightThreshold)
1395+
{
1396+
this->mXLeftThreshold = xLeftThreshold;
1397+
this->mXRightThreshold = xRightThreshold;
1398+
this->mYLeftThreshold = yLeftThreshold;
1399+
this->mYRightThreshold = yRightThreshold;
1400+
}
1401+
13901402
void Widget::_updateChilds()
13911403
{
13921404
for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)

0 commit comments

Comments
 (0)