FLTK 1.4.0
Fl_Rect Class Reference

Rectangle with standard FLTK coordinates (X, Y, W, H). More...

#include <Fl_Rect.H>

Public Member Functions

int b () const
 gets the bottom edge (y + h). More...
 
void b (int B)
 sets the height based on B and y
 
 Fl_Rect ()
 The default constructor creates an empty rectangle (x = y = w = h = 0).
 
 Fl_Rect (const Fl_Widget &widget)
 This constructor creates a rectangle based on a widget's position and size.
 
 Fl_Rect (const Fl_Widget *const widget)
 This constructor creates a rectangle based on a widget's position and size.
 
 Fl_Rect (int W, int H)
 This constructor creates a rectangle with x = y = 0 and the given width and height.
 
 Fl_Rect (int X, int Y, int W, int H)
 This constructor creates a rectangle with the given x,y coordinates and the given width and height.
 
 Fl_Rect (int X, int Y, int W, int H, Fl_Boxtype bt)
 This constructor creates a rectangle with the given x,y coordinates and the given width and height reduced by the box frame size. More...
 
int h () const
 gets the height
 
void h (int H)
 sets the height
 
void inset (Fl_Boxtype bt)
 Move all edges in by the frame size of box type bt. More...
 
void inset (int d)
 Move all edges in by d. More...
 
void inset (int left, int top, int right, int bottom)
 Move all edges in by left, top, right, bottom. More...
 
int r () const
 gets the right edge (x + w). More...
 
void r (int R)
 sets the width based on R and x
 
int w () const
 gets the width
 
void w (int W)
 sets the width
 
int x () const
 gets the x coordinate (left edge)
 
void x (int X)
 sets the x coordinate (left edge)
 
int y () const
 gets the y coordinate (top edge)
 
void y (int Y)
 sets the y coordinate (top edge)
 

Friends

bool operator!= (const Fl_Rect &lhs, const Fl_Rect &rhs)
 
bool operator== (const Fl_Rect &lhs, const Fl_Rect &rhs)
 

Detailed Description

Rectangle with standard FLTK coordinates (X, Y, W, H).

This may be used internally, for overloaded widget constructors and other overloaded methods like fl_measure(), fl_text_extents(), fl_rect(), fl_rectf(), and maybe more.

Constructor & Destructor Documentation

◆ Fl_Rect()

Fl_Rect::Fl_Rect ( int  X,
int  Y,
int  W,
int  H,
Fl_Boxtype  bt 
)
inline

This constructor creates a rectangle with the given x,y coordinates and the given width and height reduced by the box frame size.

This is the same as using the constructor w/o bt and subsequently calling inset(bt).

Member Function Documentation

◆ b()

int Fl_Rect::b ( ) const
inline

gets the bottom edge (y + h).

Note
r() and b() are coordinates outside the area of the rectangle.

◆ inset() [1/3]

void Fl_Rect::inset ( Fl_Boxtype  bt)
inline

Move all edges in by the frame size of box type bt.

Shrinks the rectangle at all sides by the frame width or height of the given box type bt.

This method uses the frame sizes given by the box type bt using

  • Fl::box_dx(bt)
  • Fl::box_dy(bt)
  • Fl::box_dw(bt)
  • Fl::box_dh(bt)

If the rectangle is smaller than the frame sizes the result is undefined, i.e. an invalid or empty rectangle.

◆ inset() [2/3]

void Fl_Rect::inset ( int  d)
inline

Move all edges in by d.

Shrinks the rectangle by d at all sides keeping the center of the rectangle at the same spot.

If d is negative, the rectangle is enlarged.

If d >= w() or h() the result is undefined, i.e. an invalid or empty rectangle.

◆ inset() [3/3]

void Fl_Rect::inset ( int  left,
int  top,
int  right,
int  bottom 
)
inline

Move all edges in by left, top, right, bottom.

Shrinks the rectangle on all sides keeping the center of the rectangle at the same spot.

If any value is negative, the rectangle is enlarged.

Values are not range checked; it is possible to create an invalid or empty rectangle.

◆ r()

int Fl_Rect::r ( ) const
inline

gets the right edge (x + w).

Note
r() and b() are coordinates outside the area of the rectangle.

The documentation for this class was generated from the following file: