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 STATE // Possible states
{
stNormal,
stActive
};
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 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;
RectC 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;
RectC 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 RectC &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 RectC &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 |