The Interface Kit: Constants and Defined Types

This section lists the various constants and types that the Interface Kit defines to support the work done by its principal classes. The Kit is a framework of cooperating classes; almost all of its programming interface can be found in the class descriptions presented in previous sections of this chapter. Most of the constants and types listed here have already been explained in the descriptions of class member functions and global nonmember functions. Only one or two have not yet been mentioned in full detail. All of them are noted here and briefly described. If a more lengthy discussion is to be found under a class or a function, you'll be referred to that location.

Constants are listed first, followed by defined types. Constants that are defined as part of an enumeration type are presented with the other constants, rather than with the type. They're listed in the "Constants" section under the type name.


Constants


alert_type Constants

Declared in: <interface/Alert.h>

Enumerated constant
B_EMPTY_ALERT
B_INFO_ALERT
B_IDEA_ALERT
B_WARNING_ALERT
B_STOP_ALERT

These constants designate the various types of alert panels that are recognized by the system. The type corresponds to an icon that's displayed in the alert window.

See also: the BAlert constructor


alignment Constants

Declared in: <interface/InterfaceDefs.h>

Enumerated constant
B_ALIGN_LEFT
B_ALIGN_RIGHT
B_ALIGN_CENTER

These constants define the alignment data type. They determine how lines of text are aligned by BTextView and BStringView objects.

See also: BTextView::SetAlignment()


button_width Constants

Declared in: <interface/Alert.h>

Enumerated constant
B_WIDTH_AS_USUAL
B_WIDTH_FROM_LABEL
B_WIDTH_FROM_WIDEST

These constants define the button_width type. They determine how the width of the buttons in an alert panel will be set --whether they're set to an standard (minimal) width, a width just sufficient to accommodate the button's own label, or a width sufficient to accommodate the widest label of all the buttons.

See also: the BAlert constructor


Character Constants

Declared in: <interface/InterfaceDefs.h>

Enumerated constant Character value
B_BACKSPACE 0x08 (same as '\b')
B_ENTER 0x0a (same as '\n')
B_RETURN 0x0a (synonym for B_ENTER)
B_SPACE 0x20 (same as ' ')
B_TAB 0x09 (same as '\t')
B_ESCAPE 0x1b
B_LEFT_ARROW 0x1c
B_RIGHT_ARROW 0x1d
B_UP_ARROW 0x1e
B_DOWN_ARROW 0x1f
B_INSERT 0x05
B_DELETE 0x7f
B_HOME 0x01
B_END 0x04
B_PAGE_UP 0x0b
B_PAGE_DOWN 0x0c
B_FUNCTION_KEY 0x10

These constants stand for the ASCII characters they name. Constants are defined only for characters that normally don't have visible symbols.

See also: Function Key Constants below


color_space Constants

Declared in: <interface/InterfaceDefs.h>

Enumerated constant Meaning
B_MONOCHROME_1_BIT One bit per pixel, where 1 is black and 0 is white.
B_GRAYSCALE_8_BIT 256 gray values, where 255 is black and 0 is white.
B_COLOR_8_BIT Colors specified as 8-bit indices into the color map.
B_RGB_16_BIT < undefined for the current release >
B_RGB_32_BIT Colors as 8-bit red, green, and blue components.

These constants define the color_space data type. A color space describes two properties of bitmap images:

See the Colors section in the chapter introduction for a fuller explanation of the color spaces currently defined for this type, particularly B_RGB_32_BIT.

See also: Colors , the BBitmap class


Control Values

Declared in: <interface/Control.h>

Enumerated constant Value
B_CONTROL_ON 1
B_CONTROL_OFF 0

These constants define the bipolar states of a typical control device.

See also: BControl::SetValue()


Cursor Transit Constants

Declared in: <interface/View.h>

Enumerated constant Meaning
B_ENTERED_VIEW The cursor has just entered a view.
B_INSIDE_VIEW The cursor has moved within the view.
B_EXITED_VIEW The cursor has left the view

These constants describe the cursor's transit through a view. Each MouseMoved() notification includes one of these constants as an argument, to inform the BView whether the cursor has entered the view, moved while inside the view, or exited the view.

See also: BView::MouseMoved()


Dead-Key Mapping

