tbx  0.7.3
Public Types | Public Member Functions | List of all members
tbx::LockExtentPosition Class Reference

Class to lock the position of gadgets relative to the work area of the window they are in. More...

#include <lockextentposition.h>

Public Types

enum  LockFlags {
  left_to_left = 1, left_to_right = 2, right_to_left = 4, right_to_right = 8,
  bottom_to_top = 16, bottom_to_bottom = 32, top_to_top = 64, top_to_bottom = 128
}
 Lock states, shifted for each edge.
 

Public Member Functions

 LockExtentPosition (tbx::Window &w)
 Construct lock extent position for a given window. More...
 
virtual ~LockExtentPosition ()
 Destructor free resources and remove window listener used.
 
tbx::Windowwindow ()
 Return window gadgets are locked to.
 
void window (tbx::Window &window)
 Set the window to lock the gadget positions too. More...
 
void add_gadget (tbx::Gadget gadget, unsigned int lock_flags)
 Add a gadget to the list to be locked. More...
 
void add_gadget (tbx::ComponentId id, unsigned int lock_flags)
 Add a gadget to the list to be locked from its component id. More...
 
void add_gadgets (tbx::ComponentId from, tbx::ComponentId to, unsigned int lock_flags)
 Add range of gadgets with the same lock flags. More...
 
void remove_gadget (tbx::Gadget gadget)
 Remove gadget from list. More...
 
void remove_gadget (tbx::ComponentId id)
 Remove gadget given its component id. More...
 
void remove_gadgets (tbx::ComponentId from, tbx::ComponentId to)
 Remove a range of gadgets. More...
 
void clear ()
 Clear list of gadget locked in place.
 
void extent_changed ()
 Method to check if window extent has changed and move the gadgets if necessary.
 

Detailed Description

Class to lock the position of gadgets relative to the work area of the window they are in.

As there is no extent change listener for the window, the extent_changed method must be called after any change ot the window extent.

Constructor & Destructor Documentation

tbx::LockExtentPosition::LockExtentPosition ( tbx::Window w)

Construct lock extent position for a given window.

Parameters
wwindow to lock gadget positions in

Member Function Documentation

void tbx::LockExtentPosition::add_gadget ( tbx::Gadget  gadget,
unsigned int  lock_flags 
)

Add a gadget to the list to be locked.

Parameters
gadgetthe gadget to add
lock_flagsflags determine how to lock the gadget edges. Use a combination of the LockFlags enum.
void tbx::LockExtentPosition::add_gadget ( tbx::ComponentId  id,
unsigned int  lock_flags 
)

Add a gadget to the list to be locked from its component id.

Parameters
idcomponent id of gadget to be locked
lock_flagsflags determine how to lock the gadget edges. Use a combination of the LockFlags enum.
void tbx::LockExtentPosition::add_gadgets ( tbx::ComponentId  from,
tbx::ComponentId  to,
unsigned int  lock_flags 
)

Add range of gadgets with the same lock flags.

Parameters
fromfirst gadget id
tolast gadget id
lock_flagsflags determine how to lock the gadget edges. Use a combination of the LockFlags enum.
void tbx::LockExtentPosition::remove_gadget ( tbx::Gadget  gadget)

Remove gadget from list.

Parameters
gadgetgadget to remove
Exceptions
std::invalid_argumentif gadget has not been added
void tbx::LockExtentPosition::remove_gadget ( tbx::ComponentId  id)

Remove gadget given its component id.

Parameters
idcomponent id to remove
Exceptions
std::invalid_argumentif id has not been added
void tbx::LockExtentPosition::remove_gadgets ( tbx::ComponentId  from,
tbx::ComponentId  to 
)

Remove a range of gadgets.

Parameters
fromfirst gadget id
tolast gadget id
Exceptions
std::invalid_argumentif ids have not been added
void tbx::LockExtentPosition::window ( tbx::Window window)

Set the window to lock the gadget positions too.

This can only be changed if there are no gadgets added.

Parameters
windowthe window to lock the positions too
Exceptions
logic_errorif the window is already set and gadgets have been locked

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