05-08-2013 04:53 AM
I want to add toggle buttons as items of a Context Menu. The idea is that the user must be able to turn some functionalities on and off via the context menu of a component.
Right now I managed to implement this behavior just using the default Cascades components: I place some ActionItem on a ActionSet of contextActions of my component. Once the ActionItem is triggered I set some toggled flags true/false and change its title and imageSource property to represent the toggled state. If the user toggles another ActionItem from the contextMenu that's supposed to be another toggle button, I un-toggle the current toggled item first. It works fine, but I wish I could keep the down state of the item - blue background and while letters - as the toggled state.
But now I want to re-use this functionalities in other components but I'm not sure how to achieve this.
My first idea is as follows:
What do you guys think? Do you think these two extended classes is the way to go?
I also checked the class bb::cascades::ImageToggleButton, which has a lot of the functionalities that I need, but it's not based on bb::cascades::AbstractActionItem so it's possible to put it in an ActionSet. The class bb::cascades::MultiSelectActionItem was also promising but I think it's meant to be used with something else, more complex than what I need.
Looking forward to your suggestions.