-
-
Notifications
You must be signed in to change notification settings - Fork 479
Add gui combobox missing functions #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
RUN_CHILDREN(GUIComboBoxGetItemCount(**iter)) | ||
|
||
// Are we a CGUI Element? | ||
if (IS_GUI(&Entity)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the indentation here and below.
int state; | ||
CScriptArgReader argStream(luaVM); | ||
argStream.ReadUserData<CGUIComboBox>(comboBox); | ||
argStream.ReadNumber(state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd personally prefer an enum string here (and ofc return a string in guiComboxGetState
). I'd like to hear other opinions though.
Or, an even better solution - as you only distinguish two states - is to rename the function to guiComboxIsOpen
and make it return a boolean.
if (IS_GUI(&Entity)) | ||
{ | ||
CClientGUIElement& GUIElement = static_cast<CClientGUIElement&>(Entity); | ||
int comboState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip: Try reducing the scope of variables as much as possible, i.e. move comboState
into the if block or avoid creating it entirely by directly returning from the vs
/ !vs
- if blocks.
Everything fixed |
@@ -5189,6 +5189,72 @@ bool CStaticFunctionDefinitions::GUIComboBoxSetItemText(CClientEntity& Entity, i | |||
return false; | |||
} | |||
|
|||
int CStaticFunctionDefinitions::GUIComboBoxGetItemCount(CClientEntity& Entity) | |||
{ | |||
RUN_CHILDREN(GUIComboBoxGetItemCount(**iter)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RUN_CHILDREN is unnecessary in Get methods
|
||
bool CStaticFunctionDefinitions::GUIComboBoxIsOpen(CClientEntity& Entity) | ||
{ | ||
RUN_CHILDREN(GUIComboBoxIsOpen(**iter)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, RUN_CHILDREN is unnecessary in Get methods
Client/gui/CGUIComboBox_Impl.cpp
Outdated
@@ -241,6 +241,11 @@ void CGUIComboBox_Impl::Clear(void) | |||
m_pWindow->setText(storedCaption); | |||
} | |||
|
|||
bool CGUIComboBox_Impl::GetState(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be renamed to IsOpen
@qaisjp @Jusonex What's the status on these reviews? |
Syntax
guiComboBoxIsOpen return boolean, nil if bad argument
guiComboBoxSetOpen return boolean