Declared in: <interface/InterfaceDefs.h>

Enumerated constants
B_CONTROL_TABLE
B_OPTION_CAPS_SHIFT_TABLE
B_OPTION_CAPS_TABLE
B_OPTION_SHIFT_TABLE
B_OPTION_TABLE
B_CAPS_SHIFT_TABLE
B_CAPS_TABLE
B_SHIFT_TABLE
B_NORMAL_TABLE

These constants determine which combinations of modifiers can cause a key to be the "dead" member of a two-key combination.

See also: system_key_map()


drawing_mode Constants

Declared in: <interface/InterfaceDefs.h>

Enumerated constant Enumerated constant
B_OP_COPY B_OP_ADD
B_OP_OVER B_OP_SUBTRACT
B_OP_ERASE B_OP_MIN
B_OP_INVERT B_OP_MAX
B_OP_BLEND

These constants define the drawing_mode data type. The drawing mode is a BView graphics parameter that determines how the image being drawn interacts with the image already in place in the area where it's drawn. The various modes are explained under Drawing Modes in the chapter introduction.

See also: Drawing Modes , BView::SetDrawingMode()


Font Name Length

Declared in: <interface/InterfaceDefs.h>

Defined constant Value
B_FONT_NAME_LENGTH 64

This constant defines the maximum length of a font name. It's used in the definition of the font_name type.

See also: font_name under "Defined Types" below


Function Key Constants

Declared in: <interface/InterfaceDefs.h>

Enumerated constant Enumerated constant
B_F1_KEY B_F9_KEY
B_F2_KEY B_F10_KEY
B_F3_KEY B_F11_KEY
B_F4_KEY B_F12_KEY
B_F5_KEY B_PRINT_KEY (the "Print Screen" key)
B_F6_KEY B_SCROLL_KEY (the "Scroll Lock" key)
B_F7_KEY B_PAUSE_KEY
B_F8_KEY

These constants stand for the various keys that are mapped to the B_FUNCTION_KEY character. When the B_FUNCTION_KEY character is reported in a key-down event, the application can determine which key produced the character by testing the key code against these constants. (Control-p also produces the B_FUNCTION_KEY character.)

See also: Character Mapping of the introduction to this chapter


Interface Messages

Declared in: <app/AppDefs.h>

Enumerated constant Enumerated constant
B_ZOOM B_KEY_DOWN
B_MINIMIZE B_KEY_UP
B_WINDOW_RESIZED B_MOUSE_DOWN
B_WINDOW_MOVED B_MOUSE_UP
B_WINDOW_ACTIVATED B_MOUSE_MOVED
B_QUIT_REQUESTED B_VIEW_RESIZED
B_SCREEN_CHANGED B_VIEW_MOVED
B_WORKSPACE_ACTIVATED B_VALUE_CHANGED
B_WORKSPACES_CHANGED B_PULSE
B_SAVE_REQUESTED B_PANEL_CLOSED

These constants identify interface messages--system messages that are delivered to BWindow objects. Each constant conveys an instruction to do something in particular ( B_ZOOM) or names a type of event (B_KEY_DOWN).

See also: Interface Messages in the introduction to this chapter


menu_bar_border Constants

Declared in: <interface/MenuBar.h>

Enumerated constant Meaning
B_BORDER_FRAME Put a border around the entire frame rectangle.
B_BORDER_CONTENTS Put a border around the group of items only.
B_BORDER_EACH_ITEM Put a border around each item.

These constants can be passed as an argument to BMenuBar's SetBorder() function.

See also: BMenuBar::SetBorder()


menu_layout Constants

Declared in: <interface/Menu.h>

Enumerated constant Meaning
B_ITEMS_IN_ROW Menu items are arranged horizontally, in a row.
B_ITEMS_IN_COLUMN Menu items are arranged vertically, in a column.
B_ITEMS_IN_MATRIX Menu items are arranged in a custom fashion.

These constants define the menu_layout data type. They distinguish the ways that items can be arranged in a menu or menu bar --they can be laid out from end to end in a row like a typical menu bar, stacked from top to bottom in a column like a typical menu, or arranged in some custom fashion like a matrix.

See also: the BMenu and BMenuBar constructors


Modifier States

Declared in: <interface/InterfaceDefs.h>

