os::Splitter Class Reference
[The Syllable Graphical User Interface API]

Splitter View. More...

Inheritance diagram for os::Splitter:

os::View os::Handler List of all members.

Public Member Functions

 Splitter (const Rect &cFrame, const String &cTitle, View *pView1, View *pView2, orientation eOrientation=HORIZONTAL, uint32 nResizeMask=CF_FOLLOW_LEFT|CF_FOLLOW_TOP, uint32 nFlags=WID_WILL_DRAW|WID_CLEAR_BACKGROUND)
 Spliter constructor.
virtual ~Splitter ()
virtual void SplitChanged ()
 Hook called when the split bar position has changed.
void SetSplitRatio (float vRatio)
 Set split ratio.
float GetSplitRatio () const
 Get split ratio.
void SetSplitLimits (float fMinSize1=0, float fMinSize2=0)
 Set limits in the position of the split bar.
void SetOrientation (os::orientation eOrientation)
ViewSeparatorView () const
 Get the separator view.
float GetSplitPosition () const
 Return the separator position.
float GetSeparatorWidth () const
 Return the separator width.
void SetSeparatorWidth (float fWidth)
 Set the separator width.
void AdjustLayout ()
 Refresh the layout of the splitter.
void SplitBy (float fValue)
 Change the position of the split bar.
void SplitTo (float fValue)
 Set the position of the split bar.
virtual void MouseMove (const Point &cNewPos, int nCode, uint32 nButtons, Message *pcData)
 Hook called by the system when the mouse is moved.
virtual void MouseUp (const Point &cPosition, uint32 nButtons, Message *pcData)
 Hook called by the system when a mouse button is release.
virtual void KeyDown (const char *pzString, const char *pzRawString, uint32 nQualifiers)
 Hook called by the system when a key is pressed while the view has focus.
virtual void FrameSized (const Point &cDelta)
 Virtual hook called by the system when the view is resized.
virtual os::Point GetPreferredSize (bool bLargest) const

Friends

class os_priv::SplitterSeparator

Classes

class  Private

Detailed Description

An Splitter object stacks two subviews within one view so that the user can change their relative sizes. By default, the separator bar between the views is horizontal, so the views are one on top of the other. To have vertical split bars (so the views are side by side), use the method Splitter::SetDirection. The rest of this section assumes you have horizontal split bars and gives information on vertical split bars in parentheses.

The Splitter resizes its subviews so that each subview is the same width (or height) as the Splitter view, and the total of the subviews' heights (or widths), plus the separator's thicknesses, is equal to the height (or width) of the Splitter. The Splitter positions its subviews so that the first subview is at the top (or left) of the Splitter frame. The user can set the height (or width) of two subviews by moving a horizontal (or vertical) bar called the separator, which makes one subview smaller and the other larger.

Author:
Sebastien Keim ([email protected])


Constructor & Destructor Documentation

Splitter::Splitter ( const Rect cFrame,
const String cTitle,
View pView1,
View pView2,
orientation  eOrientation = HORIZONTAL,
uint32  nResizeMask = CF_FOLLOW_LEFT|CF_FOLLOW_TOP,
uint32  nFlags = WID_WILL_DRAW|WID_CLEAR_BACKGROUND 
)

Description:
Notes:
Warning:
Parameters:
cFrame The position and size of the splitter view
cTitle The title of the splitter
pView1 The top(left) subview
pView2 The bottom(right) subview
eOrientation The direction of the separator
nResizeMask View resize mask
nFlags View flags
See also:
Author:
Sebastien Keim ([email protected])

Splitter::~Splitter (  )  [virtual]


Member Function Documentation

void Splitter::SplitChanged (  )  [virtual]

Description:
Notes:
The hook is only called when the split bar was moved by the user, not when the object was modified by a call to the Splitter::SplitBy or Splitter::SplitTo methods.
Warning:
Returns:
See also:
Author:
Sebastien Keim ([email protected])

void Splitter::SetSplitRatio ( float  vRatio  ) 

Description:
Set the ratio between the two views of the splitter, eg. a ratio of 0.5 will make the two views share the size equally and position the splitter bar in the middle. Note that min/max sizes still apply, so you can't set the ratio to values that would violate those sizes.
Parameters:
vRatio The ratio View1 / (View1 + View2)
Author:
Henrik Isaksson ([email protected])

float Splitter::GetSplitRatio (  )  const

Description:
Get the split ratio.
See also:
SetSplitRatio()
Author:
Henrik Isaksson ([email protected])

void Splitter::SetSplitLimits ( float  fMinSize1 = 0,
float  fMinSize2 = 0 
)

Description:
By default the split bar can be moved to the boders of the splitter. this method allow to limit the range of the split bar moves.
Notes:
Warning:
This limits are only used for user interaction. They are never checked when you change the layout programaticaly.
Parameters:
nMinSize1 minimal size that can take the top(left) view
nMinSize2 minimal size that can take the bottom(right) view
Author:
Sebastien Keim ([email protected])

void os::Splitter::SetOrientation ( os::orientation  eOrientation  ) 

View * Splitter::SeparatorView (  )  const

Description:
Return the separator view. This can be usefull for sample if you want to place icons on the separator.
Notes:
Warning:
Parameters:
\return 
See also:
Author:
Sebastien Keim ([email protected])

float Splitter::GetSplitPosition (  )  const

