CForm



Form implementation. To create a form you just need to derive it from this class, pass to this class newly created window and renderer and create and setup controls. You may read more in programming guide.

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

class CForm :public virtual IForm, public CClass
{
public:
#ifdef _DEBUG
    void(*OnRender)(IForm *sender, const float fps); // Evend called when actual rendering occurs
#endif

    IRenderer *getRenderer() override;
    IHint *getHint() override;
    IStyle *getStyle() override;
    IFont *getFont() override;
    ICaret *getCaret() override;
    IControl *getModalControl() override;
    IControl *getFocusedControl() override;
    IControl *getCaptureKeyboardControl() override;
    IControl *getCaptureMouseControl() override;
    IControl *getHoveredControl() override;
    IControl *getActiveControl() override;
    IControl *getInputControl() 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;
    int getComponentCount() override;
    IComponent *getComponent(const int index) override;
    IComponent *getComponent(const String &name) override;
    int getComponentIndex(IComponent *component) override;
    ITransform *getTransform() override;
    ITransform *getTransformControls() override;
    CursorType getCursor() override;
    String getHintText() override;
    float getHintDelay() override;
    PointF getHintShift() override;
    Color getBackgroundColor() override;
    bool isShowHint() override;
    bool isFocusByLMB() override;
    bool isFocusByMMB() override;
    bool isFocusByRMB() override;
    bool isFocusByTab() override;
    bool isInterceptEnable() override;
    int getTaskCount() override;
    ITask *getTask(const int index) override;
    Rect getBorderWidth() override;
    Point getDPI() override;
    IDialogBox *getActiveDialogBox() override;

    // Window getters
    bool isVisible() override;
    bool isEnabled() override;
    bool isAcceptDragAndDrop() override;
    bool isAcceptDropFiles() override;
    String getCaption() override;
    Rect getRect() override;
    Point getSize() override;
    Point getPosition() override;
    int getLeft() override;
    int getTop() override;
    int getWidth() override;
    int getHeight() override;
    Rect getClientRect() override;
    Point getClientSize() override;
    int getClientWidth() override;
    int getClientHeight() override;
    WindowState getState() override;
    CreateParams getCreateParams() override;
    bool hasBorder() override;
    bool hasCaption() override;
    bool hasDialogFrame() override;
    bool hasHorizontalScroll() override;
    bool hasVerticalScroll() override;
    bool hasMaximizeBox() override;
    bool hasMinimizeBox() override;
    bool hasSizeBox() override;
    bool hasSystemMenu() override;
    bool hasClientEdge() override;
    bool hasContextHelp() override;
    bool hasDialogModalFrame() override;
    bool hasStaticEdge() override;
    bool hasWindowEdge() override;
    bool isPopup() override;
    bool isTabStop() override;
    bool isMDIChild() override;
    bool isToolWindow() override;
    bool isTopMost() override;

    bool setName(const String &value) override;
    bool setHint(IHint *value) override;
    bool setStyle(IStyle *value) override;
    bool setFont(IFont *value, const bool copy = true) override;
    bool setCaret(ICaret *value) override;
    bool setModalControl(IControl *value) override;
    bool setFocusedControl(IControl *value) override;
    bool setActiveControl(IControl *value) override;
    bool setInputControl(IControl *value) override;
    bool setTransformControls(ITransform *value) override;
    bool setCursor(const CursorType value) override;
    bool setHintText(const String &value) override;
    bool setHintDelay(const float value) override;
    bool setHintShift(const PointF &value) override;
    bool setBackgroundColor(const Color &value) override;
    bool setShowHint(const bool value) override;
    bool setFocusByLMB(const bool value) override;
    bool setFocusByRMB(const bool value) override;
    bool setFocusByMMB(const bool value) override;
    bool setFocusByTab(const bool value) override;
    bool setInterceptEnable(const bool value) override;
    bool setBorderWidth(const Rect &value) override;
    void setService(IFormService *value, const bool release_prev) override final;
    bool setDPI(const Point &value) override;
    bool setActiveDialogBox(IDialogBox *value) override;

