CPopupMenu



Implements PopupMenu control.

You can find more information in comments below. Overrided methods can be found in corresponding base classes and interfaces.

// This popup 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 CPopupMenu :public virtual IPopupMenu, public CControl
{
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 unselected 
    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); // Event called when item has been deleted 
    void(*OnDeleteItems)(IControl *sender); // Event called when all items has been deleted 

    CPopupMenu();
    CPopupMenu(IForm *parent);
    ~CPopupMenu() override;

    IControl *getControl(const PointF &position) override;
    RectF getClientRect() override;
    RectF getRenderRect() override; // Return rect with all opened submenus 
    Matrix getTransformMatrix() override;
    int getItemCount(const bool total = false) override;
    IListItem *getItem(const int index) override;

    bool setAlign(const ALIGN value) override; // Not allowed 
    bool setConstraints(const RectF &value) override; // Allow only max height 
    bool setSize(const PointF &value) override; // Allowed only when called internally 
    bool setVisible(const bool value) override; // Allowed only when added to form 
    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;
    bool Add(IListItem *item) override;
    bool Insert(IListItem *item, const int before) override;
    bool Delete(const int index) override;
    bool Clear() override;

    bool Show(const PointF &position) override;
    bool Hide() override;

    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 getBorderWidth() const;
    RectF getBorderRadius() const;
    RectC getBorderColor() const;
    Color getLeftBorderColor() const;
    Color getTopBorderColor() const;
    Color getRightBorderColor() const;
    Color getBottomBorderColor() const;
    RectF getPadding() const;
    Color getBackgroundColor() const;
    Color getShadowColor() const;
    int getShadowRadius() const;
    PointF getShadowShift() const;
    float getScroll() const; // Return scroll value 
    float getScrollMax() const; // Return maximum allowed scroll 
    float getSubmenuScroll(IListItem *parent); // Return submenu scroll 
    float getSubmenuScrollMax(IListItem *parent); // Return maximum allowed scroll of submenu 
    PointF getSubmenuShift() const;
    bool getIgnoreHotkeys() const; // Whether hotkeys should be ignored 
    float getHotkeyMaxInterval() const;
    float getScrollHeight() const;
    Color getScrollArrowColorNormal() const;
    Color getScrollArrowColorHovered() const;
    Color getScrollArrowColorDisabled() const;
    float getScrollInterval() const; // Return scroll interval(in seconds) 
    float getDeltaScrollTimer() const;
    float getDeltaScrollWheel() const;
    Gradient *getBackgroundGradient();

    bool setImageListEnabled(IImageList *value); // Set image list for enabled state 
    bool setImageListDisabled(IImageList *value); // Set image list for disabled state 
    // Set layout properties 
    bool setBorderWidth(const RectF &value);
    bool setBorderRadius(const RectF &value);
    bool setBorderColor(const RectC &value);
    bool setLeftBorderColor(const Color &value);
    bool setTopBorderColor(const Color &value);
    bool setRightBorderColor(const Color &value);
    bool setBottomBorderColor(const Color &value);
    bool setPadding(const RectF &value);
    bool setBackgroundColor(const Color &value);
    bool setShadowColor(const Color &value);
    bool setShadowRadius(const int value);
    bool setShadowShift(const PointF &value);
    bool setScroll(const float value); // Set scroll 
    bool setSubmenuScroll(IListItem *parent, const float value); // Set submenu scroll 
    bool setSubmenuShift(const PointF &value);
    bool setIgnoreHotkeys(const bool value); // Set whether to ignore hotkeys 
    bool setHotkeyMaxInterval(const float value);
    bool setScrollHeight(const float value);
    bool setScrollArrowColorNormal(const Color &value);
    bool setScrollArrowColorHovered(const Color &value);
    bool setScrollArrowColorDisabled(const Color &value);
    bool setScrollInterval(const float value); // Set scroll interval(in seconds) 
    bool setDeltaScrollTimer(const float value);
    bool setDeltaScrollWheel(const float value);
};
Namespace: nitisa::standard
Include: Standard/Controls/PopupMenu/PopupMenu.h