* Cleaned up InterfaceDefs.h, added TODO about getting rid of declaring

_init_interface_kit_() in there.
* Moved private get_mode_parameter() into the BPrivate namespace.
* Renamed interface_misc.h to InterfacePrivate.h.
* Minor other cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24869 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-04-09 10:07:35 +00:00
parent 3daf03d3ab
commit cfc3fa87da
6 changed files with 250 additions and 239 deletions
+162 -161
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2006, Haiku, Inc.
* Copyright (c) 2001-2008, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
@@ -34,7 +34,7 @@ class BRect;
#endif
// key definitions
// Key definitions
struct key_info {
uint32 modifiers;
@@ -119,88 +119,6 @@ struct key_map {
uint32 tilde_tables;
};
struct mouse_map {
uint32 button[B_MAX_MOUSE_BUTTONS];
};
/*----------------------------------------------------------------*/
enum border_style {
B_PLAIN_BORDER,
B_FANCY_BORDER,
B_NO_BORDER
};
/*----------------------------------------------------------------*/
enum orientation {
B_HORIZONTAL,
B_VERTICAL
};
/*----------------------------------------------------------------*/
enum button_width {
B_WIDTH_AS_USUAL,
B_WIDTH_FROM_WIDEST,
B_WIDTH_FROM_LABEL
};
/*----------------------------------------------------------------*/
enum join_mode {
B_ROUND_JOIN = 0,
B_MITER_JOIN,
B_BEVEL_JOIN,
B_BUTT_JOIN,
B_SQUARE_JOIN
};
enum cap_mode {
B_ROUND_CAP=B_ROUND_JOIN,
B_BUTT_CAP=B_BUTT_JOIN,
B_SQUARE_CAP=B_SQUARE_JOIN
};
const float B_DEFAULT_MITER_LIMIT = 10.0F;
/*----------------------------------------------------------------*/
struct scroll_bar_info {
bool proportional;
bool double_arrows;
int32 knob;
int32 min_knob_size;
};
/*----------------------------------------------------------------*/
enum alignment {
B_ALIGN_LEFT,
B_ALIGN_RIGHT,
B_ALIGN_CENTER,
B_ALIGN_HORIZONTAL_CENTER = B_ALIGN_CENTER,
B_ALIGN_HORIZONTAL_UNSET = -1L,
B_ALIGN_USE_FULL_WIDTH = -2L
};
enum vertical_alignment {
B_ALIGN_TOP = 0x10L,
B_ALIGN_MIDDLE = 0x20,
B_ALIGN_BOTTOM = 0x30,
B_ALIGN_VERTICAL_CENTER = B_ALIGN_MIDDLE,
B_ALIGN_VERTICAL_UNSET = -1L,
B_ALIGN_NO_VERTICAL = B_ALIGN_VERTICAL_UNSET,
B_ALIGN_USE_FULL_HEIGHT = -2L
};
/*----------------------------------------------------------------*/
enum {
B_CONTROL_TABLE = 0x00000001,
B_OPTION_CAPS_SHIFT_TABLE = 0x00000002,
@@ -213,8 +131,7 @@ enum {
B_NORMAL_TABLE = 0x00000100
};
/*----------------------------------------------------------------*/
// modifiers
enum {
B_SHIFT_KEY = 0x00000001,
B_COMMAND_KEY = 0x00000002,
@@ -234,7 +151,91 @@ enum {
B_RIGHT_OPTION_KEY = 0x00008000
};
/*----------------------------------------------------------------*/
// Mouse definitions
struct mouse_map {
uint32 button[B_MAX_MOUSE_BUTTONS];
};
enum mode_mouse {
B_NORMAL_MOUSE = 0,
B_FOCUS_FOLLOWS_MOUSE = 1,
B_WARP_MOUSE = 3,
B_INSTANT_WARP_MOUSE = 7
};
// View orientation/alignment/style
enum border_style {
B_PLAIN_BORDER,
B_FANCY_BORDER,
B_NO_BORDER
};
enum orientation {
B_HORIZONTAL,
B_VERTICAL
};
enum button_width {
B_WIDTH_AS_USUAL,
B_WIDTH_FROM_WIDEST,
B_WIDTH_FROM_LABEL
};
struct scroll_bar_info {
bool proportional;
bool double_arrows;
int32 knob;
int32 min_knob_size;
};
enum alignment {
B_ALIGN_LEFT,
B_ALIGN_RIGHT,
B_ALIGN_CENTER,
B_ALIGN_HORIZONTAL_CENTER = B_ALIGN_CENTER,
B_ALIGN_HORIZONTAL_UNSET = -1L,
B_ALIGN_USE_FULL_WIDTH = -2L
};
enum vertical_alignment {
B_ALIGN_TOP = 0x10L,
B_ALIGN_MIDDLE = 0x20,
B_ALIGN_BOTTOM = 0x30,
B_ALIGN_VERTICAL_CENTER = B_ALIGN_MIDDLE,
B_ALIGN_VERTICAL_UNSET = -1L,
B_ALIGN_NO_VERTICAL = B_ALIGN_VERTICAL_UNSET,
B_ALIGN_USE_FULL_HEIGHT = -2L
};
// Line join and cap modes
enum join_mode {
B_ROUND_JOIN = 0,
B_MITER_JOIN,
B_BEVEL_JOIN,
B_BUTT_JOIN,
B_SQUARE_JOIN
};
enum cap_mode {
B_ROUND_CAP = B_ROUND_JOIN,
B_BUTT_CAP = B_BUTT_JOIN,
B_SQUARE_CAP = B_SQUARE_JOIN
};
const float B_DEFAULT_MITER_LIMIT = 10.0F;
// Bitmap and overlay constants
enum bitmap_tiling {
B_TILE_BITMAP_X = 0x00000001,
@@ -249,66 +250,8 @@ enum overlay_options {
B_OVERLAY_TRANSFER_CHANNEL = 0x00080000
};
/*----------------------------------------------------------------*/
status_t get_deskbar_frame(BRect *frame);
const color_map *system_colors();
status_t set_screen_space(int32 index, uint32 res,
bool stick = true);
status_t get_scroll_bar_info(scroll_bar_info *info);
status_t set_scroll_bar_info(scroll_bar_info *info);
status_t get_mouse_type(int32 *type);
status_t set_mouse_type(int32 type);
status_t get_mouse_map(mouse_map *map);
status_t set_mouse_map(mouse_map *map);
status_t get_click_speed(bigtime_t *speed);
status_t set_click_speed(bigtime_t speed);
status_t get_mouse_speed(int32 *speed);
status_t set_mouse_speed(int32 speed);
status_t get_mouse_acceleration(int32 *speed);
status_t set_mouse_acceleration(int32 speed);
status_t get_key_repeat_rate(int32 *rate);
status_t set_key_repeat_rate(int32 rate);
status_t get_key_repeat_delay(bigtime_t *delay);
status_t set_key_repeat_delay(bigtime_t delay);
uint32 modifiers();
status_t get_key_info(key_info *info);
void get_key_map(key_map **map, char **key_buffer);
status_t get_keyboard_id(uint16 *id);
void set_modifier_key(uint32 modifier, uint32 key);
void set_keyboard_locks(uint32 modifiers);
rgb_color keyboard_navigation_color();
int32 count_workspaces();
void set_workspace_count(int32 count);
int32 current_workspace();
void activate_workspace(int32 workspace);
bigtime_t idle_time();
void run_select_printer_panel();
void run_add_printer_panel();
void run_be_about();
void set_focus_follows_mouse(bool follow);
bool focus_follows_mouse();
enum mode_mouse {
B_NORMAL_MOUSE = 0,
B_FOCUS_FOLLOWS_MOUSE = 1,
B_WARP_MOUSE = 3,
B_INSTANT_WARP_MOUSE = 7
};
void set_mouse_mode(mode_mouse mode);
mode_mouse mouse_mode();
// Default UI Colors
enum color_which {
B_PANEL_BACKGROUND_COLOR = 1,
@@ -350,27 +293,85 @@ enum color_which {
B_WINDOW_INACTIVE_TEXT_COLOR = 24
};
rgb_color ui_color(color_which which);
void set_ui_color(const color_which &which,
const rgb_color &color);
rgb_color tint_color(rgb_color color, float tint);
extern "C" status_t _init_interface_kit_();
/* effects on standard gray level */
const float B_LIGHTEN_MAX_TINT = 0.0F; /* 216 --> 255.0 (255) */
const float B_LIGHTEN_2_TINT = 0.385F; /* 216 --> 240.0 (240) */
const float B_LIGHTEN_1_TINT = 0.590F; /* 216 --> 232.0 (232) */
// Color tinting
const float B_NO_TINT = 1.0F; /* 216 --> 216.0 (216) */
const float B_LIGHTEN_MAX_TINT = 0.0f; // 216 --> 255.0 (255)
const float B_LIGHTEN_2_TINT = 0.385f; // 216 --> 240.0 (240)
const float B_LIGHTEN_1_TINT = 0.590f; // 216 --> 232.0 (232)
const float B_DARKEN_1_TINT = 1.147F; /* 216 --> 184.2 (184) */
const float B_DARKEN_2_TINT = 1.295F; /* 216 --> 152.3 (152) */
const float B_DARKEN_3_TINT = 1.407F; /* 216 --> 128.1 (128) */
const float B_DARKEN_4_TINT = 1.555F; /* 216 --> 96.1 (96) */
const float B_DARKEN_MAX_TINT = 2.0F; /* 216 --> 0.0 (0) */
const float B_NO_TINT = 1.0f; // 216 --> 216.0 (216)
const float B_DARKEN_1_TINT = 1.147f; // 216 --> 184.2 (184)
const float B_DARKEN_2_TINT = 1.295f; // 216 --> 152.3 (152)
const float B_DARKEN_3_TINT = 1.407f; // 216 --> 128.1 (128)
const float B_DARKEN_4_TINT = 1.555f; // 216 --> 96.1 (96)
const float B_DARKEN_MAX_TINT = 2.0f; // 216 --> 0.0 (0)
// effects on standard gray level
const float B_DISABLED_LABEL_TINT = B_DARKEN_3_TINT;
const float B_HIGHLIGHT_BACKGROUND_TINT = B_DARKEN_2_TINT;
const float B_DISABLED_MARK_TINT = B_LIGHTEN_2_TINT;
status_t get_deskbar_frame(BRect* frame);
const color_map* system_colors();
status_t set_screen_space(int32 index, uint32 resolution,
bool save = true);
status_t get_scroll_bar_info(scroll_bar_info* info);
status_t set_scroll_bar_info(scroll_bar_info* info);
status_t get_mouse_type(int32* type);
status_t set_mouse_type(int32 type);
status_t get_mouse_map(mouse_map* map);
status_t set_mouse_map(mouse_map* map);
status_t get_click_speed(bigtime_t* speed);
status_t set_click_speed(bigtime_t speed);
status_t get_mouse_speed(int32* speed);
status_t set_mouse_speed(int32 speed);
status_t get_mouse_acceleration(int32* speed);
status_t set_mouse_acceleration(int32 speed);
status_t get_key_repeat_rate(int32* rate);
status_t set_key_repeat_rate(int32 rate);
status_t get_key_repeat_delay(bigtime_t* delay);
status_t set_key_repeat_delay(bigtime_t delay);
uint32 modifiers();
status_t get_key_info(key_info* info);
void get_key_map(key_map** _map, char** _keyBuffer);
status_t get_keyboard_id(uint16* _id);
void set_modifier_key(uint32 modifier, uint32 key);
void set_keyboard_locks(uint32 modifiers);
rgb_color keyboard_navigation_color();
int32 count_workspaces();
void set_workspace_count(int32 count);
int32 current_workspace();
void activate_workspace(int32 workspace);
bigtime_t idle_time();
void run_select_printer_panel();
void run_add_printer_panel();
void run_be_about();
void set_focus_follows_mouse(bool follow);
bool focus_follows_mouse();
void set_mouse_mode(mode_mouse mode);
mode_mouse mouse_mode();
rgb_color ui_color(color_which which);
void set_ui_color(const color_which& which, const rgb_color& color);
rgb_color tint_color(rgb_color color, float tint);
extern "C" status_t _init_interface_kit_();
// for convenience, should be removed including the friend declarations
// in Menu.h, ...
#endif // _INTERFACE_DEFS_H
@@ -0,0 +1,23 @@
/*
* Copyright 2007-2008, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stefano Ceccherini <[email protected]>
*/
#ifndef _INTERFACE_PRIVATE_H
#define _INTERFACE_PRIVATE_H
#include <SupportDefs.h>
namespace BPrivate {
bool get_mode_parameter(uint32 mode, int32& width, int32& height,
uint32& colorSpace);
} // namespace BPrivate
#endif // _INTERFACE_PRIVATE_H
@@ -1,20 +0,0 @@
/*
* Copyright 2007, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stefano Ceccherini <[email protected]>
*/
/** Various private functions and variables for the Interface Kit */
#ifndef __INTERFACE_MISC_H
#define __INTERFACE_MISC_H
#include <SupportDefs.h>
bool get_mode_parameter(uint32 mode, int32& width, int32& height, uint32& colorSpace);
#endif
+28 -25
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2007, Haiku.
* Copyright 2001-2008, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -9,6 +9,29 @@
*/
#include <Application.h>
#include <new>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <Alert.h>
#include <AppFileInfo.h>
#include <Cursor.h>
#include <Debug.h>
#include <Entry.h>
#include <File.h>
#include <Locker.h>
#include <MessageRunner.h>
#include <Path.h>
#include <PropertyInfo.h>
#include <RegistrarDefs.h>
#include <Resources.h>
#include <Roster.h>
#include <Window.h>
#include <AppMisc.h>
#include <AppServerLink.h>
#include <AutoLocker.h>
@@ -20,30 +43,9 @@
#include <ServerMemoryAllocator.h>
#include <ServerProtocol.h>
#include <Alert.h>
#include <AppFileInfo.h>
#include <Application.h>
#include <MessageRunner.h>
#include <Cursor.h>
#include <Debug.h>
#include <Entry.h>
#include <File.h>
#include <Locker.h>
#include <Path.h>
#include <PropertyInfo.h>
#include <RegistrarDefs.h>
#include <Resources.h>
#include <Roster.h>
#include <Window.h>
#include <new>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
using namespace BPrivate;
BApplication *be_app = NULL;
BMessenger be_app_messenger;
@@ -1227,8 +1229,9 @@ BApplication::_InitGUIContext()
if (error != B_OK)
return error;
// Initialize the IK after we have set be_app because of a construction of a
// AppServerLink (which depends on be_app) nested inside the call to get_menu_info.
// Initialize the IK after we have set be_app because of a construction
// of a AppServerLink (which depends on be_app) nested inside the call
// to get_menu_info.
error = _init_interface_kit_();
if (error != B_OK)
return error;
+13 -13
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007, Haiku. All Rights Reserved.
* Copyright 2002-2008, Haiku. All Rights Reserved.
* Copyright 2002-2005,
* Marcus Overhagen,
* Stefano Ceccherini (stefano.ceccherini@gmail.com),
@@ -10,33 +10,33 @@
*/
#include <Application.h>
#include <Screen.h>
#include <String.h>
#include <WindowScreen.h>
#include <new>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <new>
#include <input_globals.h>
#include <InputServerTypes.h> // For IS_SET_MOUSE_POSITION
#include <interface_misc.h>
#include <WindowPrivate.h>
#include <Application.h>
#include <Screen.h>
#include <String.h>
#include <AppServerLink.h>
#include <input_globals.h>
#include <InputServerTypes.h>
#include <InterfacePrivate.h>
#include <ServerProtocol.h>
#include <WindowPrivate.h>
using BPrivate::AppServerLink;
//#define TRACE_WINDOWSCREEN 1
#if TRACE_WINDOWSCREEN
#define CALLED() printf("%s\n", __PRETTY_FUNCTION__);
# define CALLED() printf("%s\n", __PRETTY_FUNCTION__);
#else
#define CALLED() ;
# define CALLED() ;
#endif
@@ -902,7 +902,7 @@ BWindowScreen::_GetModeFromSpace(uint32 space, display_mode *dmode)
int32 width, height;
uint32 colorSpace;
if (!get_mode_parameter(space, width, height, colorSpace))
if (!BPrivate::get_mode_parameter(space, width, height, colorSpace))
return B_BAD_VALUE;
for (uint32 i = 0; i < fModeCount; i++) {
+24 -20
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2006, Haiku, Inc.
* Copyright 2001-2008, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,23 +8,13 @@
* Axel Dörfler, axeld@pinc-software.de
*/
/** Global functions and variables for the Interface Kit */
/*! Global functions and variables for the Interface Kit */
#include <interface_misc.h>
#include <truncate_string.h>
#include <utf8_functions.h>
#include <InterfacePrivate.h>
#include <ApplicationPrivate.h>
#include <AppServerLink.h>
#include <ColorConversion.h>
#include <DefaultColors.h>
#include <InputServerTypes.h>
#include <input_globals.h>
#include <pr_server.h>
#include <ServerProtocol.h>
#include <ServerReadOnlyMemory.h>
#include <WidthBuffer.h>
#include <WindowInfo.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Font.h>
#include <InterfaceDefs.h>
@@ -35,9 +25,19 @@
#include <String.h>
#include <TextView.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ApplicationPrivate.h>
#include <AppServerLink.h>
#include <ColorConversion.h>
#include <DefaultColors.h>
#include <InputServerTypes.h>
#include <input_globals.h>
#include <pr_server.h>
#include <ServerProtocol.h>
#include <ServerReadOnlyMemory.h>
#include <truncate_string.h>
#include <utf8_functions.h>
#include <WidthBuffer.h>
#include <WindowInfo.h>
// Private definitions not placed in public headers
@@ -94,6 +94,8 @@ static const rgb_color _kDefaultColors[kNumColors] = {
const rgb_color* BPrivate::kDefaultColors = &_kDefaultColors[0];
namespace BPrivate {
/*!
Fills the \a width, \a height, and \a colorSpace parameters according
to the window screen's mode.
@@ -190,6 +192,8 @@ get_mode_parameter(uint32 mode, int32& width, int32& height, uint32& colorSpace)
return true;
}
} // namespace BPrivate
const color_map *
system_colors()
@@ -204,7 +208,7 @@ set_screen_space(int32 index, uint32 space, bool stick)
int32 width;
int32 height;
uint32 depth;
if (!get_mode_parameter(space, width, height, depth))
if (!BPrivate::get_mode_parameter(space, width, height, depth))
return B_BAD_VALUE;
BScreen screen(B_MAIN_SCREEN_ID);