Haiku API Bindings
InterfaceKit
Not logged in

Documentation | InterfaceKit

SYNOPSIS

Perl

use HaikuR1::InterfaceKit qw(run_be_about);

Python

from HaikuR1.InterfaceKit import run_be_about

DESCRIPTION

Exposes functions from the Interface Kit.

For more information on the Interface Kit, see the Be Book introduction and the Haiku Book introduction.

> warning!

Some of the functions in this module can change the user's configuration. Use them with caution and never change the user's configuration without user approval.

CLASSES AND SUBMODULES

Views and Controls

Menus

structures

Layout

Gradients

COLOR FUNCTIONS

bitmaps_support_space

Returns a set of flags which can be tested against the Bitmap support constants. 0 means no support.

Perl

bitmaps_support_space($space);

Python

bitmaps_support_space(space)

get_pixel_size_for

Returns three values describing the pixel size for the give color space:

* an integer, the number of bytes it takes to store a pixel; if multiple pixels are stored in a byte, this value will be 1.

* an integer, the row alignment; each row of pixel data consists of a multiple of this number of bytes.

* an integer, the number of pixels per "chunk" of data; that is, if pixel data is "mixed" (i.e., interleaved, non-contiguous), how many pixels are stored in the smallest run of bytes that can completely describe a pixel; if this value is 1, each pixel is completely described before the next pixel data begins.

Perl

get_pixel_size_for($space);

Python

get_pixel_size_for(space)

keyboard_navigation_color

Returns the keyboard navigation color as an rgb_color.

Perl

keyboard_navigation_color();

Python

keyboard_navigation_color()

system_colors

Returns the system color map.

Perl

system_colors();

Python

system_colors()

tint_color

Tints a color; that is, it multiplies each color value by the given floating point number to return a darker color (for values less than 1) or a lighter color (for values greater than 1).

Returns the new color.

Haiku also has several tint constants.

Perl

tint_color($color, $tint);

Python

tint_color(color, tint)

ui_color

set_ui_color

Get or set the UI color

Perl

ui_color($which);
set_ui_color($which, $color);

Python

ui_color(which)
set_ui_color(which, color)

KEYBOARD FUNCTIONS

Key info

get_key_info

Returns a key_info structure containing information about the state of the keyboard. Signals an error if the results are unreliable.

Perl

get_key_info();

Python

get_key_info()

Key map

get_key_map

Returns a key_map structure containing information about the current key map.

Perl

get_key_map();

Python

get_key_map()

Keyboard id

get_keyboard_id

Gets the id for the keyboard currently attached to the computer.

According to the Be Book, the id "for the standard 101-key PC keyboard—and for keyboards with a similar set of keys—is 0x83ab".

Perl

get_keyboard_id();

Python

get_keyboard_id()

Modifiers

modifiers

get_modifier_key

set_modifier_key

set_keyboard_locks

modifiers returns an integer that can be tested against the modifier key constants to determine which modifiers are in effect. The modifier is in effect when a modifier key is being held down or when the corresponding keyboard lock is set.

get_modifier_key and set_modifier_key do what you expect, but be aware that they operate on key codes. See key_info for more information on key codes.

Perl

modifiers();
get_modifier_key($modifier);
set_modifier_key($modifier, $key);
set_keyboard_locks($modifiers);

Python

modifiers()
get_modifier_key(modifier)
set_modifier_key(modifier, key)
set_keyboard_locks(modifiers)

Repeated keys

get_key_repeat_rate

set_key_repeat_rate

get_key_repeat_delay

set_key_repeat_delay

These functions do what you expect. They may signal an error.

Perl

get_key_repeat_rate();
set_key_repeat_rate($rate);
get_key_repeat_delay();
set_key_repeat_delay($delay);

Python

get_key_repeat_rate()
set_key_repeat_rate(rate)
get_key_repeat_delay()
set_key_repeat_delay(delay)

MOUSE FUNCTIONS

First-click behavior

accept_first_click

set_accept_first_click

Gets or sets the first click behavior; if this value is true, the first click on an inactive window will be sent the application; otherwise, the first click will merely make the window active, and additional clicks are required before click events are sent to the application.

Perl

accept_first_click();
set_accept_first_click($acceptFirstClick);

Python

accept_first_click()
set_accept_first_click(acceptFirstClick)

get_mouse

