Skip to content
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

Add DSL for creating menu toolbar #1

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

LVMVRQUXL
Copy link
Collaborator

@LVMVRQUXL LVMVRQUXL commented Oct 27, 2023

Description

This request adds a DSL for creating the menu toolbar of the desktop application.
It is marked as draft for reviewing the requirements and the API of the DSL.

Requirements

  • A menu toolbar has at least one menu.
  • A menu has a label and at least one option.
  • A menu label shouldn't be blank.
  • A menu option can be a menu or an actionable option.
  • An actionable option has a label and an action to execute on click.
  • An actionable option label shouldn't be blank.
import kotools.types.NotEmptySet
import kotools.types.NotBlankString

interface MenuToolbar {
    val menus: NotEmptySet<Menu>
}

sealed interface MenuOption {
    val label: NotBlankString
}

interface Menu : MenuOption {
    val options: NotEmptySet<MenuOption>
}

interface ActionableOption : MenuOption {
    fun onClick(): Unit
}

If we already know the labels of menu options at compile-time, we should define them in sealed hierarchies (enum class or sealed interface for example).

Checklist

  • Validate the requirements.
  • Define the DSL without implementing the declarations.
  • Implement and test the ActionableOption type.
  • Implement and test the Menu type.
  • Implement and test the MenuOption type.
  • Implement and test the MenuToolbar type.
  • Refactor code for using this new DSL.

@LVMVRQUXL LVMVRQUXL added enhancement New feature or request question Further information is requested labels Oct 27, 2023
@LVMVRQUXL LVMVRQUXL self-assigned this Oct 27, 2023
@LVMVRQUXL
Copy link
Collaborator Author

@MichaelStH Does the requirements above are correct?

@MichaelStH
Copy link
Owner

Yes they are correct

@MichaelStH
Copy link
Owner

Requirement: a menu toolbar must have at least one menu

@LVMVRQUXL
Copy link
Collaborator Author

Yes they are correct

Okay, thank you @MichaelStH.

Requirement: a menu toolbar must have at least one menu

I've upgraded the requirements in the request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants