CControl



Control base class. Derive all your controls from this class. It has all required commonly used methods already implemented.

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

class CControl :public virtual IControl, public CComponent
{
public:
    /**
    Constructor
    @param class_name Class name of the control(without "C" at the beginning)
    @param accept_form Whether the control could be placed onto a form directly
    @param accept_control Whether the control could be placed onto another controls
    @param accept_controls Whether another controls could be placed onto the control
    @param accept_focus Whether the control could be focused and receive keyboard input
    @param accept_modal Whether the control could be modal
    @param tab_stop Whether the control could be focused by Tab and Shift+Tab when it is on form, enabled, and accept focus
    @param design_dpi DPI at which the control was designed
    */
    CControl(const String &class_name, const bool accept_form, const bool accept_control, const bool accept_controls, const bool accept_focus, const bool accept_modal, const bool tab_stop,
        // Since 4.1.0
        const Point &design_dpi = DesignDPI);
    ~CControl() override;

    IControl *getParent() override;
    IStyle *getParentStyle() override;
    IStyle *getControlStyle() override;
    IStyle *getStyle() override;
    IFont *getParentFont() override;
    IFont *getControlFont() override;
    IFont *getFont() override;
    int getControlCount(const bool total = false) override;
    IControl *getControl(const int index) override;
    IControl *getControl(const String &name) override;
    IControl *getControl(const PointF &position) override;
    int getControlIndex(IControl *control) override;
    ITransform *getTransform() override;
    ITransform *getTransformControls() override;
    Matrix getTransformMatrix() override;
    ALIGN getAlign() override;
    RectF getConstraints() override;
    PointF getMinConstraints() override;
    PointF getMaxConstraints() override;
    float getMinWidth() override;
    float getMinHeight() override;
    float getMaxWidth() override;
    float getMaxHeight() override;
    PointF getSize() override;
    float getWidth() override;
    float getHeight() override;
    RectF getRect() override;
    RectF getClientRect() override;
    RectF getRenderRect() override;
    int getZIndex() override;
    CURSOR_TYPE getCursor() override;
    int getTabOrder() override;
    String getHintText() override;
    float getHintDelay() override;
    PointF getHintShift() override;
    bool isAcceptForm(const bool with_parents, IForm *form = nullptr) override;
    bool isAcceptControl(IControl *control = nullptr) override;
    bool isAcceptControls() override;
    bool isAcceptFocus() override;
    bool isAcceptModal() override;
    bool isWantTabs() override;
    bool isTabStop() override;
    bool isDeactivateByTab() override;
    bool isModal() override;
    bool isHovered() override;
    bool isFocused() override;
    bool isVisible(const bool with_parents) override;
    bool isEnabled(const bool with_parents) override;
    bool isCaptureMouse() override;
    bool isCaptureKeyboard() override;
    bool isActive() override;
    bool isShowHint() override;
    bool isFocusByMouse() override;
    bool isUseParentStyle() override;
    bool isUseParentFont() override;
    bool isUseParentShowHint() override;
    bool isUseParentHintDelay() override;
    bool isUseParentHintShift() override;
    bool hasChild(IControl *control) override;
    // Since 4.0.0
    Point getDPI() override;
    // Since 6.0.0
    bool isAcceptChild(IControl *control) override; // Always return true
    // Since 9.0.0
    bool isStaticTabOrder() override; // False by default

    bool setName(const String &value) override;
    bool setForm(IForm *value) override;
    bool setParent(IControl *value) override;
    bool setStyle(IStyle *value) override;
    bool setFont(IFont *value, const bool copy = true) override;
    bool setTransform(ITransform *value) override;
    bool setTransformControls(ITransform *value) override;
    bool setAlign(const ALIGN value) override;
    bool setConstraints(const RectF &value) override;
    bool setMinConstraints(const PointF &value) override;
    bool setMaxConstraints(const PointF &value) override;
    bool setMinWidth(const float value) override;
    bool setMinHeight(const float value) override;
    bool setMaxWidth(const float value) override;
    bool setMaxHeight(const float value) override;
    bool setSize(const PointF &value) override;
    bool setWidth(const float value) override;
    bool setHeight(const float value) override;
    bool setZIndex(const int value) override;
    bool setCursor(const CURSOR_TYPE value) override;
    bool setTabOrder(const int value) override;
    bool setHintText(const String &value) override;
    bool setHintDelay(const float value) override;
    bool setHintShift(const PointF &value) override;
    bool setWantTabs(const bool value) override;
    bool setTabStop(const bool value) override;
    bool setDeactivateByTab(const bool value) override;
    bool setModal(const bool value) override;
    bool setFocus() override;
    bool setVisible(const bool value) override;
    bool setEnabled(const bool value) override;
    bool setShowHint(const bool value) override;
    bool setUseParentStyle(const bool value) override;
    bool setUseParentFont(const bool value) override;
    bool setUseParentShowHint(const bool value) override;
    bool setUseParentHintDelay(const bool value) override;
    bool setUseParentHintShift(const bool value) override;
    // Since 2.0.0
    void setService(IControlService *value, const bool release_prev) override final; // Do nothing with previous service
    // Since 4.0.0
    bool setDPI(const Point &value) override;
    // Since 9.0.0
    bool setStaticTabOrder(const bool value) override;

    bool AttachControl(IControl *control) override;
    bool InsertControl(IControl *control, const int before) override;
    bool DeleteControl(const int index) override;
    bool DeleteControl(IControl *control) override;
    bool DeleteControls() override;
    bool DetachControl(IControl *control) override;
    IControl *FindControl(const String &name, IControl *exclude = nullptr) override;

    void Release() override;
    void Repaint(const bool repaint_children) override;
    void Repaint(const RectF &rect, const bool convert) override;
    // Since 8.0.0
    void Refresh(const bool refresh_children) override; // Only calls repaint. Derived controls which use canvas should override this method and clear canvas before calling repaint

    bool BringToFront() override;
    bool BringUp() override;
    bool BringDown() override;
    bool BringBefore(IControl *control) override;
    bool BringBefore(const int index) override;
    bool BringAfter(IControl *control) override;
    bool BringAfter(const int index) override;

    IControlService *QueryService() override final;

    PointF FormToLocal(const PointF &pos) override;
    PointF LocalToForm(const PointF &pos) override;

    // Hint actions(since 8.0.0)
    bool ShowHint(const PointF &position) override;
};
Namespace: nitisa
Include: Nitisa/Core/Control.h