JX Application Framework
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
JPartition Class Referenceabstract

#include <JPartition.h>

Inheritance diagram for JPartition:
[legend]

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~JPartition()

JPartition::~JPartition ( )
virtual

◆ JPartition()

JPartition::JPartition ( const JArray< JCoordinate > &  sizes,
const JIndex  elasticIndex,
const JArray< JCoordinate > &  minSizes 
)
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.

Member Function Documentation

◆ AdjustCompartmentsAfterDrag()

void JPartition::AdjustCompartmentsAfterDrag ( const JCoordinate  coord)
protected

Shift space from one compartment to the other.

◆ AdjustCompartmentsAfterDragAll()

void JPartition::AdjustCompartmentsAfterDragAll ( const JCoordinate  coord)
protected

Expand one compartment at the expense of all the others.

◆ CreateCompartmentObject()

virtual void JPartition::CreateCompartmentObject ( const JIndex  index,
const JCoordinate  position,
const JCoordinate  size 
)
protectedpure virtual

Implemented in JXPartition.

◆ DeleteCompartment()

void JPartition::DeleteCompartment ( const JIndex  index)

Remove the compartment and adjust the adjacent compartments to fill the gap.

◆ DeleteCompartmentObject()

virtual void JPartition::DeleteCompartmentObject ( const JIndex  index)
protectedpure virtual

Implemented in JXPartition.

◆ FindCompartment()

bool JPartition::FindCompartment ( const JCoordinate  coord,
JIndex index 
) const

If the point is between compartments i and i+1, the index returned is i.

◆ GetCompartmentCount()

JSize JPartition::GetCompartmentCount ( ) const
inline

◆ GetCompartmentSize()

JCoordinate JPartition::GetCompartmentSize ( const JIndex  index) const
inline

◆ GetCompartmentSizes()

const JArray< JCoordinate > & JPartition::GetCompartmentSizes ( ) const
inline

◆ GetElasticIndex()

bool JPartition::GetElasticIndex ( JIndex index) const
inline

◆ GetMinCompartmentSize()

JCoordinate JPartition::GetMinCompartmentSize ( const JIndex  index) const
inline

◆ GetMinCompartmentSizes()

const JArray< JCoordinate > & JPartition::GetMinCompartmentSizes ( ) const
inline

◆ GetMinTotalSize()

JCoordinate JPartition::GetMinTotalSize ( ) const

◆ GetTotalSize()

virtual JCoordinate JPartition::GetTotalSize ( ) const
protectedpure virtual

Implemented in JXHorizPartition, and JXVertPartition.

◆ InsertCompartment()

bool JPartition::InsertCompartment ( const JIndex  index,
const JCoordinate  reqSize,
const JCoordinate  minSize 
)
protected

Adjusts the adjacent compartments to make space.

Returns false if there isn't enough space available for at least minSize.

◆ PrepareToDrag()

void JPartition::PrepareToDrag ( const JCoordinate  coord,
JCoordinate minDragCoord,
JCoordinate maxDragCoord 
)
protected

Prepare to drag dividing line between two adjacent compartments.

◆ PrepareToDragAll()

void JPartition::PrepareToDragAll ( const JCoordinate  coord,
JCoordinate minDragCoord,
JCoordinate maxDragCoord 
)
protected

Prepare to drag dividing line between two adjacent compartments and allow other compartments to shrink to get more space.

◆ PTBoundsChanged()

void JPartition::PTBoundsChanged ( )
protectedvirtual

Adjust the sizes of the compartments after our bounds changed.

◆ ReadGeometry()

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.

◆ SaveGeometryForLater()

virtual bool JPartition::SaveGeometryForLater ( const JArray< JCoordinate > &  sizes)
protectedpure virtual

◆ SetCompartmentSize()

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.

◆ SetCompartmentSizes()

void JPartition::SetCompartmentSizes ( const JArray< JCoordinate > &  sizes)

Adjust the size of each compartment.

◆ SetElasticIndex()

void JPartition::SetElasticIndex ( const JIndex  index)
inline

Use index=0 to make all of the compartments shrink and expand by the same amount.

◆ SetElasticSize()

void JPartition::SetElasticSize ( )
protected

◆ SetMinCompartmentSize()

void JPartition::SetMinCompartmentSize ( const JIndex  index,
const JCoordinate  minSize 
)
inline

◆ SetMinCompartmentSizes()

void JPartition::SetMinCompartmentSizes ( const JArray< JCoordinate > &  sizes)
inline

◆ UpdateCompartmentSizes()

virtual void JPartition::UpdateCompartmentSizes ( )
protectedpure virtual

Implemented in JXHorizPartition, and JXVertPartition.

◆ WriteGeometry()

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.

Member Data Documentation

◆ kDragRegionSize

const JCoordinate JPartition::kDragRegionSize = 5
static

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