Implements MainMenu control.
You can find more information in comments below. Overrided methods can be found in corresponding base classes and interfaces.
// This main menu show itself in client area of form, so it cannot be places on another controls and cannot have any transformations except for Tx and Ty
class CMainMenu :public virtual IMainMenu, public CControl
{
public:
enum class State // Possible states
{
Normal,
Active
};
public:
void(*OnSelectItem)(IControl *sender, IListItem *item); // Event called when item has been selected
void(*OnDeselectItem)(IControl *sender, IListItem *item); // Event called when item has been deselected
void(*OnActivateItem)(IControl *sender, IListItem *item); // Event called when item has been activated
void(*OnDeactivateItem)(IControl *sender, IListItem *item); // Event called when item has been deactivated
void(*OnDeleteItem)(IControl *sender, IListItem *item); // Evet called when item has been deleted
void(*OnDeleteItems)(IControl *sender); // Event called when all items has been deleted
// IControl methods
void Refresh(const bool refresh_children) override;
CMainMenu();
CMainMenu(IForm *parent);
~CMainMenu() override;
IControl *getControl(const PointF &position) override;
RectF getRenderRect() override; // Return rect with all opened submenus
bool isAcceptForm() override;
bool isAcceptForm(IForm *form) override;
bool hasExtra() override;
bool setAlign(const Align value) override; // Not allowed
bool setConstraints(const RectF &value) override; // Not allowed
bool setEnabled(const bool value) override; // Not allowed
bool setTransform(ITransform *value) override;
bool setDPI(const Point &value) override;
IListItemOwner *QueryListItemOwner() override;
IListItem *getRootItem() override;
int getItemCount(const bool total = false) override;
IListItem *getItem(const int index) override;
bool Add(IListItem *item) override;
bool Insert(IListItem *item, const int before) override;
bool Delete(const int index) override;
bool Clear() override;
State getState(); // Return current state
IListItem *getItem(const String &name); // Return item by name
IListItem *getItem(const PointF &position); // Return item at specified position(in local coordinates)
IImageList *getImageListEnabled(); // Return assigned image list for enabled state
IImageList *getImageListDisabled(); // Return assigned image list for disabled state
// Return layout properties
RectF getSubmenuBorderWidth() const;
RectF getSubmenuBorderRadius() const;
BorderColor getSubmenuBorderColor() const;
Color getSubmenuLeftBorderColor() const;
Color getSubmenuTopBorderColor() const;
Color getSubmenuRightBorderColor() const;
Color getSubmenuBottomBorderColor() const;
RectF getSubmenuPadding() const;
Color getSubmenuBackgroundColor() const;
Color getSubmenuShadowColor() const;
int getSubmenuShadowRadius() const;
PointF getSubmenuShadowShift() const;
float getScroll() const; // Return scroll of main menu
float getScrollMax() const; // Return maximum allowed scroll of main menu
float getSubmenuScroll(IListItem *parent); // Return submenu scroll
float getSubmenuScrollMax(IListItem *parent); // Return maximum allowed scroll of submenu
PointF getSubmenuShift() const;
float getHotkeyMaxInterval() const;
float getSubmenuScrollHeight() const;
Color getSubmenuScrollArrowColorNormal() const;
Color getSubmenuScrollArrowColorHovered() const;
Color getSubmenuScrollArrowColorDisabled() const;
float getScrollInterval() const;
float getSubmenuDeltaScrollTimer() const;
float getSubmenuDeltaScrollWheel() const;
float getSubmenuMaxHeight() const;
Gradient *getSubmenuBackgroundGradient();
RectF getBorderWidth() const;
RectF getBorderRadius() const;
RectF getPadding() const;
BorderColor getBorderColor(const State state) const;
Color getLeftBorderColor(const State state) const;
Color getTopBorderColor(const State state) const;
Color getRightBorderColor(const State state) const;
Color getBottomBorderColor(const State state) const;
Color getBackgroundColor(const State state) const;
Color getShadowColor(const State state) const;
int getShadowRadius(const State state) const;
PointF getShadowShift(const State state) const;
Gradient *getBackgroundGradient(const State state);
float getScrollWidth() const;
Color getScrollArrowColorNormal() const;
Color getScrollArrowColorHovered() const;
Color getScrollArrowColorDisabled() const;
bool isItemRightAligned(const int index); // Whether item is at right or at left of the menu
bool isItemRightAligned(IListItem *item); // Whether item is at right or at left of the menu
PointF getRootSubmenuShift() const;
bool setImageListEnabled(IImageList *value); // Assign new image list for enabled state
bool setImageListDisabled(IImageList *value); // Assign new image list for disabled state
// Set layout properties
bool setSubmenuBorderWidth(const RectF &value);
bool setSubmenuBorderRadius(const RectF &value);
bool setSubmenuBorderColor(const BorderColor &value);
bool setSubmenuLeftBorderColor(const Color &value);
bool setSubmenuTopBorderColor(const Color &value);
bool setSubmenuRightBorderColor(const Color &value);
bool setSubmenuBottomBorderColor(const Color &value);
bool setSubmenuPadding(const RectF &value);
bool setSubmenuBackgroundColor(const Color &value);
bool setSubmenuShadowColor(const Color &value);
bool setSubmenuShadowRadius(const int value);
bool setSubmenuShadowShift(const PointF &value);
bool setScroll(const float value); // Scroll menu
bool setSubmenuScroll(IListItem *parent, const float value); // Scroll submenu
bool setSubmenuShift(const PointF &value);
bool setHotkeyMaxInterval(const float value);
bool setSubmenuScrollHeight(const float value);
bool setSubmenuScrollArrowColorNormal(const Color &value);
bool setSubmenuScrollArrowColorHovered(const Color &value);
bool setSubmenuScrollArrowColorDisabled(const Color &value);
bool setScrollInterval(const float value);
bool setSubmenuDeltaScrollTimer(const float value);
bool setSubmenuDeltaScrollWheel(const float value);
bool setSubmenuMaxHeight(const float value);
bool setBorderWidth(const RectF &value);
bool setBorderRadius(const RectF &value);
bool setPadding(const RectF &value);
bool setBorderColor(const State state, const BorderColor &value);
bool setLeftBorderColor(const State state, const Color &value);
bool setTopBorderColor(const State state, const Color &value);
bool setRightBorderColor(const State state, const Color &value);
bool setBottomBorderColor(const State state, const Color &value);
bool setBackgroundColor(const State state, const Color &value);
bool setShadowColor(const State state, const Color &value);
bool setShadowRadius(const State state, const int value);
bool setShadowShift(const State state, const PointF &value);
bool setScrollWidth(const float value);
bool setScrollArrowColorNormal(const Color &value);
bool setScrollArrowColorHovered(const Color &value);
bool setScrollArrowColorDisabled(const Color &value);
bool setItemRightAligned(const int index, const bool value);
bool setItemRightAligned(IListItem *item, const bool value);
bool setRootSubmenuShift(const PointF &value);
bool Add(IListItem *item, const bool right_aligned); // Add item
bool Insert(IListItem *item, const int before, const bool right_aligned); // Insert item before specified one
};
Namespace: | nitisa::standard |
Include: | Standard/Controls/MainMenu/MainMenu.h |