JX Application Framework
|
#include <JPartition.h>
Public Member Functions | |
virtual | ~JPartition () |
JSize | GetCompartmentCount () const |
JCoordinate | GetCompartmentSize (const JIndex index) const |
bool | SetCompartmentSize (const JIndex index, const JCoordinate reqSize) |
const JArray< JCoordinate > & | GetCompartmentSizes () const |
void | SetCompartmentSizes (const JArray< JCoordinate > &sizes) |
JCoordinate | GetMinTotalSize () const |
JCoordinate | GetMinCompartmentSize (const JIndex index) const |
void | SetMinCompartmentSize (const JIndex index, const JCoordinate minSize) |
const JArray< JCoordinate > & | GetMinCompartmentSizes () const |
void | SetMinCompartmentSizes (const JArray< JCoordinate > &sizes) |
bool | GetElasticIndex (JIndex *index) const |
void | SetElasticIndex (const JIndex index) |
bool | FindCompartment (const JCoordinate coord, JIndex *index) const |
void | DeleteCompartment (const JIndex index) |
void | ReadGeometry (std::istream &input) |
void | WriteGeometry (std::ostream &output) const |
Static Public Attributes | |
static const JCoordinate | kDragRegionSize = 5 |
Protected Member Functions | |
JPartition (const JArray< JCoordinate > &sizes, const JIndex elasticIndex, const JArray< JCoordinate > &minSizes) | |
bool | InsertCompartment (const JIndex index, const JCoordinate size, const JCoordinate minSize) |
void | SetElasticSize () |
void | PrepareToDrag (const JCoordinate coord, JCoordinate *minDragCoord, JCoordinate *maxDragCoord) |
void | AdjustCompartmentsAfterDrag (const JCoordinate coord) |
void | PrepareToDragAll (const JCoordinate coord, JCoordinate *minDragCoord, JCoordinate *maxDragCoord) |
void | AdjustCompartmentsAfterDragAll (const JCoordinate coord) |
virtual void | PTBoundsChanged () |
virtual JCoordinate | GetTotalSize () const =0 |
virtual void | UpdateCompartmentSizes ()=0 |
virtual bool | SaveGeometryForLater (const JArray< JCoordinate > &sizes)=0 |
virtual void | CreateCompartmentObject (const JIndex index, const JCoordinate position, const JCoordinate size)=0 |
virtual void | DeleteCompartmentObject (const JIndex index)=0 |
Interface for the JPartition class
System independent base class for a set of compartments arranged horizontally or vertically. We cannot store the actual compartment objects because they will be derived from a system dependent base class. The size of each compartment must be positive and at least equal to the corresponding minimum size *at all times*. It is the client's responsibility to ensure that the enclosing window will never get too small. The default behavior when the entire partition is resized: (To change this, override PTBoundsChanged().) If all compartments are elastic, each one changes size by the same amount. If a single compartment is designated as elastic, only this one changes size. Derived classes must implement the following functions: GetTotalSize Return the total size of the partition. UpdateCompartmentSizes Adjust the size of each compartment object to match our values. CreateCompartmentObject Create a compartment object and insert it at the specified index. DeleteCompartmentObject Delete the specified compartment object.
|
virtual |
|
protected |
derived class must create compartments
'sizes' contains the initial sizes of the compartments. If a single compartment is elastic, then the size for this compartment is calculated rather than being retrieved from the array.
Specify elasticIndex=0 if you want all compartments to be elastic.
|
protected |
Shift space from one compartment to the other.
|
protected |
Expand one compartment at the expense of all the others.
|
protectedpure virtual |
Implemented in JXPartition.
void JPartition::DeleteCompartment | ( | const JIndex | index | ) |
Remove the compartment and adjust the adjacent compartments to fill the gap.
|
protectedpure virtual |
Implemented in JXPartition.
bool JPartition::FindCompartment | ( | const JCoordinate | coord, |
JIndex * | index | ||
) | const |
If the point is between compartments i and i+1, the index returned is i.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
JCoordinate JPartition::GetMinTotalSize | ( | ) | const |
|
protectedpure virtual |
Implemented in JXHorizPartition, and JXVertPartition.
|
protected |
Adjusts the adjacent compartments to make space.
Returns false if there isn't enough space available for at least minSize.
|
protected |
Prepare to drag dividing line between two adjacent compartments.
|
protected |
Prepare to drag dividing line between two adjacent compartments and allow other compartments to shrink to get more space.
|
protectedvirtual |
Adjust the sizes of the compartments after our bounds changed.
void JPartition::ReadGeometry | ( | std::istream & | input | ) |
Read in sizes, min sizes, elastic index and adjust ourselves.
This only works if the number of compartments and the total size of the object are the same.
|
protectedpure virtual |
Implemented in JXHorizDockPartition, JXHorizPartition, JXVertDockPartition, and JXVertPartition.
bool JPartition::SetCompartmentSize | ( | const JIndex | index, |
const JCoordinate | reqSize | ||
) |
Adjusts the adjacent compartments to make space.
Returns false if there isn't enough space available.
void JPartition::SetCompartmentSizes | ( | const JArray< JCoordinate > & | sizes | ) |
Adjust the size of each compartment.
|
inline |
Use index=0 to make all of the compartments shrink and expand by the same amount.
|
protected |
|
inline |
|
inline |
|
protectedpure virtual |
Implemented in JXHorizPartition, and JXVertPartition.
void JPartition::WriteGeometry | ( | std::ostream & | output | ) | const |
Write out sizes, min sizes, elastic index.
We have to write out an ending delimiter that is never used anywhere else so we can at least ignore the data if we can't read the given version or there is some other error.
|
static |