Release Notes Table of Contents | Release Notes Index

# The Interface Kit

## Mouse Acceleration

Declared in: interface/InterfaceDefs.h

### get_mouse_acceleration() , set_mouse_acceleration()

`status_t` `get_mouse_acceleration(int32 *``accel`)
`status_t` `set_mouse_acceleration(int32` `accel`)

These new functions let you get and set the "non-linear mouse speed scalar." The higher the acceleration factor, the farther the mouse travels as the user increases mouse velocity. An acceleration of 0 means the mouse's velocity isn't taken into consideration—if the user moves the (physical) mouse one inch, the cursor on-screen moves the same distance no matter how fast the user moved the mouse. The default acceleration is about 65000. The upper practical limit depends on who your mouse is, but 1000000 is probably about as high as you ever want to go.

Note that mouse acceleration is independent of mouse speed (see `get_mouse_speed()`). Currently, there's no user UI for setting mouse acceleration, only mouse speed.

## U I Colors

Declared in: interface/InterfaceDefs.h

`enum` `color_which` { `B_PANEL_BACKGROUND_COLOR`, `B_MENU_BACKGROUND_COLOR`, `B_MENU_SELECTION_BACKGROUND_COLOR`, new `B_MENU_ITEM_TEXT_COLOR`, new `B_MENU_SELECTED_ITEM_TEXT_COLOR`, new `B_WINDOW_TAB_COLOR`, `B_KEYBOARD_NAVIGATION_COLOR`, `B_DESKTOP_COLOR` };

The `color_which` constants represent the colors that are used by the Be UI. Of these colors, `B_MENU_SELECTION_BACKGROUND_COLOR`, `B_MENU_ITEM_TEXT_COLOR`, and `B_MENU_SELECTED_ITEM_TEXT_COLOR` are new. Use `ui_color()` to convert a `color_which` to an `rgb_color`.

## B ChannelControl and B ChannelSlider

Declared in: interface/ChannelControl.h

Declared in: interface/ChannelSlider.h

The new BChannelControl class (which derives from BControl) is an abstract class for UI objects that want to control more than one "channel" of values, such as a stereo volume control, or an rgb slider trio. Each of the channels has its own independent value. BChannelControl values are `int32`.

The most important BChannelControl member functions are:

- `SetChannelCount()` sets the number of channels that the object will control.

- `SetValueFor()` sets the current value for a given channel.

- `SetLimitsFor()` sets the minimum and maximum values for a given channel

- `SetLimitLabelsFor()` sets the labels that display the minimum and maximum values.

- `SupportsIndividualLimits()` must be implemented by every BChannelControl subclass. If the subclass supports independent channel value limits (and labels), then the function should be implemented to return `true`. If every channel is restricted to the same value range (and the same limit labels), the function should return false.

When the user manipulates a BChannelControl object, the object adds an array of `int32` values (one per channel) to the "be:channel_value" field of the BMessage that's sent to the object's target.

BChannelSlider is an implementation of BChannelControl that draws a (horizontal or vertical) slider for each channel. When the user clicks or drags the control with the first mouse button, all of the channels snap to the same value and drag together. The second mouse button moves the channel sliders independently of each.

## B Menu

Declared in: interface/Menu.h

BMenu provides a new mechanism whereby you can track the user's movements within your menu—without having to write a BMenu subclass. Instead, you provide a "tracking hook" that's invoked whenever the mouse moves while your menu is open.

### SetTrackingHook()

`void` `SetTrackingHook(menu_tracking_hook *`func, `void *`state`)`

Sets the callback function that's called when the object is tracking the mouse. Any mouse movement will cause func to be invoked—it isn't just invoked when the mouses moves to a new menu items (for example). The state data is passed as an argument to func. Note that state is not copied.

### menu_tracking_hook

`typedef bool` (*`` `menu_tracking_hook` )(`BMenu *`, `void *`)

Protocol for the menu-tracking hook function. The first argument is the BMenu that's being tracked; the second argument is the state argument that was passed to `SetTrackingHook()`. If the function returns `true`, the BMenu stops tracking the mouse; if it returns `false`, the tracking continues.

## B OptionControl and B OptionPopUp

Declared in: interface/OptionControl.h

Declared in: interface/OptionPopUp.h

The BOptionControl class (which derives from BControl) is an abstract class that associates a set of names with a set of values. The names are displayed to the user; when the user selects a name, the corresponding value is returned in the value-changed message (in the normal "be:value" field). The options in a BOptionControl object are mutually exclusive.

The most important member functions are:

- `AddOption()` adds a name/value pair.

- `SelectOptionFor()` selects an option given a name or a value.

- `SelectedOption()` is an abstract functions that returns (directly) the index of the currently selected option, and returns (by reference) the option's name and value. Each subclass must implement this function.

The BOptionPopUp class is an implementation of BOptionControl that presents the options in a pop up menu.

## B Region

Declared in: interface/Menu.h

### BRegion()

`BRegion(const BRect` rect`)`

New BRegion constructor creates a region that matches the bounds of the given rect.

## B Screen

Declared in: interface/Screen.h

### ProposeMode()

This is the new name for the previously-existing `ProposeDisplayMode()` function. The latter name is deprecated.

### GetMode() , SetMode()

`status_t` `GetMode(uint32` workspace, `display_mode *`mode`)`
`status_t` `SetMode(uint32` workspace, `display_mode *`mode, `bool` makeDefault = `false``)`

These two functions are workspace-specific versions of the previously-existing `GetMode()` and `SetMode()` functions. A workspace is indentified by its index (0-based). The old (non-workspace) versions work on the current workspace.

## B Slider

Declared in: interface/Slider.h

Slap your controls into an upright position—BSliders can now slide up and down.

### BSlider

`BSlider(`...,`orientation` posture, ...`)`

A new version of the BSlider constructor takes an additional posture argument that can be `B_HORIZONTAL` or `B_VERTICAL`. Sliders are horizontal by default.

### hash_mark_location

enum `hash_mark_location` { ..., `B_HASH_MARKS_LEFT` = 1, `B_HASH_MARKS_RIGHT` = 2, ... };

These two new values are accepted by the `SetHashMarks()` function to declare the presence of the right and left hash marks.

### Orientation() , SetOrientation()

`orientation` `Orientation(void``)`
`virtual void` `SetOrientation(orientation` which`)`

These new functions return and set the slider's orientation as `B_HORIZONTAL` or `B_VERTICAL`.

### BarThickness() , SetBarThickness()

`float` `BarThickness(void``)`
`virtual void` `SetBarThickness(float` thickness`)`

These new functions return and set the thickness, in pixels, of the slider's "bar" (the track that the thumb slides along).

## B TextView

Declared in: interface/TextView.h

### HideTyping() , IsTypingHidden()

`void` `HideTyping(bool` hideIt`)`
`bool` `IsTypingHidden(void``) const`

`HideTyping(true)` tells the object to print an asterisk for each keystroke, thereby hiding the actual text typed. Perfect for password panels and other paranoia.

## B View

Declared in: interface/View.h

### SetViewCursor()

`void` `SetViewCursor(const BCursor *`cursor, `bool` sync=`true``)`

Sets the cursor that's displayed when the mouse enters this views bounds. If sync is `true`, the function doesn't return until the cursor has actually been changed; otherwise, the function returns immediately.

Release Notes Table of Contents | Release Notes Index

The B e Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..