    // Window setters
    bool setVisible(const bool value) override;
    bool setEnabled(const bool value) override;
    bool setAcceptDrawAndDrop(const bool value) override;
    bool setAcceptDropFiles(const bool value) override;
    bool setCaption(const String &value) override;
    bool setRect(const Rect &value) override;
    bool setSize(const Point &value) override;
    bool setPosition(const Point &value) override;
    bool setLeft(const int value) override;
    bool setTop(const int value) override;
    bool setWidth(const int value) override;
    bool setHeight(const int value) override;
    bool setClientSize(const Point &value) override;
    bool setState(const WindowState value) override;
    bool setModalResult(const ModalResult value) override;
    bool setWindowPosition(const WindowPosition value) override;
    void setCreateParams(const CreateParams &value) override;
    bool setHasBorder(const bool value) override;
    bool setHasCaption(const bool value) override;
    bool setHasDialogFrame(const bool value) override;
    bool setHasHorizontalScroll(const bool value) override;
    bool setHasVerticalScroll(const bool value) override;
    bool setHasMaximizeBox(const bool value) override;
    bool setHasMinimizeBox(const bool value) override;
    bool setHasSizeBox(const bool value) override;
    bool setHasSystemMenu(const bool value) override;
    bool setHasClientEdge(const bool value) override;
    bool setHasContextHelp(const bool value) override;
    bool setHasDialogModalFrame(const bool value) override;
    bool setHasStaticEdge(const bool value) override;
    bool setHasWindowEdge(const bool value) override;
    bool setIsPopup(const bool value) override;
    bool setIsTabStop(const bool value) override;
    bool setIsMDIChild(const bool value) override;
    bool setIsToolWindow(const bool value) override;
    bool setIsTopMost(const bool value) override;

    bool AttachComponent(IComponent *component) override;
    bool DeleteComponent(const int index) override;
    bool DeleteComponent(IComponent *component) override;
    bool DeleteComponents() override;
    bool DetachComponent(IComponent *component) 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;
    bool FocusPrevControl() override;
    bool FocusNextControl() override;
    bool CaptureKeyboard(IControl *control) override;
    bool CaptureMouse(IControl *control, const bool system_capture) override;
    void ReleaseCaptureKeyboard() override;
    void ReleaseCaptureMouse() override;
    void UpdateHoveredControl() override;
    void ReleaseModal() override;

    void Release() override;

    void LockRepaint() override;
    void UnlockRepaint() override;
    void Repaint() override;
    void Repaint(const Rect &rect) override;
    void Refresh() override;
    void Repaint(const RectF &rect) override;

    bool RegisterHotkey(const Key key, const bool ctrl, const bool alt, const bool shift, const bool is_down) override;
    bool UnregisterHotkey(const Key key, const bool ctrl, const bool alt, const bool shift, const bool is_down) override;
    bool UnregisterHotkeys() override;

    IFormService *QueryService() override;

    // Window actions
    bool Show() override;
    ModalResult ShowModal() override;
    bool Hide() override;
    int CreateTimer(void(*callback)(void *param), void *param, const float interval) override;
    bool DeleteTimer(const int id) override;
    void DeleteTimers() override;
    bool ResetTimer(const int id, const float interval) override;
    bool Maximize() override;
    bool Minimize() override;
    bool Restore() override;
    bool CopyStringToClipboard(const String &str) override;
    bool CopyStringFromClipboard() override;
    Rect ScreenToClient(const Rect &rect) override;
    Point ScreenToClient(const Point &pos) override;
    Rect ClientToScreen(const Rect &rect) override;
    Point ClientToScreen(const Point &pos) override;
    bool Close() override;

    // Tasks
    bool AddTask(ITask *task) override;
    bool DeleteTask(const int index) override;
    bool DeleteTask(ITask *task) override;
    void DeleteTasks() override;
    void RunTasks() override;

    // Hint actions
    bool ShowHint(const String &text, const Point &position) override;
    bool ShowHint(IControl *control, const PointF &position) override;

    /**
    Constructor
    @param class_name Form class name(without "C" at the beginning)
    @param window Window for the form. Could be nullptr and set using service later
    @param renderer Renderer for the form. Could be nullptr and set using service later
    @param params Creation parameters to overwrite default ones if specified
    */
    CForm(const String &class_name, IWindow *window, IRenderer *renderer, const CreateParams *params = nullptr);
    ~CForm() override;
};

Input handler control

This control main purpose is to handle forms which have custom(not platform standard ones) borders and caption area. It is usually have no rendarable area and its size is zero. But it receive form unhandled input to handle resizing by custom borders and moving by custom caption as well as minimazing, maximizing, and closing a form. And it is usually responsible for custom borders and caption area drawing also.

Namespace: nitisa
Include: Nitisa/Core/Form.h