The Layout Library: MDividable

Derived from: none

Declared in: <MDividable.h>


Overview

An MDividable is an abstract class that provides an interface for aligning objects that can be "divided". Currently this includes MTextControl and Mpopup, both of which have a label on the left, and a data-entry part on the right.


Constructor and Destructor


MDividable is a trivial class, and therefore has a trivial (default) constructor and destructor.


Member Functions


DivideSameAs()

virtual void DivideSameAs(MDividable *dividable)=0

This function must be implemented by classes derived from MDividable, and should make the object note that it needs to be divided in exactly the same way as the object pointed to by dividable. Note that no checking for size is done. It is assumed that the object of which you call this function can be divided in the requested way. You will not normally call this function directly, but will instead call the global DivideSame() function instead.


LabelWidth()

virtual int32 LabelWidth()=0

This function must be implemented by classes derived from MDividable, and should return the width of the label part of the object.


Global Functions


DivideSame()

void DivideSame(MView *div1, MDividable *div2, ...)

This global function is a convenient shortcut for calling DivideSame on all objects you want to align. It takes a NULL-terminated list of MViews (which should also be MDividables), and will align them so that the seperation between label and data-entry part is the same for all objects. If you change the label of one of the objects later on, you should call this function again.



Copyright © 1997 Marco Nelissen (marcone@xs4all.nl) All rights reserved.

Be, BeOS, BeBox, BeWare, GeekPort, the Be logo, the BeOS logo, roColour, Beatware and Beatware painter are trademarks or registered trademarks of their respective owners.