The Interface Kit Table of Contents

SplitPane

Derived from: BView

Declared in: SplitPane.h

Library: NONE

Allocation: Constructor only

Summary


A SplitPane if exactly what you think it is. It s View that has been split, you can add two Views to it. This is nice for things like Mail/News readers or something like ImageShow. (Which this class was originaly writen for) So it has lots of usefull stuff.
Now how do you use it. Well, ok. Its prity simple. You creat two view that you want to be the left/right or top/bottom. Then you creat the SplitPane with them as parameters. By defualt the split pane is B_VERTICAL (meaning the bar gets moved left/right). If you want to change that you can SetAlignment().
	BView *ViewOne;
	BView *ViewTwo;
	...
	BRect b = Bounds();
 	SplitPane *SP = new SplitPane(b,ViewOne,ViewTwo,B_FOLLOW_ALL_SIDES);
	SP->SetAlignment(B_HORIZONTAL);
	AddChild(SP);

Thats prity much it. All the B_FOLLOW_this that or the other is handeld by the splitpane. Also if as you can see you can change between Horizontal and Vertical layout pritty easy (SetAlignment). There is also lots of nice little methods that let you change things like the size of the Bar or programaticly change its location.

And if all of this is not enought. YOU HAVE THE SOURCE. hehe. So if you don't like how somethig is done or you want to change something - you can. Now a quick note on useing my/changed source in your programs. I dont realy care if you use this or not. But if you do use it please give credit on some readme some place. I realy Have worked hard on all this and the docs too.

Changeing the source - If you feel that there is a bug (which there are) or you feel that some BIG mistake has been made or mabey you just want to fix up something and make it much better than I did. Wonderfull. One thing. Send me your updates so that I can put them all together so the main source stays up-to-date. We should all benifit from features people add. Thanks again for you time.

YNOP

Constructor and Destructor


SplitPane

SplitPane(BRect frame, BView *one, BView *two, uint32 Mode )



This is the constructor .. weeee fun ...


Static Functionis


MemberFunctions


AddChildOne, AddChildTwo

AddChildOne(BView *one)

AddChildTwo(BView *two)



Add A Child to the left/right or top/bottom. One conrisponds to left/top and two is right/bottom. Adding a new view detaches the old one and ataches the new one. So if you have the new view already attached to something this will crash most likely :)


SetAlignment, GetAlignment

void SetAlignment(uint a )

uint GetAlignment( )



Sets/Returns wheather we are horizontal or Vertical. We use the standard B_HORIZONTAL and B_VERTICAL flags for this


SetBarPosition, GetBarPosition

void SetBarPosition(int i )

int GetBarPosition( )



Sets the location of the bar. (we do no bounds checking for you so if its off the window thats your problem)


SetBarThickness, GetBarThickness

void SetBarThickness(int i )

int GetBarThickness( )



Sets/Returns how thick the bar that the user grabs should be.


SetJump GetJump

void SetJump(int i )

int GetJump( )



Sets or returns the amount of jump the bar has when it is moved. This can also be though of as snap. The bar will start at 0 and jump(snap) to everry J pixels.


HasViewOne, HasViewTwo

bool HasViewOne( )

bool HasViewTwo( )



Returns true if the corisponding view is not NULL.


SetViewOneDetachable, SetViewTwoDetachable,
IsViewOneDetachable, IsViewTwoDetachable

void SetViewOneDetachable(bool b )

void SetViewTwoDetachable(bool b )

bool SetViewOneDetachable( )

bool SetViewTwoDetachable( )



Sets wheather View one is detachable from the slider view and from the app. This will creat a window that is detached (floating) from the app, or returns wheather the view is detachable.


SetEditable, IsEditable

void SetEditable(bool b )

bool SetEditable( )



Tells the view if the users is alowed to open the configuration window for the splitpane view (open by double clicking on the bar)


SetViewInsetBy, SetViewInsetBy

void SetViewInsetBy(int i )

int GetViewInsetBy( )



Sets the about of padding around each view within the SplitPane


SetMinSizeOne, SetMinSizeTwo,
GetMinSizeOne, GetMinSizeTwo

void SetMinSizeOne(int i )

void SetMinSizeTwo(int i )

int GetMinSizeOne( )

int GetMinSizeTwo( )



This gets/sets the minimum size that View can be. if the user trys to go past this .. we just stop. By default the minimum size is set to 0 (zero) so the user can put the slider anywhere.


SetBarLocked, IsBarLocked

void SetBarLocked(bool b )

bool IsBarLocked( )



Locks the bar from being moved by the User. The system can still move the bar (via SetBarPosition)


SetBarAlignmentLocked, IsBarAlignmentLocked

void SetBarAlignmentLocked(bool b )

bool IsBarAlignmentLocked( )



Locks the alignment of the bar. The user can no longer toggle between Horizontal and Vertical Slider bar. Again you can still progomaticly set the position how ever you want.


SetState, GetState

void SetState(BMessage *state )

BMessage* GetState( )



GetState gets the Total state of the bar, alignment, size, position and many other things that are required to fully capture the state of the SplitPane. We pack all of this into a cute little BMessage so that it is esally expandable and can be saved off easyaly too. The SplitPane System does not however save the state for you. Your program must grab the state and save it in its config file.

SetState sets the state of the SplitPane from a BMessage like the one recived from GetState(). This is one of three ways the user can rebuild the state of the SplitPane. The second is to simply send the SplitPane the state message, it is the same as calling SetState but it ashyncronouse. The third way is to use all the Get/Set methouds for each element of the SplitPane, this way is long and boarding. I suggest you just send the View a message :)





This has been a gift from YNOP. I hope that you have gotten something out of this.
Copyright © 1999 YNOP Talton