Returns two items: a Point indicating where on the screen the mouse is, and and an integer indicating which buttons are pressed. This integer can be tested against the mouse button constants.

Perl

get_mouse();

Python

get_mouse()

get_mouse_bitmap

Returns two items: a Bitmap containing the cursor image and a Point containing the hotspot.

Perl

get_mouse_bitmap();

Python

get_mouse_bitmap()

Mouse map

get_mouse_map

set_mouse_map

Gets or sets the mouse_map.

Perl

get_mouse_map();
set_mouse_map($map);

Python

get_mouse_map()
set_mouse_map(map)

Mouse mode

mouse_mode

set_mouse_mode

focus_follows_mouse_mode

set_focus_follows_mouse_mode

focus_follows_mouse

set_focus_follows_mouse

The first four functions get or set the given mode.

focus_follows_mouse and set_focus_follows_mouse are older functions; in their current implementations, focus_follows_mouse returns true if the mouse mode is B_FOCUS_FOLLOWS_MOUSE and false otherwise, while set_focus_follows_mouse sets the mouse mode to B_FOCUS_FOLLOWS_MOUSE no matter what input you pas to it.

Perl

mouse_mode();
set_mouse_mode($mode);
focus_follows_mouse_mode();
set_focus_follows_mouse_mode($mode);
focus_follows_mouse();
set_focus_follows_mouse($follow);

Python

mouse_mode()
set_mouse_mode(mode)
focus_follows_mouse_mode()
set_focus_follows_mouse_mode(mode)
focus_follows_mouse()
set_focus_follows_mouse(follow)

Mouse speed

get_click_speed

set_click_speed

get_mouse_speed

set_mouse_speed

get_mouse_acceleration

set_mouse_acceleration

Click speed is the maximum time in microseconds between clicks of a double mouse click. That is, if more than this amount of time passes between clicks, the clicks will be reported as two single clicks instead of a double click.

Mouse speed is the speed of the cursor on the screen relative to the speed of the mouse across the mouse pad (or other surface). The maximum value is 20.

Mouse acceleration is the rate at which the cursor begins and stops moving when the mouse begins and stops moving across the mouse pad (or other surface.) That is, it is the rate at which the mouse accelerates from 0 to the mouse speed.

Perl

get_click_speed();
set_click_speed($speed);
get_mouse_speed();
set_mouse_speed($speed);
get_mouse_acceleration();
set_mouse_acceleration($speed);

Python

get_click_speed()
set_click_speed(speed)
get_mouse_speed()
set_mouse_speed(speed)
get_mouse_acceleration()
set_mouse_acceleration(speed)

Mouse type

get_mouse_type

set_mouse_type

The "type" of the mouse is the number of buttons it has.

Perl

get_mouse_type();
set_mouse_type($type);

Python

get_mouse_type()
set_mouse_type(type)

WORKSPACE FUNCTIONS

Active workspace

current_workspace

activate_workspace

Gets or sets the currently active workspace.

Perl

current_workspace();
activate_workspace($workspace);

Python

current_workspace()
activate_workspace(workspace)

Workspace count

count_workspaces

set_workspace_count

Gets or sets the number of workspaces.

Perl

count_workspaces();
set_workspace_count($count);

Python

count_workspaces()
set_workspace_count(count)

OTHER FUNCTIONS

get_deskbar_frame

Returns a Rect containing the deskbar frame.

Perl

get_deskbar_frame();

Python

get_deskbar_frame()

set_screen_space

Sets the resolution and colordepth of the given screen.

Perl

set_screen_space($index, $resolution, $save);

Python

set_screen_space(index, resolution, save)

Scroll bar info

get_scroll_bar_info

set_scroll_bar_info

Gets or sets the scroll bar settings.

Perl

get_scroll_bar_info();
set_scroll_bar_info($info);

Python

get_scroll_bar_info()
set_scroll_bar_info(info)

idle_time

Returns the time in microseconds since the user last used the mouse or keyboard.

Perl

idle_time();

Python

idle_time()

Panels

run_select_printer_panel

run_add_printer_panel

run_be_about

Runs the given panel and returns immediately, without waiting for the user to close the panel.

Perl

run_select_printer_panel();
run_add_printer_panel();
run_be_about();

Python

run_select_printer_panel()
run_add_printer_panel()
run_be_about()

CONSTANTS

Alignment

Perl

use HaikuR1::InterfaceKit qw(:alignment)

Python

