#include <uview.hpp>
Inheritance diagram for ubit::UView:
Public Types | |
INITIALIZING = 1<<0 | |
INITIALIZING is set at the 1st update, INITIALIZED at the 2nd update (a combination of layout+update+layout is necessary for correct init). | |
INITIALIZED = 1<<1 | |
DAMAGED = 1<<2 | |
this view has been damaged and must be repaint | |
DESTRUCTED = 1<<3 | |
this viewobject has been fully destructed (by all its destructors) but the memory has not yet been freed (operator delete being redefined) | |
FIXED_WIDTH = 1<<4 | |
this view has a fixed width (resp. height) | |
FIXED_HEIGHT = 1<<5 | |
REALIZED_CHILDREN = 1<<6 | |
the children of this view have been realized (for win views only) | |
FORCE_POS = 1<<7 | |
POS_HAS_CHANGED = 1<<9 | |
position(UPos) /size(UWidth,UHeight) has changed: hence the geometry of the this view must be updated | |
SIZE_HAS_CHANGED = 1<<10 | |
NO_DOUBLE_BUFFER = 1<< 11 | |
enum | VMODES { INITIALIZING = 1<<0, INITIALIZED = 1<<1, DAMAGED = 1<<2, DESTRUCTED = 1<<3, FIXED_WIDTH = 1<<4, FIXED_HEIGHT = 1<<5, REALIZED_CHILDREN = 1<<6, FORCE_POS = 1<<7, POS_HAS_CHANGED = 1<<9, SIZE_HAS_CHANGED = 1<<10, NO_DOUBLE_BUFFER = 1<< 11 } |
Public Member Functions | |
UView (UChild *, UView *parview, UHardWinImpl *) | |
virtual UViewStyle * | getViewStyle () |
UViewStyle renderer. returns the default view style. | |
virtual UFlowView * | flowCast () |
virtual UTableView * | tableCast () |
virtual UPaneView * | paneCast () |
dynamic cast. | |
bool | isShown () const |
true if this view is currently shown. | |
bool | isRealized () const |
returns true if this view has been realized. | |
UBox * | getBox () const |
returns the UBox object that controls this view. | |
UBox * | getBoxParent () const |
UView * | getParentView () const |
returns the parent view (if any, always null for windows). | |
UDisp * | getDisp () const |
returns the Display where this view is displayed. | |
UWin * | getWin () const |
UView * | getWinView () const |
returns the Window (resp. the Window view) where this view is displayed. | |
UHardWinImpl * | getHardWinImpl () |
UNatWin * | getNatWin () const |
UNatDisp * | getNatDisp () const |
UView * | getNext () |
returns the next view in the list (if any, null otherwise). | |
UChild * | getChildNode () |
returns the corresponding box link. | |
template<typename T> | |
T * | getProp (T *&p) |
returns the corresponding View Property. | |
template<typename T> | |
T & | obtainProp (T *&p) |
returns or creates the corresponding View Property. | |
int | getWidth () const |
returns the width of the view. | |
int | getHeight () const |
returns the height of the view. | |
void | getSize (int &w, int &h) const |
returns the size of the view. | |
UDimension | getSize () const |
returns the size of the view. | |
void | setSize (int width, int height) |
changes the size of the view (see details). | |
int | getX () const |
returns the x position of the view relatively to its parent origin. | |
int | getY () const |
returns the y position of the view relatively to its parent origin. | |
void | getPos (int &x, int &y) const |
returns the position of the view relatively to its parent origin. | |
UPoint | getPos () const |
returns the position of the view relatively to its parent origin. | |
void | getPosInWin (int &x, int &y) const |
returns the position of the view relatively to its window origin. | |
UPoint | getPosInWin () const |
returns the position of the view relatively to its window origin. | |
void | getPosOnScreen (int &x, int &y) const |
returns the position of the view relatively to the screen origin. | |
UPoint | getPosOnScreen () const |
returns the position of the view relatively to the screen origin. | |
void | setPos (int x, int y) |
changes the position of the view (see details). | |
void | setAutoPositioning (bool) |
speficies update policy when the object is modified. | |
int | XToXwin (int x_in_view) const |
int | YToYwin (int y_in_view) const |
converts a position in view coordinates to window coordinates. | |
int | XwinToX (int x_in_win) const |
int | YwinToY (int y_in_win) const |
convert a position in window coordinates to view coordinates. | |
int | eventToX (const UMouseEvent &e) const |
int | eventToY (const UMouseEvent &e) const |
returns the position of an Event in view coordinates. | |
virtual bool | caretPosToXY (long caret_pos, int &line, int &col) const |
virtual bool | xyToCaretPos (int line, int col, long &caret_pos) const |
convert a caret position to XY coordinates and vice versa. | |
int | getVModes () const |
[impl] returns the current V-Modes bitmask. | |
bool | hasVMode (int modes) const |
[impl] true if ONE of these V-Modes is verified. | |
void | addVModes (UMask modes) |
[impl] add these modes to the V-Modes bitmask. | |
void | removeVModes (UMask modes) |
[impl] remove these modes from the V-Modes bitmask. | |
void | updatePaint (URegion *view_region=null, int dbf_mode=0) |
[impl] update paint in this view (region is in view coordinates). | |
void | updateWinPaint (const URegion &window_region, int dbf_mode, bool all_layers, UView *first_layer) |
[impl] update paint in the window of this view (region is in window coordinates). | |
int | updateWinData (const URegion &window_region) |
[impl] update internal data but don't repaint (region is in window coordinates). | |
virtual bool | doLayout (UContext &, UViewLayout &) |
impl. | |
virtual void | doUpdate (UContext &, URegion r, URegion clip, UViewUpdate &) |
impl. | |
void | operator delete (void *) |
Static Public Member Functions | |
static UView * | createView (UChild *, UView *parview, UHardWinImpl *) |
createView() is a static constructor used by UViewStyle to make a new view. | |
static bool | convertPos (const UView *to_view, int &to_x, int &to_y, const UView *from_view, int from_x, int from_y) |
converts position in 'from_view' to position in 'to_view'. | |
Static Public Attributes | |
static UViewStyle | style |
UBox objects (and subclasses except UWin) can have several views. these views can be retrieved by methods UBox::getView(), UBox::getViews(), etc.
Note: UWin objects (and subclasses) have only onse (shared) view that is called the "window view".
enum ubit::UView::VMODES |
INITIALIZING | INITIALIZING is set at the 1st update, INITIALIZED at the 2nd update (a combination of layout+update+layout is necessary for correct init). |
DAMAGED | this view has been damaged and must be repaint |
DESTRUCTED | this viewobject has been fully destructed (by all its destructors) but the memory has not yet been freed (operator delete being redefined) |
FIXED_WIDTH | this view has a fixed width (resp. height) |
REALIZED_CHILDREN | the children of this view have been realized (for win views only) |
POS_HAS_CHANGED | position(UPos) /size(UWidth,UHeight) has changed: hence the geometry of the this view must be updated |
bool ubit::UView::convertPos | ( | const UView * | to_view, | |
int & | to_x, | |||
int & | to_y, | |||
const UView * | from_view, | |||
int | from_x, | |||
int | from_y | |||
) | [static] |
converts position in 'from_view' to position in 'to_view'.
both views must be on the same UDisp. returns false if the conversion did not succeeded.
int ubit::UView::eventToY | ( | const UMouseEvent & | e | ) | const |
returns the position of an Event in view coordinates.
the event must occur in a window that contains this view.
T* ubit::UView::getProp | ( | T *& | p | ) |
returns the corresponding View Property.
returns null if this property does not belong to the view.
bool ubit::UView::isRealized | ( | ) | const |
returns true if this view has been realized.
a view is realized when its physical (= X window) resources have been created
T& ubit::UView::obtainProp | ( | T *& | p | ) |
returns or creates the corresponding View Property.
creates and adds this property if it does not belong to the view.
void ubit::UView::setPos | ( | int | x, | |
int | y | |||
) |
changes the position of the view (see details).
Note that most box views are layed out automatically. Calling setPos() on such views won't have the expected effect because their position is controlled by the layout manager.
void ubit::UView::setSize | ( | int | width, | |
int | height | |||
) |
changes the size of the view (see details).
Note that most box views are layed out automatically. Calling setSize() on such views won't have the expected effect because their size is controlled by the layout manager.
void ubit::UView::updatePaint | ( | URegion * | view_region = null , |
|
int | dbf_mode = 0 | |||
) |
[impl] update paint in this view (region is in view coordinates).
repaints the whole view if view_region is null. 'double_buffer' specifies whether double buffering is activated
int ubit::UView::updateWinData | ( | const URegion & | window_region | ) |
[impl] update internal data but don't repaint (region is in window coordinates).
must be called after scrolling and in some other cases to update internal view data without repainting it
void ubit::UView::updateWinPaint | ( | const URegion & | window_region, | |
int | dbf_mode, | |||
bool | all_layers, | |||
UView * | first_layer | |||
) |
[impl] update paint in the window of this view (region is in window coordinates).
bool ubit::UView::xyToCaretPos | ( | int | line, | |
int | col, | |||
long & | caret_pos | |||
) | const [virtual] |
convert a caret position to XY coordinates and vice versa.
returns false if the conversion did not succeeded.