CBuiltInDropDown



This class is an implementation of the Built-in DropDown control. You may check DropDown control source code in the Standard package to see how it may be used in your controls.

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

class CBuiltInDropDown :public virtual IBuiltInDropDown, public CBuiltInControl
{
public:
    enum STATE // Possible states
    {
        stNormal, // Common, normal state
        stHovered, // Control is hovered
        stFocused, // Control is focused
        stFocusedHovered, // Control is focused and hovered
        stDisabled // Control is disabled
    };

    enum ARROW_AREA // How open/close arrow area width should be calculated
    {
        aaAbsolute, // Arrow area width is specified in pixels
        aaHeight, // Arrow area width is equal to control height
        aaWidthPart // Arrow area width is specified in parts of control width
    };

    enum OPEN_DIRECTION // Where list with items should appear in opened dropdown
    {
        odUp, // At the top of the control
        odDown // At the bottom of the control
    };
public:
    IBuiltInControlListener *getListener() override;
    bool isHovered() override;
    RectF getClientRect() override;
    RectF getRenderRect() override;
    CURSOR_TYPE getCursor(const PointF &position, const CURSOR_TYPE def) override;
    bool isInside(const PointF &position) override;
    // Since 5.0.0
    bool isDown() override;
    // Since 6.2.1
    IBuiltInTextInput *getTextInput() override;

    void setListener(IBuiltInControlListener *value) override;
    bool setEnabled(const bool value) override;
    bool setFocused(const bool value) override;
    bool setSize(const PointF &value) override;
    // Since 4.0.0
    bool setDPI(const Point &value) override;

    void UpdateFromStyle(IStyle *style, const String &class_name) override;
    void Update() override;
    void Render(const bool last_pass, const Matrix &matrix, const BLOCK *block) override;
    void FreeResources() override;
    // Since 8.0.0
    void Refresh() override;

    // State change notifications
    void NotifyOnAttach() override;
    void NotifyOnDeactivate() override;

