class CCL::ViewBox

Overview

Helper class for convenient access to IView members (“box” around view). More…

#include <viewbox.h>

class ViewBox
{
public:
    // structs

    struct StyleModifier;

    // construction

    ViewBox (IView* view = nullptr);
    ViewBox (IUnknown* unknown);

    ViewBox (
        UIDRef classID,
        RectRef size = Rect (),
        StyleRef style = 0,
        StringRef title = nullptr
    );

    // methods

    UIDRef getClassID () const;
    void setName (StringRef name);
    String getName () const;
    void setTitle (StringRef title);
    String getTitle () const;
    void setTooltip (StringRef title);
    String getTooltip () const;
    void setTooltipTrackingEnabled (bool state);
    bool isTooltipTrackingEnabled () const;
    StyleRef getStyle () const;
    void setStyle (StyleRef style);
    ITheme& getTheme () const;
    void setTheme (ITheme* theme);
    const IVisualStyle& getVisualStyle () const;
    void setVisualStyle (IVisualStyle* visualStyle);
    void setVisualStyle (const IVisualStyle& visualStyle);
    IUnknown* getController () const;
    bool isAttached () const;
    IWindow* getWindow () const;
    int getSizeMode () const;
    void setSizeMode (int flags);
    void disableSizeMode (bool state = true);
    bool isEnabled () const;
    void enable (bool state);
    int getMouseState () const;
    void setMouseState (int state);
    int getThemeElementState () const;
    bool wantsFocus () const;
    void wantsFocus (bool state);
    bool isLayerBackingEnabled () const;
    void setLayerBackingEnabled (bool state);
    IGraphicsLayer* getGraphicsLayer () const;
    bool isAccessibilityEnabled () const;
    void setAccessibilityEnabled (bool state);
    bool getAttribute (Variant& value, const char* id) const;
    bool setAttribute (const char* id, VariantRef value);
    bool setHelpIdentifier (StringRef id);
    RectRef getSize () const;
    void setSize (RectRef size);
    Rect& getClientRect (Rect& r) const;
    bool getVisibleClient (Rect& r) const;
    Coord getWidth () const;
    Coord getHeight () const;
    Point getPosition () const;
    void setPosition (PointRef pos);
    void setSizeLimits (const SizeLimit& sizeLimits);
    const SizeLimit& getSizeLimits () const;
    void setZoomFactor (float factor);
    float getZoomFactor () const;
    Point& clientToWindow (Point& p) const;
    Point& windowToClient (Point& p) const;
    Point& clientToScreen (Point& p) const;
    Point& screenToClient (Point& p) const;
    IView* getParent () const;
    IView* getParent (UIDRef cid) const;
    IView* getViewAt (int index) const;
    int getViewIndex (const IView* childView) const;
    IViewChildren& getChildren () const;
    void autoSize (tbool horizontal = true, tbool vertical = true);
    void redraw ();
    void invalidate ();
    void invalidate (RectRef rect);
    void updateClient ();
    void updateClient (RectRef rect);
    void scrollClient (RectRef rect, PointRef delta);
    bool makeVisible (RectRef rect, tbool relaxed = false);
    bool takeFocus ();
    bool killFocus ();
    void setCursor (IMouseCursor* cursor);
    bool detectDrag (const MouseEvent& event);
    bool detectDoubleClick (const MouseEvent& event);
    ViewBox& operator = (IView* view);
    operator IView * ();
    IView* operator -> ();

    template  <class T>
    T* as ();

    IView* as ();
    static void setModuleTheme (ITheme* theme);
    static ITheme* getModuleTheme ();
};

Detailed Documentation

Helper class for convenient access to IView members (“box” around view).

Construction

ViewBox (
    UIDRef classID,
    RectRef size = Rect (),
    StyleRef style = 0,
    StringRef title = nullptr
)

Create and initialize new view of given class.

Be careful, ViewBox does not own the newly created view object!

Methods

bool getAttribute (Variant& value, const char* id) const

Get view-specific attribute via IObject.

bool setAttribute (const char* id, VariantRef value)

Set view-specific attribute via IObject.

template  <class T>
T* as ()

Cast to specified interface.

IView* as ()

Specialization: cast to IView.

static void setModuleTheme (ITheme* theme)

Set theme of current module.

static ITheme* getModuleTheme ()

Get theme of current module.