FSView

 

Derived from: none

Declared in: FSView.h

Library: none


Overview

Base class to help do font-sensitive layout of GUI components, as well as language localization by allowing the programmer to programmatically create the GUI components using the user's font preferences, and the components will create themselves at the minimum size required to hold the contents in the selected font. Also, many BeOS classes include a buffer zone around them, typically used to render a keyboard navigation focus indicator box, which isn't usually shown. Therefore, these classes also introduce the notion of a "visual frame," i.e. the frame of what the user perceives to be the edge of the GUI component. The visual frame is used to align FSViews to one another, either programmatically or using the Align() function. For GUI components with a label to the left of the main component, the FSLeftLabelView provides facilities to Align() the divider.

 


Member Functions


Align()

 
      static void Align(FSView** views, int32 num_views, bool align_left = true,
            bool align_right = true, bool space_vertically = true, float v_spacing = 5);
      static void Align(FSView** views, int32 num_views_x, int32 num_views_y, float v_spacing = 5,
            float h_spacing = 7, bool even_x = false, bool even_y = true, bool resize_h = false,
            bool resize_v = false)
 

Aligns the FSViews specified in views.

With the first version, if align_left is true, the left edges are aligned. If align_right is true, all views' right edges will be expanded to line up with the right edge of the view which extends the farthest to the right. If space_vertically is true, the position of labelled_views[0] is used as the starting point, and each subsequent view in the labelled_views array will be moved such that there are v_spacing empty pixels between its top and the bottom of the preceding view.

The second version is used to align a grid of FSViews. views should be ordered x0y0,x1y0, ... xny0, x0y1, ... x1y1, ... xny1, ... x0yn, x1yn, ... xnyn. If even_x is true, each column is evenly spaced, otherwise columns are packed to minimum width to fit all elements in the column on a per-column basis. The same applies to even_y. The position of views[0] is used as the starting point. If resize_h or resize_v is specified, the views are resized along the appropriate axis to be uniformly sized.


VisualWidth(), VisualHeight() , VisualLeft() , VisualRight() , VisualTop() , VisualBottom() , VisualPosition() , VisualFrame() , SetVisualWidth() , SetVisualHeight() , SetVisualSize() , MoveToVisualPosition()

 
      virtual float VisualWidth()
      virtual float VisualHeight()
      virtual float VisualLeft() = 0
      virtual float VisualRight() = 0
      virtual float VisualTop() = 0
      virtual float VisualBottom() = 0
      virtual BPoint VisualPosition()
      virtual BRect VisualFrame()
      virtual void SetVisualWidth(float width) = 0
      virtual void SetVisualHeight(float height) = 0
      virtual void SetVisualSize(float width, float height) = 0
      virtual void MoveToVisualPosition(BPoint visual_position) = 0
 

Functions to return information about or set the size and position of the FSView using its visual frame: the frame of what the user perceives to be the edge of the GUI component. Derived classes must implement the pure virtual methods. The others make use of these pure virtual methods and need not be overridden. Note that all of the FSView-derived classes provided with Santa's Gift Bag already have the necessary methods implemented and can be used as-is.


By Brian Tietz

Copyright 2000

Bug reports (including documentation errors) and feature requests can be sent to briant@timelinevista.com.