Enumerated constant Enumerated constant
B_SHIFT_KEY B_OPTION_KEY
B_LEFT_SHIFT_KEY B_LEFT_OPTION_KEY
B_RIGHT_SHIFT_KEY B_RIGHT_OPTION_KEY
B_CONTROL_KEY B_COMMAND_KEY
B_LEFT_CONTROL_KEY B_LEFT_COMMAND_KEY
B_RIGHT_CONTROL_KEY B_RIGHT_COMMAND_KEY
B_CAPS_LOCK B_MENU_KEY
B_SCROLL_LOCK
B_NUM_LOCK

These constants designate the Shift, Option, Control, Command, and Menu modifier keys and the lock states set by the Caps Lock, Scroll Lock, and Num Lock keys. They're typically used to form a mask that describes the current, or required, modifier states.

For each variety of modifier key, there are constants that distinguish between the keys that appear at the left and right of the keyboard, as well as one that lumps both together. For example, if the user is holding the left Control key down, both B_CONTROL_KEY and B_LEFT_CONTROL_KEY will be set in the mask.

See also: modifiers(), BWindow::AddShortcut(), the BMenu constructor


Mouse Buttons

Declared in: <interface/View.h>

Enumerated constant
B_PRIMARY_MOUSE_BUTTON
B_SECONDARY_MOUSE_BUTTON
B_TERTIARY_MOUSE_BUTTON

These constants name the mouse buttons. Buttons are identified, not by their physical positions on the mouse, but by their roles in the user interface.

See also: BView::GetMouse() , set_mouse_map()


orientation Constants

Declared in: <interface/InterfaceDefs.h>

Enumerated constant
B_HORIZONTAL
B_VERTICAL

These constants define the orientation data type that distinguishes between the vertical and horizontal orientation of graphic objects. It's currently used only to differentiate scroll bars.

See also: the BScrollBar and BScrollView classes


Pattern Constants

Declared in: <interface/InterfaceDefs.h>

      const pattern B_SOLID_HIGH = { 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff } 
      const pattern B_SOLID_LOW = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } 
      const pattern B_MIXED_COLORS 
                  = { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 }

These constants name the three standard patterns defined in the Interface Kit.

B_SOLID_HIGH is a pattern that consists of the high color only. It's the default pattern for all BView drawing functions that stroke lines and fill shapes.

B_SOLID_LOW is a pattern with only the low color. It's used mainly to erase images
(to replace them with the background color).

B_MIXED_COLORS alternates pixels between the high and low colors in a checkerboard pattern. The result is a halftone midway between the two colors. This pattern can produce fine gradations of color, especially when the high and low colors are set to two colors that are already quite similar.

See also: Patterns of the chapter introduction, the pattern defined type below


Resizing Modes

Declared in: <interface/View.h>

Defined constants
B_FOLLOW_LEFT
B_FOLLOW_RIGHT
B_FOLLOW_LEFT_RIGHT
B_FOLLOW_H_CENTER
B_FOLLOW_TOP
B_FOLLOW_BOTTOM
B_FOLLOW_TOP_BOTTOM
B_FOLLOW_V_CENTER
B_FOLLOW_ALL
B_FOLLOW_NONE

These constants are used to set the behavior of a view when its parent is resized. They're explained under the BView constructor.

See also: the BView constructor, BView::SetResizingMode()


Screen Spaces

Declared in: <interface/InterfaceDefs.h>

Enumerated constant Enumerated constant
B_8_BIT_640x480 B_32_BIT_640x480
B_8_BIT_800x600 B_32_BIT_800x600
B_8_BIT_1024x768 B_32_BIT_1024x768
B_8_BIT_1152x900 B_32_BIT_1152x900
B_8_BIT_1280x1024 B_32_BIT_1280x1024
B_8_BIT_1600x1200 B_32_BIT_1600x1200
B_16_BIT_640x480 B_8_BIT_640x400
B_16_BIT_800x600
B_16_BIT_1024x768
B_16_BIT_1152x900
B_16_BIT_1280x1024
B_16_BIT_1600x1200

These constants are used to configure the screen--to set its depth and the size of the pixel grid it displays--as well as to report which configurations are possible. < 16-bit depths are not currently supported. >

