tbx
0.7.3
|
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::Window & | window () |
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. | |
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.
tbx::LockExtentPosition::LockExtentPosition | ( | tbx::Window & | w | ) |
Construct lock extent position for a given window.
w | window to lock gadget positions in |
void tbx::LockExtentPosition::add_gadget | ( | tbx::Gadget | gadget, |
unsigned int | lock_flags | ||
) |
Add a gadget to the list to be locked.
gadget | the gadget to add |
lock_flags | flags 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.
id | component id of gadget to be locked |
lock_flags | flags 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.
from | first gadget id |
to | last gadget id |
lock_flags | flags 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.
gadget | gadget to remove |
std::invalid_argument | if gadget has not been added |
void tbx::LockExtentPosition::remove_gadget | ( | tbx::ComponentId | id | ) |
Remove gadget given its component id.
id | component id to remove |
std::invalid_argument | if id has not been added |
void tbx::LockExtentPosition::remove_gadgets | ( | tbx::ComponentId | from, |
tbx::ComponentId | to | ||
) |
Remove a range of gadgets.
from | first gadget id |
to | last gadget id |
std::invalid_argument | if 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.
window | the window to lock the positions too |
logic_error | if the window is already set and gadgets have been locked |