    // Mouse notifications
    bool NotifyOnMouseHover(const PointF &position) override;
    bool NotifyOnMouseLeave() override;
    bool NotifyOnMouseMove(const PointF &position, const bool left, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseLeftDown(const PointF &position, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseLeftUp(const PointF &position, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseLeftDoubleClick(const PointF &position, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseMiddleDown(const PointF &position, const bool left, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseMiddleUp(const PointF &position, const bool left, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseMiddleDoubleClick(const PointF &position, const bool left, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseRightDown(const PointF &position, const bool left, const bool middle, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseRightUp(const PointF &position, const bool left, const bool middle, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseRightDoubleClick(const PointF &position, const bool left, const bool middle, const bool ctrl, const bool alt, const bool shift) override;
    void NotifyOnMouseDownCancel() override;
    bool NotifyOnMouseVerticalWheel(const PointF &position, const bool left, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift, const int delta) override;
    bool NotifyOnMouseHorizontalWheel(const PointF &position, const bool left, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift, const int delta) override;

    // Keyboard notifications
    bool NotifyOnKeyDown(const KEY key, const bool ctrl, const bool alt, const bool shift, const bool numlock) override;
    bool NotifyOnKeyUp(const KEY key, const bool ctrl, const bool alt, const bool shift, const bool numlock) override;
    bool NotifyOnChar(const wchar_t chr, const bool ctrl, const bool alt, const bool shift, const bool numlock) override;
    bool NotifyOnDeadChar(const wchar_t chr, const bool ctrl, const bool alt, const bool shift, const bool numlock) override;

    // Other input notifications
    bool NotifyOnDropFiles(const PointF &position, const std::vector<String> &filenames) override;

    // Clipboard notifications(since 9.0.0)
    bool NotifyOnPasteString(const String &text) override;

    int getItemCount() override;
    IListItem *getItem(const int index) override;
    int getItemIndex(IListItem *item) override;
    bool isEditable() override;
    bool isOpened() override;
    bool isSortable() override;
    String getText() override;
    int getActiveIndex() override;
    FCompare getCompareFunc() override;
    FGetItemText getItemTextFunc() override;
    FSearch getSearchFunc() override;
    PointF getMousePosition() override; // Suppose dropdown is only translated. If it's transformed in other way, overwrite the method

    bool setTextInput(IBuiltInTextInput *value) override;
    bool setScroll(IBuiltInScroll *value) override;
    bool setEditable(const bool value) override;
    bool setSortable(const bool value) override;
    bool setText(const String &value) override;
    bool setActiveIndex(const int value) override;
    bool setCompareFunc(FCompare value) override;
    bool setGetItemTextFunc(FGetItemText value) override;
    bool setSearchFunc(FSearch value) override;

    bool AddItem(IListItem *item) override;
    bool InsertItem(IListItem *item, const int before) override;
    bool DeleteItem(const int index) override;
    bool DeleteItem(IListItem *item) override;
    bool DeleteItems() override;
    // Since 6.2.1
    bool MoveItem(IListItem *item, const int before) override;

    bool Open() override;
    bool Close() override;
    IListItemOwner *QueryListItemOwner() override;

    /**
    Constructor
    @param editable Whether dropdown will have text input
    @param compare Item comparison function
    @param get_item_text Function returning item caption or name
    @param search Searching function
    */
    CBuiltInDropDown(const bool editable, FCompare compare, FGetItemText get_item_text, FSearch search);
    ~CBuiltInDropDown();

    virtual STATE getState(); // Return current state
    bool isArrowAtRight() const; // Return whether arrow area at the right of the control
    OPEN_DIRECTION getOpenDirection() const; // Return where list of items will be shown when opening the dropdown
    ARROW_AREA getArrowArea() const; // Return how arrow area is calculated
    float getListWidth() const; // Return width of item list
    float getListMaxHeight() const; // Return maximum height of item list
    float getArrowAreaSize() const; // Return parameter of calculating arrow area width
    float getArrowSize() const; // Return arrow area size
    RectF getBorderWidth() const; // Return border widths
    RectF getBorderRadius() const; // Return border radiuses
    RectF getPadding() const; // Return padding
    RectF getArrowBorderWidth() const; // Return arrow area border widths
    RectF getArrowBorderRadius() const; // Return arrow area corner radiuses
    RectF getListBorderWidth() const; // Return item list border widths
    RectF getListBorderRadius() const; // Return item list corner radiuses
    RectF getListPadding() const; // Return item list padding
    Color getShadowColor(const STATE state) const; // Return shadow color depending on state in non-editable mode
    Color getShadowColorEditable(const STATE state) const; // Return shadow color depending on state in editable mode
    PointF getShadowShift(const STATE state) const; // Return shadow shift depending on state in non-editable mode
    PointF getShadowShiftEditable(const STATE state) const; // Return shadow shift depending on state in editable mode
    int getShadowRadius(const STATE state) const; // Return shadow blur radius depending on state in non-editable mode
    int getShadowRadiusEditable(const STATE state) const; // Return shadow blur radius depending on state in editable mode
    RectC getBorderColor(const STATE state) const; // Return border colours depending on state in non-editable mode
    RectC getBorderColorEditable(const STATE state) const; // Return border colours depending on state in editable mode
    Color getLeftBorderColor(const STATE state) const; // Return left border colour depending on state in non-editable mode
    Color getLeftBorderColorEditable(const STATE state) const; // Return left border colour depending on state in editable mode
    Color getTopBorderColor(const STATE state) const; // Return top border colour depending on state in non-editable mode
    Color getTopBorderColorEditable(const STATE state) const; // Return top border colour depending on state in editable mode
    Color getRightBorderColor(const STATE state) const; // Return right border colour depending on state in non-editable mode
    Color getRightBorderColorEditable(const STATE state) const; // Return right border colour depending on state in editable mode
    Color getBottomBorderColor(const STATE state) const; // Return bottom border colour depending on state in non-editable mode
    Color getBottomBorderColorEditable(const STATE state) const; // Return bottom border colour depending on state in editable mode
    Color getBackgroundColor(const STATE state) const; // Return background colour depending on state in non-editable mode
    Color getBackgroundColorEditable(const STATE state) const; // Return background colour depending on state in editable mode
    Gradient *getBackgroundGradient(const STATE state); // Return background gradient depending on state in non-editable mode
    Gradient *getBackgroundGradientEditable(const STATE state); // Return background gradient depending on state in editable mode
    RectC getArrowBorderColor(const STATE state) const; // Return arrow area border colours depending on state in non-editable mode
    RectC getArrowBorderColorEditable(const STATE state) const; // Return arrow area border colours depending on state in editable mode
    Color getArrowLeftBorderColor(const STATE state) const; // Return arrow area left border colour depending on state in non-editable mode
    Color getArrowLeftBorderColorEditable(const STATE state) const; // Return arrow area left border colour depending on state in editable mode
    Color getArrowTopBorderColor(const STATE state) const; // Return arrow area top border colour depending on state in non-editable mode
    Color getArrowTopBorderColorEditable(const STATE state) const; // Return arrow area top border colour depending on state in editable mode
    Color getArrowRightBorderColor(const STATE state) const; // Return arrow area right border colour depending on state in non-editable mode
    Color getArrowRightBorderColorEditable(const STATE state) const; // Return arrow area right border colour depending on state in editable mode
    Color getArrowBottomBorderColor(const STATE state) const; // Return arrow area bottom border colour depending on state in non-editable mode
    Color getArrowBottomBorderColorEditable(const STATE state) const; // Return arrow area bottom border colour depending on state in editable mode
    Color getArrowBackgroundColor(const STATE state) const; // Return arrow area background colour depending on state in non-editable mode
    Color getArrowBackgroundColorEditable(const STATE state) const; // Return arrow area background colour depending on state in editable mode
    Gradient *getArrowBackgroundGradient(const STATE state); // Return arrow area background gradient depending on state in non-editable mode
    Gradient *getArrowBackgroundGradientEditable(const STATE state); // Return arrow area background gradient depending on state in editable mode
    Color getArrowColor(const STATE state) const; // Return arrow colour depending on state in non-editable mode
    Color getArrowColorEditable(const STATE state) const; // Return arrow colour depending on state in editable mode
    RectC getListBorderColor() const; // Return list border colours in non-editable mode
    RectC getListBorderColorEditable() const; // Return list border colours in editable mode
    Color getListLeftBorderColor() const; // Return list left border colour in non-editable mode
    Color getListLeftBorderColorEditable() const; // Return list left border colour in editable mode
    Color getListTopBorderColor() const; // Return list top border colour in non-editable mode
    Color getListTopBorderColorEditable() const; // Return list top border colour in editable mode
    Color getListRightBorderColor() const; // Return list right border colour in non-editable mode
    Color getListRightBorderColorEditable() const; // Return list right border colour in editable mode
    Color getListBottomBorderColor() const; // Return list bottom border colour in non-editable mode
    Color getListBottomBorderColorEditable() const; // Return list bottom border colour in editable mode
    Color getListBackgroundColor() const; // Return list background colour in non-editable mode
    Color getListBackgroundColorEditable() const; // Return list background colour in editable mode
    Gradient *getListBackgroundGradient(); // Return list background gradient in non-editable mode
    Gradient *getListBackgroundGradientEditable(); // Return list background gradient in editable mode
    Color getListShadowColor() const; // Return list shadow colour in non-editable mode
    Color getListShadowColorEditable() const; // Return list shadow colour in editable mode
    PointF getListShadowShift() const; // Return list shadow shift in non-editable mode
    PointF getListShadowShiftEditable() const; // Return list shadow shift in editable mode
    int getListShadowRadius() const; // Return list shadow blur radius in non-editable mode
    int getListShadowRadiusEditable() const; // Return list shadow blur radius in editable mode
    float getSearchResetInterval() const; // Return reset search interval in seconds

    bool setArrowAtRight(const bool value); // Set whether arrow area should be at right of the control
    bool setOpenDirection(const OPEN_DIRECTION value); // Set where to show item list
    bool setListWidth(const float value); // Set item list width
    bool setListMaxHeight(const float value); // Set item list maximum height
    bool setArrowArea(const ARROW_AREA value);  // Set arrow area width calculation type
    bool setArrowAreaSize(const float value); // Set arrow area calculation parameter
    bool setArrowSize(const float value); // Set arrow size
    bool setBorderWidth(const RectF &value); // Set border widths
    bool setBorderRadius(const RectF &value); // Set corner radiuses
    bool setPadding(const RectF &value); // Set padding
    bool setArrowBorderWidth(const RectF &value); // Set arrow area border widths
    bool setArrowBorderRadius(const RectF &value); // Set arrow area corner radiuses
    bool setListBorderWidth(const RectF &value); // Set item list border widths
    bool setListBorderRadius(const RectF &value); // Set item list corner radiuses
    bool setListPadding(const RectF &value); // Set item list padding
    bool setShadowColor(const STATE state, const Color &value); // Set shadow colour depending on state in non-editable mode
    bool setShadowColorEditable(const STATE state, const Color &value); // Set shadow colour depending on state in editable mode
    bool setShadowShift(const STATE state, const PointF &value); // Set shadow shift depending on state in non-editable mode
    bool setShadowShiftEditable(const STATE state, const PointF &value); // Set shadow shift depending on state in editable mode
    bool setShadowRadius(const STATE state, const int value); // Set shadow blur radius depending on state in non-editable mode
    bool setShadowRadiusEditable(const STATE state, const int value); // Set shadow blur radius depending on state in editable mode
    bool setBorderColor(const STATE state, const RectC &value); // Set border colours depending on state in non-editable mode
    bool setBorderColorEditable(const STATE state, const RectC &value); // Set border colours depending on state in editable mode
    bool setLeftBorderColor(const STATE state, const Color &value); // Set left border colour depending on state in non-editable mode
    bool setLeftBorderColorEditable(const STATE state, const Color &value); // Set left border colour depending on state in editable mode
    bool setTopBorderColor(const STATE state, const Color &value); // Set top border colour depending on state in non-editable mode
    bool setTopBorderColorEditable(const STATE state, const Color &value); // Set top border colour depending on state in editable mode
    bool setRightBorderColor(const STATE state, const Color &value); // Set right border colour depending on state in non-editable mode
    bool setRightBorderColorEditable(const STATE state, const Color &value); // Set right border colour depending on state in editable mode
    bool setBottomBorderColor(const STATE state, const Color &value); // Set bottom border colour depending on state in non-editable mode
    bool setBottomBorderColorEditable(const STATE state, const Color &value); // Set bottom border colour depending on state in editable mode
    bool setBackgroundColor(const STATE state, const Color &value); // Set background colour depending on state in non-editable mode
    bool setBackgroundColorEditable(const STATE state, const Color &value); // Set background colour depending on state in editable mode
    bool setArrowBorderColor(const STATE state, const RectC &value); // Set arrow area border colours depending on state in non-editable mode
    bool setArrowBorderColorEditable(const STATE state, const RectC &value); // Set arrow area border colours depending on state in editable mode
    bool setArrowLeftBorderColor(const STATE state, const Color &value); // Set arrow area left border colour depending on state in non-editable mode
    bool setArrowLeftBorderColorEditable(const STATE state, const Color &value); // Set arrow area left border colour depending on state in editable mode
    bool setArrowTopBorderColor(const STATE state, const Color &value); // Set arrow area top border colour depending on state in non-editable mode
    bool setArrowTopBorderColorEditable(const STATE state, const Color &value); // Set arrow area top border colour depending on state in editable mode
    bool setArrowRightBorderColor(const STATE state, const Color &value); // Set arrow area right border colour depending on state in non-editable mode
    bool setArrowRightBorderColorEditable(const STATE state, const Color &value); // Set arrow area right border colour depending on state in editable mode
    bool setArrowBottomBorderColor(const STATE state, const Color &value); // Set arrow area bottom border colour depending on state in non-editable mode
    bool setArrowBottomBorderColorEditable(const STATE state, const Color &value); // Set arrow area bottom border colour depending on state in editable mode
    bool setArrowBackgroundColor(const STATE state, const Color &value); // Set arrow area background colour depending on state in non-editable mode
    bool setArrowBackgroundColorEditable(const STATE state, const Color &value); // Set arrow area background colour depending on state in editable mode
    bool setArrowColor(const STATE state, const Color &value); // Set arrow colour depending on state in non-editable mode
    bool setArrowColorEditable(const STATE state, const Color &value); // Set arrow colour depending on state in editable mode
    bool setListBorderColor(const RectC &value); // Set item list border colours in non-editable mode
    bool setListBorderColorEditable(const RectC &value); // Set item list border colours in editable mode
    bool setListLeftBorderColor(const Color &value); // Set item list left border colour in non-editable mode
    bool setListLeftBorderColorEditable(const Color &value); // Set item list left border colour in editable mode
    bool setListTopBorderColor(const Color &value); // Set item list top border colour in non-editable mode
    bool setListTopBorderColorEditable(const Color &value); // Set item list top border colour in editable mode
    bool setListRightBorderColor(const Color &value); // Set item list right border colour in non-editable mode
    bool setListRightBorderColorEditable(const Color &value); // Set item list right border colour in editable mode
    bool setListBottomBorderColor(const Color &value); // Set item list bottom border colour in non-editable mode
    bool setListBottomBorderColorEditable(const Color &value); // Set item list bottom border colour in editable mode
    bool setListBackgroundColor(const Color &value); // Set item list background colour in non-editable mode
    bool setListBackgroundColorEditable(const Color &value); // Set item list background colour in editable mode
    bool setListShadowColor(const Color &value); // Set item list shadow colour in non-editable mode
    bool setListShadowColorEditable(const Color &value); // Set item list shadow colour in editable mode
    bool setListShadowShift(const PointF &value); // Set item list shadow shift in non-editable mode
    bool setListShadowShiftEditable(const PointF &value); // Set item list shadow shift in editable mode
    bool setListShadowRadius(const int value); // Set item list shadow blur radius in non-editable mode
    bool setListShadowRadiusEditable(const int value); // Set item list shadow blur radius in editable mode
    bool setSearchResetInterval(const float value); // Set reset search interval(in seconds)
};
Namespace: nitisa
Include: Nitisa/BuiltInControls/DropDown/BuiltInDropDown.h