See also: set_screen_space(), get_screen_info()


Scroll Bar Constants

Declared in: <interface/ScrollBar.h>

Defined constant
B_H_SCROLL_BAR_HEIGHT
B_V_SCROLL_BAR_WIDTH

These constants record the recommended thickness of scroll bars. They should be used to help define the frame rectangles passed to the BScrollBar constructor.

See also: the BScrollBar class


Tracking Constants

Declared in: <interface/View.h>

Enumerated constant Meaning
B_TRACK_WHOLE_RECT Drag the whole rectangle around.
B_TRACK_RECT_CORNER Drag only the left bottom corner of the rectangle.

These constants determines how BView's BeginRectTracking() function permits the user to drag (or drag out) a rectangle.

See also: BView::BeginRectTracking()


Transparency Constants

Declared in: <interface/InterfaceDefs.h>

      const uchar B_TRANSPARENT_8_BIT 
      const rgb_color B_TRANSPARENT_32_BIT 

These constants set transparent pixel values in a bitmap image. B_TRANSPARENT_8_BIT designates a transparent pixel in the B_COLOR_8_BIT color space, and B_TRANSPARENT_32_BIT designates a transparent pixel in the B_RGB_32_BIT color space.

Transparency is explained the Drawing Modes section of the chapter introduction. Drawing modes other than B_OP_COPY preserve the destination image where a source bitmap is transparent.

See also: Drawing Modes , the BBitmap class, BView::SetViewColor()


View Flags

Declared in: <interface/View.h>

Enumerated constant Meaning
B_FULL_UPDATE_ON_RESIZE Include the entire view in the clipping region.
B_WILL_DRAW Allow the BView to draw.
B_PULSE_NEEDED Report pulse events to the BView.
B_FRAME_EVENTS Report view-resized and view-moved events.

These constants can be combined to form a mask that sets the behavior of a BView object. They're explained in more detail under the class constructor. The mask is passed to the constructor, or to the SetFlags() function.

See also: the BView constructor, BView::SetFlags()


Window Areas

Declared in: <interface/Window.h>

Enumerated constant
B_UNKNOWN_AREA
B_TITLE_AREA
B_CONTENT_AREA
B_RESIZE_AREA
B_CLOSE_AREA
B_ZOOM_AREA

These constants name the various parts of a window. They're used to designate the area where the cursor is located in messages that report the cursor's movement over a window.

See also: B_MOUSE_MOVED in the Message Protocols appendix


Window Flags

Declared in: <interface/Window.h>

Enumerated constant Enumerated constant
B_NOT_MOVABLE B_NOT_CLOSABLE
B_NOT_H_RESIZABLE B_NOT_ZOOMABLE
B_NOT_V_RESIZABLE B_NOT_MINIMIZABLE
B_NOT_RESIZABLE B_WILL_FLOAT
B_WILL_ACCEPT_FIRST_CLICK

These constants set the behavior of a window. They can be combined to form a mask that's passed to the BWindow constructor.

See also: the BWindow constructor


window_type Constants

Declared in: <interface/Window.h>

Enumerated constant Meaning
B_MODAL_WINDOW The window is a modal window.
B_BORDERED_WINDOW The window has a border but no title tab.
B_TITLED_WINDOW The window has a border and a title tab.
B_DOCUMENT_WINDOW The window has a tab and borders fit for scroll bars.

These constants describe the various kinds of windows that can be requested from the Application Server.

See also: the BWindow constructor


Workspace Constants

Declared in: <interface/Window.h>

Defined constant
B_CURRENT_WORKSPACE
B_ALL_WORKSPACES

These constants are used--along with designations of specific workspaces --to associate a set of one or more workspaces with a BWindow.

See also: the BWindow constructor, BWindow::SetWorkspaces()


Defined Types


alert_type

Declared in: <interface/Alert.h>

      typedef enum {. . .} alert_type 

These constants name the various types of alert panel.

See also: "alert_type Constants" on page 335 above, the BAlert constructor


alignment

Declared in: <interface/InterfaceDefs.h>

      typedef enum {. . .} alignment 

Alignment constants determine where lines of text are placed in a view.

See also: "alignment Constants" on page 336 above, BTextView::SetAlignment()


