Skip to content

Commit

Permalink
adjust names to match ElementDocument conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
Paril committed Jul 30, 2024
1 parent c065ea6 commit c5ab7f0
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 38 deletions.
10 changes: 6 additions & 4 deletions Include/RmlUi/Core/Elements/ElementFormControlSelect.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ class RMLUICORE_API ElementFormControlSelect : public ElementFormControl {

/// Removes all options from the select control.
void RemoveAll();

/// Show or hide the selection box.
void ShowSelectBox(bool show);

/// Show the selection box.
void ShowSelectBox();
/// Hide the selection box.
void HideSelectBox();
/// Check whether the select box is opened or not.
bool GetSelectBoxVisible();
bool IsSelectBoxVisible();

protected:
/// Moves all children to be under control of the widget.
Expand Down
13 changes: 9 additions & 4 deletions Source/Core/Elements/ElementFormControlSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,19 @@ void ElementFormControlSelect::RemoveAll()
widget->ClearOptions();
}

void ElementFormControlSelect::ShowSelectBox(bool show)
void ElementFormControlSelect::ShowSelectBox()
{
widget->ShowSelectBox(show);
widget->ShowSelectBox();
}

bool ElementFormControlSelect::GetSelectBoxVisible()
void ElementFormControlSelect::HideSelectBox()
{
return widget->GetSelectBoxVisible();
widget->HideSelectBox();
}

bool ElementFormControlSelect::IsSelectBoxVisible()
{
return widget->IsSelectBoxVisible();
}

void ElementFormControlSelect::OnUpdate()
Expand Down
52 changes: 26 additions & 26 deletions Source/Core/Elements/WidgetDropDown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ void WidgetDropDown::ProcessEvent(Event& event)
SetSelection(current_element);
event.StopPropagation();

ShowSelectBox(false);
HideSelectBox();
parent_element->Focus();
}
}
Expand All @@ -534,9 +534,9 @@ void WidgetDropDown::ProcessEvent(Event& event)
}

if (selection_element->GetComputedValues().visibility() == Style::Visibility::Hidden)
ShowSelectBox(true);
ShowSelectBox();
else
ShowSelectBox(false);
HideSelectBox();
}
}
break;
Expand All @@ -553,7 +553,7 @@ void WidgetDropDown::ProcessEvent(Event& event)
{
if (event.GetTargetElement() == parent_element)
{
ShowSelectBox(false);
HideSelectBox();
value_element->SetPseudoClass("focus", false);
button_element->SetPseudoClass("focus", false);
}
Expand Down Expand Up @@ -615,39 +615,39 @@ void WidgetDropDown::ProcessEvent(Event& event)
}

if (!scrolls_selection_box)
ShowSelectBox(false);
HideSelectBox();
}
}
break;
default: break;
}
}

void WidgetDropDown::ShowSelectBox(bool show)
void WidgetDropDown::ShowSelectBox()
{
if (show)
{
selection_element->SetProperty(PropertyId::Visibility, Property(Style::Visibility::Visible));
selection_element->SetPseudoClass("checked", true);
value_element->SetPseudoClass("checked", true);
button_element->SetPseudoClass("checked", true);
box_layout_dirty = DropDownBoxLayoutType::Open;
AttachScrollEvent();
}
else
{
selection_element->SetProperty(PropertyId::Visibility, Property(Style::Visibility::Hidden));
selection_element->RemoveProperty(PropertyId::Height);
selection_element->SetPseudoClass("checked", false);
value_element->SetPseudoClass("checked", false);
button_element->SetPseudoClass("checked", false);
DetachScrollEvent();
}
selection_element->SetProperty(PropertyId::Visibility, Property(Style::Visibility::Visible));
selection_element->SetPseudoClass("checked", true);
value_element->SetPseudoClass("checked", true);
button_element->SetPseudoClass("checked", true);
box_layout_dirty = DropDownBoxLayoutType::Open;
AttachScrollEvent();

box_visible = true;
}

box_visible = show;
void WidgetDropDown::HideSelectBox()
{
selection_element->SetProperty(PropertyId::Visibility, Property(Style::Visibility::Hidden));
selection_element->RemoveProperty(PropertyId::Height);
selection_element->SetPseudoClass("checked", false);
value_element->SetPseudoClass("checked", false);
button_element->SetPseudoClass("checked", false);
DetachScrollEvent();

box_visible = false;
}

bool WidgetDropDown::GetSelectBoxVisible()
bool WidgetDropDown::IsSelectBoxVisible()
{
return box_visible;
}
Expand Down
10 changes: 6 additions & 4 deletions Source/Core/Elements/WidgetDropDown.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ class WidgetDropDown : public EventListener {

/// Processes the incoming event.
void ProcessEvent(Event& event) override;

/// Shows or hides the selection box.
void ShowSelectBox(bool show);

/// Shows the selection box.
void ShowSelectBox();
/// Hides the selection box.
void HideSelectBox();
/// Check whether the select box is visible or not.
bool GetSelectBoxVisible();
bool IsSelectBoxVisible();

private:

Expand Down

0 comments on commit c5ab7f0

Please sign in to comment.