raysan5 / raygui

A simple and easy-to-use immediate-mode gui library
zlib License
3.61k stars 303 forks source link

Create Rollup Box GUI element #406

Closed Spacerulerwill closed 4 months ago

Spacerulerwill commented 6 months ago

I propose the addition of a GuiRollupBox function, which is similar to the GuiDropdownBox function but the elements appear above instead of below. This is useful in cases where there is a bottom-level toolbar that still need some kind of select menu, as shown below. With a GuiDropdownBox the elements would have fallen off the bottom of the screen. rollupbar To implement this, I have refactored the logic of GuiDropdownBox into a new function called GuiDropdownBoxEx, which accepts an additional parameter for direction. This allows both GuiDropdownBox and GuiRollupBox to share the same core functionality, only differing by which direction they pass to GuiDropdownBoxEx. This is my first proper open source contribution so I apologize in advance for any mistakes.

raysan5 commented 6 months ago

@Spacerulerwill This property could be added to GuiDropdownBox() but the PR should be redesigned to follow raygui design.

A new property can be added in GuiDropdownBoxProperty, for example DROPDOWN_ROLL_UP, with default/initial value as 0. Then consider that property directly on GuiDropdownBox() with no need to add new controls.

So users will write code as:

GuiSetStyle(DROPDOWNBOX, DROPDOWN_ROLL_UP, 1); // Setup dropdown box to roll-up
GuiDropdownBox(...);
GuiSetStyle(DROPDOWNBOX, DROPDOWN_ROLL_UP, 0); // Reset dropdown box to roll-down
raysan5 commented 4 months ago

@Spacerulerwill Are you reviewing this PR with proposed changes?

Spacerulerwill commented 4 months ago

@Spacerulerwill Are you reviewing this PR with proposed changes?

Apologise for the delay, I forgot about your response. I will review it in the coming days and make the changes

raysan5 commented 4 months ago

@Spacerulerwill Just added it, I needed it for one of my tools. Thanks anyway!