button_width

Declared in: <interface/Alert.h>

      typedef enum {. . .} button_width 

These constants name the methods that can be used to determine how wide to make the buttons in an alert panel.

See also: "button_width Constants" on page 336 above, the BAlert constructor


color_map

Declared in: <interface/InterfaceDefs.h>

      typedef struct {
            long id;
            rgb_color color_list[256];
            uchar inversion_map[256];
            uchar index_map[32768];
         } color_map 

This structure contains information about the color context provided by the Application Server. There's one and only one color map for all applications connected to the Server. Applications can obtain a pointer to the color map by calling the global system_colors() function. See that function for information on the various fields.

See also: system_colors()


color_space

Declared in: <interface/InterfaceDefs.h>

      typedef enum {. . .} color_space 

Color space constants determine the depth and interpretation of bitmap images. They're described under Colors in the introduction.

See also: "color_space Constants" on page 337 above, Colors , the BBitmap class


drawing_mode

Declared in: <interface/InterfaceDefs.h>

      typedef enum {. . .} drawing_mode 

The drawing mode determines how source and destination images interact. The various modes are explained in the chapter introduction under Drawing Modes.

See also: Drawing Modes , "drawing_mode Constants" on page 338 above


edge_info

Declared in: <interface/View.h>

      typedef struct {
            float left;
            float right;
         } edge_info 

This structure records information about the location of a character outline within the horizontal space allotted to the character. Edges separate one character from adjacent characters on the left and right. They're explained under the GetCharEdges() function in the BView class.

See also: BView::GetCharEscapements(), BView::GetFontInfo()


font_info

Declared in: <interface/View.h>

      typedef struct {
            font_name name;
            float size;
            float shear;
            float rotation;
            float ascent;
            float descent;
            float leading;
         } font_info 

This structure holds information about a BView's current font. Its fields are explained under the GetFontInfo() function in the BView class.

See also: BView::GetFontInfo(), BView::SetFontName()


font_name

Declared in: <interface/InterfaceDefs.h>

      typedef char font_name[FONT_NAME_LENGTH + 1] 

This type defines a string long enough to hold the name of a font-- 64 characters plus the null terminator.

See also: BView::SetFontName(), get_font_name()


key_info

Declared in: <interface/View.h>

      typedef struct {
            ulong char_code;
            ulong key_code;
            ulong modifiers;
            uchar key_states[16];
         } key_info  

This structure is used by BView's GetKeys() function to return all known information about what the user is currently doing on the keyboard.

See also: BView::GetKeys() , Keyboard Information in the introduction to this chapter


key_map

Declared in: <interface/InterfaceDefs.h>

      typedef struct {
            ulong version;
            ulong caps_key;
            ulong scroll_key;
            ulong num_key;
            ulong left_shift_key;
            ulong right_shift_key;
            ulong left_command_key;
            ulong right_command_key;
            ulong left_control_key;
            ulong right_control_key;
            ulong left_option_key;
            ulong right_option_key;
            ulong menu_key;
            ulong lock_settings;
            ulong control_map[128];
            ulong option_caps_shift_map[128];
            ulong option_caps_map[128];
            ulong option_shift_map[128];
            ulong option_map[128];
            ulong caps_shift_map[128];
            ulong caps_map[128];
            ulong shift_map[128];
            ulong normal_map[128];
            ulong acute_dead_key[32];
            ulong grave_dead_key[32];
            ulong circumflex_dead_key[32];
            ulong dieresis_dead_key[32];
            ulong tilde_dead_key[32];
            ulong acute_tables;
            ulong grave_tables;
            ulong circumflex_tables;
            ulong dieresis_tables;
            ulong tilde_tables;
         } key_map 

This structure maps the physical keys on the keyboard to their functions in the user interface. It holds the tables that assign characters to key codes, set up dead keys, and determine which keys function as modifiers. There's just one key map shared by all applications running on the same machine. It's returned by the system_key_map() function.

See also: system_key_map()


menu_bar_border

Declared in: <interface/MenuBar.h>

      typedef enum {. . .} menu_bar_border 

This type enumerates the ways that a menu bar can be bordered.

See also: BMenuBar::SetBorder(), "menu_bar_border Constants" above


menu_info