Python does not support export tags.

Alpha functions

Perl

use HaikuR1::InterfaceKit qw(:alpha_function)

Python

Python does not support export tags.

Bitmap drawing options

Perl

use HaikuR1::InterfaceKit qw(:bitmap_drawing_options)

Python

Python does not support export tags.

Bitmap support

Perl

use HaikuR1::InterfaceKit qw(:bitmap_support)

Python

Python does not support export tags.

Bitmap tiling

Perl

use HaikuR1::InterfaceKit qw(:bitmap_tiling)

Python

Python does not support export tags.

Border style

Perl

use HaikuR1::InterfaceKit qw(:border_style)

Python

Python does not support export tags.

Buffer layout

Perl

use HaikuR1::InterfaceKit qw(:buffer_layout)

Python

Python does not support export tags.

Buffer orientation

Perl

use HaikuR1::InterfaceKit qw(:buffer_orientation)

Python

Python does not support export tags.

Button width

Perl

use HaikuR1::InterfaceKit qw(:button_width)

Python

Python does not support export tags.

Cap modes

Perl

use HaikuR1::InterfaceKit qw(:cap_modes)

Python

Python does not support export tags.

Color spaces

Perl

use HaikuR1::InterfaceKit qw(:color_space)

Python

Python does not support export tags.

The *_LITTLE constants are synonyms of the similarly named constants at the top of this list, while the *_BIG constants are the same formats, but stored as big-endian integers.

According to the Be Book, the YCB*, YUV*, UVL*, and LAB* constants are currently unsupported.

UI Colors

Perl

use HaikuR1::InterfaceKit qw(:ui_colors)

Python

Python does not support export tags.

Drawing modes

Perl

use HaikuR1::InterfaceKit qw(:drawing_modes)

Python

Python does not support export tags.

Fixed screen space

Perl

use HaikuR1::InterfaceKit qw(:fixed_screen)

Python

Python does not support export tags.

Icon bitmap options

Perl

use HaikuR1::InterfaceKit qw(:icon_bitmap)

Python

Python does not support export tags.

Icon bitmap flags

Perl

use HaikuR1::InterfaceKit qw(:icon_bitmap_flags)

Python

Python does not support export tags.

Join modes

Perl

use HaikuR1::InterfaceKit qw(:join_modes)

Python

Python does not support export tags.

Keymap tables

Perl

use HaikuR1::InterfaceKit qw(:keymap)

Python

Python does not support export tags.

Keys

Perl

use HaikuR1::InterfaceKit qw(:keys)

Python

Python does not support export tags.

Layout spacing

Perl

use HaikuR1::InterfaceKit qw(:layout_spacing)

Python

Python does not support export tags.

Modifier keys

Perl

use HaikuR1::InterfaceKit qw(:modifiers)

Python

Python does not support export tags.

See https://www.haiku-os.org/legacy-docs/bebook/TheKeyboard_ModifierKeys.html for more information on modifier keys.

Mouse modes

Perl

use HaikuR1::InterfaceKit qw(:mode_mouse)

Python

Python does not support export tags.

Mouse focus modes

Perl

use HaikuR1::InterfaceKit qw(:mode_focus_follows_mouse)

Python

Python does not support export tags.

Orientation

Perl

use HaikuR1::InterfaceKit qw(:orientation)

Python

Python does not support export tags.

Overlay options

Perl

use HaikuR1::InterfaceKit qw(:overlay_options)

Python

Python does not support export tags.

Patterns

Perl

use HaikuR1::InterfaceKit qw(:patterns)

Python

Python does not support export tags.

See pattern for more information about patterns.

Polygon filling

Perl

use HaikuR1::InterfaceKit qw(:polygon_filling)

Python

Python does not support export tags.

Source alpha

Perl

use HaikuR1::InterfaceKit qw(:source_alpha)

Python

Python does not support export tags.

Tinting

Perl

use HaikuR1::InterfaceKit qw(:tinting)

Python

Python does not support export tags.

Transparency

Perl

use HaikuR1::InterfaceKit qw(:transparency)

Python

Python does not support export tags.

Utf8 characters

Perl

use HaikuR1::InterfaceKit qw(:utf8)

Python

Python does not support export tags.

Vertical alignment

Perl

use HaikuR1::InterfaceKit qw(:vertical_alignment)

Python

Python does not support export tags.

Other constants

These constants do not have an export tag.