Description:
Return the separator position
Notes:
Warning:
Parameters:
\return the top(left) view height(width)
See also:
Author:
Sebastien Keim ([email protected])

float Splitter::GetSeparatorWidth (  )  const

Description:
Notes:
Warning:
Parameters:
\return 
See also:
Author:
Sebastien Keim ([email protected])

void Splitter::SetSeparatorWidth ( float  fWidth  ) 

Description:
The layout is automatically refreshed.
Notes:
Warning:
Parameters:
\return 
See also:
Author:
Sebastien Keim ([email protected])

void Splitter::AdjustLayout (  ) 

Description:
This method refreshes the subviews' positions. It tries to keep the relative sizes of the subviews when the separator position is computed.
Notes:
You should call this method when you change the subviews' frames.
Warning:
Parameters:
\return 
See also:
Author:
Sebastien Keim ([email protected])

void Splitter::SplitBy ( float  fValue  ) 

Description:
Move the separator bar. For instance, a value of -100 will move the separator bar 100 pixels to the left (or up, if the splitter is vertical).
Notes:
Warning:
This method works with pixel values, normally you should use SetSplitRatio().
Parameters:
fValue relative value of the deplacement
Returns:
See also:
SetSplitRatio()
Author:
Sebastien Keim ([email protected])

void Splitter::SplitTo ( float  fValue  ) 

Description:
Move the separator.
Notes:
Warning:
This method works with pixel values, normally you should use SetSplitRatio().
Parameters:
fValue new height(width) of the top(left) view
Returns:
See also:
Author:
Sebastien Keim ([email protected])

void Splitter::MouseMove ( const Point cNewPos,
int  nCode,
uint32  nButtons,
Message pcData 
) [virtual]

Description:
This member is called from the window thread whenever the mouse is moved above the view or if the view has focus.
Oveload this member if your view need to handle mouse-move events.
The default implementation of this member will call MouseMove() on it's parent view if one exists.
Parameters:
cNewPos New mouse position given in the views coordinate system.
nCode Enter/exit code. This is MOUSE_ENTERED when the mouse first enter the view, MOUSE_EXITED when the mouse leaves the view, MOUSE_INSIDE whenever the mouse move withing the boundary of the view and MOUSE_OUTSIDE when the mouse move outside the view (will only happen if the view has focus).
nButtons Bitmask telling which buttons that are currently pressed. Bit 0 is button 1 (left), bit 1 is button 2 (right), and bit 2 is button 3 (middle), and so on.
pcData Pointer to a Message object containing the dragged data if the user is in the middle of a drag and drop operation. Otherwise this pointer is NULL. Look at BeginDrag() for a more detailed description of the drag and drop system.
See also:
MouseDown(), MouseUp(), WheelMoved(), BeginDrag()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

void Splitter::MouseUp ( const Point cPosition,
uint32  nButtons,
Message pcData 
) [virtual]

Description:
This member is called from the window thread whenever a mouse button is released above the view. You can overload this member if your view need to know about mouse-up events or if your view support drag and drop.
If mouse-up was the result of ending a drag and drop operation the pcData member will point to a Message containing the dragged data. Look at BeginDrag() for a more detailed description of the drag and drop system.
The default implementation of this member will call MouseDown() on it's parent view if one exists.
Parameters:
cPosition Mouse position in the views coordinate system at the time the mouse was pressed.
nButtons Index of the pressed button. Buttons start at 1 for the left button, 2 for the right button, 3 for the middle button. Additional buttons might be supported by the mouse driver and will then be assigned numbers from 4 and up.
pcData Pointer to a Message object containing the dragged data if this mouse-up was the end of a drag and drop operation. If no data was dragged it will be NULL.
See also:
MouseDown(), MouseMove(), WheelMoved()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

void Splitter::KeyDown ( const char *  pzString,
const char *  pzRawString,
uint32  nQualifiers 
) [virtual]

Description:
Overload this member if your view need to handle keyboard input. This member is called to allow the view to handle M_KEY_DOWN messages. The most common members are exctracted from the message and passed as parameters but you might need to obtain the raw message with os::Looper::GetCurrentMessage() and find some members yourself if you the data you needed are not passed in.
For example if you need the raw key-code for the pressed key you will have to lookup the "_raw_key" member from the message.
Parameters:
pzString String containing a single UTF-8 encoded character. This is the character generated by the pressed key according to the current keymap accounting for any qualifiers that might be pressed.
pzRawString Same as pzString except that the key is converted without accounting for qualifiers. Ie. if 'A' is pressed while pressing <SHIFT> pzString will contain 'A' and pzRawString will contain 'a'.
nQualifiers Bitmask describing which qualifiers that was active when the key was pressed.
See also:
KeyUp(), os::Looper::GetCurrentMessage()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

void Splitter::FrameSized ( const Point cDelta  )  [virtual]

Description:
Overload this member if you need to know when the view is resized.
Note:
This member is called after the view is resized. If you need the old size you can subtract the cDelta calue from the current size.
Parameters:
cDelta The distance the bottom/right corner was moved relative to the upper/left corner.
See also:
FrameMoved(), SetFrame, ResizeBy(), ResizeTo()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

Point Splitter::GetPreferredSize ( bool  bLargest  )  const [virtual]

Reimplemented from os::View.


Friends And Related Function Documentation

friend class os_priv::SplitterSeparator [friend]


Generated on Sat May 9 22:51:45 2009 for Syllable higlevel API by  doxygen 1.5.1