Declared in: <interface/Menu.h>

      typedef struct {
            float font_size;
            font_name font;
            rgb_color background_color;
            long separator;
            bool click_to_open;
            bool triggers_always_shown;
         } menu_info 

This structure records the user's menu preferences.

See also: set_menu_info() , the BMenu class


menu_layout

Declared in: <interface/Menu.h>

      typedef enum {. . .} menu_layout 

This type distinguishes the various ways that items can arranged in a menu or menu bar.

See also: the BMenu class, "menu_layout Constants" above


mouse_map

Declared in: <interface/InterfaceDefs.h>

      typedef struct {
            ulong left;
            ulong right;
            ulong middle;
         } mouse_map 

This structure maps mouse buttons to their roles as the B_PRIMARY_MOUSE_BUTTON, B_SECONDARY_MOUSE_BUTTON, or B_TERTIARY_MOUSE_BUTTON.

See also: set_mouse_map()


orientation

Declared in: <interface/InterfaceDefs.h>

      typedef enum {. . .} orientation 

This type distinguishes between the B_VERTICAL and B_HORIZONTAL orientation of scroll bars.

See also: the BScrollBar and BScrollView classes


pattern

Declared in: <interface/InterfaceDefs.h>

      typedef struct {
            uchar data[8]; 
         } pattern 

A pattern is a arrangement of two colors--the high color and the low color --in an 8-pixel by 8-pixel square. Pixels are specified in rows, with one byte per row and one bit per pixel. Bits marked 1 designate the high color; those marked 0 designate the low color. An example and an illustration are given under Patterns of the introduction to this chapter.

See also: "Pattern Constants" above, Patterns in the chapter introduction


print_file_header

Declared in: <interface/PrintJob.h>

      typedef struct {
            long version;
            long page_count;
            long _reserved_1_;
            long _reserved_2_;
            long _reserved_3_;
            long _reserved_4_;
            long _reserved_5_;
         } print_file_header 

This structure defines the header information for a print job. < Although declared publicly, it currently is used only internally by the BPrintJob class. >


rgb_color

Declared in: <interface/InterfaceDefs.h>

      typedef struct {
            uchar red;
            uchar green;
            uchar blue;
            uchar alpha;
         } rgb_color 

This type specifies a full 32-bit color. Each component can have a value ranging from a minimum of 0 to a maximum of 255.

< The alpha component, which is designed to specify the coverage of the color (how transparent or opaque it is), is currently ignored. However, an rgb_color can be made completely transparent by assigning it the special value, B_TRANSPARENT_32_BIT. >

See also: BView::SetHighColor()


screen_info

Declared in: <interface/InterfaceDefs.h>

      typedef struct {
            color_space mode;
            BRect frame;
            ulong spaces;
            float min_refresh_rate;
            float max_refresh_rate;
            float refresh_rate;
            uchar h_position;
            uchar v_position;
            uchar h_size;
            uchar v_size;
         } screen_info 

This structure holds information about a screen. Its fields are explained under the get_screen_info() global function.

See also: get_screen_info()


scroll_bar_info

Declared in: <interface/InterfaceDefs.h>

      typedef struct {
            bool proportional;
            bool double_arrows;
            long knob;
            long min_knob_size;
         } scroll_bar_info 

This structure captures the user's preferences for how scroll bars should behave and appear.

See also: set_scroll_bar_info(), the BScrollBar class


symbol_set_name

Declared in: <interface/InterfaceDefs.h>

      typedef font_name symbol_set_name 

This type defines a string long enough to hold the name of a symbol set --64 characters plus the null terminator. The names of symbol sets are subject to the same length constraint as the names of fonts, which is why this type is a redefinition of font_name.

See also: get_symbol_set_name()


window_type

Declared in: <interface/Window.h>

      typedef enum {. . .} window_type 

This type describes the various kinds of windows that can be requested from the Application Server.

See also: the BWindow constructor, "window_type Constants" on page 346 above






The Be Book, HTML Edition, for Developer Release 8 of the Be Operating System.

Copyright © 1996 Be, Inc. All rights reserved.

Be, the Be logo, BeBox, BeOS, BeWare, and GeekPort are trademarks of Be, Inc.

Last modified September 6, 1996.