* Added KMessage to libroot_build.
* libbe_build: Where possible we directly use the actual Haiku headers and sources, now. In the headers/build headers we just include the respective Haiku headers as needed. That still allows overrides where necessary. The intention is to make it easier to keep the build stuff in sync. * Fixed a few printf() format and signed/unsigned comparison warnings. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42179 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,337 +1 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: GraphicsDefs.h
|
||||
// Author: Frans van Nispen
|
||||
// Description: BMessageFilter class creates objects that filter
|
||||
// in-coming BMessages.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _GRAPHICS_DEFS_H
|
||||
#define _GRAPHICS_DEFS_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
typedef struct pattern {
|
||||
uint8 data[8];
|
||||
} pattern;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
inline bool
|
||||
operator==(const pattern& a, const pattern& b)
|
||||
{
|
||||
return (*(uint64*)a.data == *(uint64*)b.data);
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
extern _IMPEXP_BE const pattern B_SOLID_HIGH;
|
||||
extern _IMPEXP_BE const pattern B_MIXED_COLORS;
|
||||
extern _IMPEXP_BE const pattern B_SOLID_LOW;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
typedef struct rgb_color {
|
||||
uint8 red;
|
||||
uint8 green;
|
||||
uint8 blue;
|
||||
uint8 alpha;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
// some convenient additions
|
||||
|
||||
inline bool
|
||||
operator==(const rgb_color& other) const
|
||||
{
|
||||
return *(const uint32 *)this == *(const uint32 *)&other;
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator!=(const rgb_color& other) const
|
||||
{
|
||||
return *(const uint32 *)this != *(const uint32 *)&other;
|
||||
}
|
||||
#endif
|
||||
} rgb_color;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern _IMPEXP_BE const rgb_color B_TRANSPARENT_COLOR;
|
||||
extern _IMPEXP_BE const uint8 B_TRANSPARENT_MAGIC_CMAP8;
|
||||
extern _IMPEXP_BE const uint16 B_TRANSPARENT_MAGIC_RGBA15;
|
||||
extern _IMPEXP_BE const uint16 B_TRANSPARENT_MAGIC_RGBA15_BIG;
|
||||
extern _IMPEXP_BE const uint32 B_TRANSPARENT_MAGIC_RGBA32;
|
||||
extern _IMPEXP_BE const uint32 B_TRANSPARENT_MAGIC_RGBA32_BIG;
|
||||
|
||||
extern _IMPEXP_BE const uint8 B_TRANSPARENT_8_BIT;
|
||||
extern _IMPEXP_BE const rgb_color B_TRANSPARENT_32_BIT;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
typedef struct color_map {
|
||||
int32 id;
|
||||
rgb_color color_list[256];
|
||||
uint8 inversion_map[256];
|
||||
uint8 index_map[32768];
|
||||
} color_map;
|
||||
|
||||
typedef struct overlay_rect_limits {
|
||||
uint16 horizontal_alignment;
|
||||
uint16 vertical_alignment;
|
||||
uint16 width_alignment;
|
||||
uint16 height_alignment;
|
||||
uint16 min_width;
|
||||
uint16 max_width;
|
||||
uint16 min_height;
|
||||
uint16 max_height;
|
||||
uint32 reserved[8];
|
||||
} overlay_rect_limits;
|
||||
|
||||
typedef struct overlay_restrictions {
|
||||
overlay_rect_limits source;
|
||||
overlay_rect_limits destination;
|
||||
float min_width_scale;
|
||||
float max_width_scale;
|
||||
float min_height_scale;
|
||||
float max_height_scale;
|
||||
uint32 reserved[8];
|
||||
} overlay_restrictions;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
struct screen_id { int32 id; };
|
||||
|
||||
extern _IMPEXP_BE const struct screen_id B_MAIN_SCREEN_ID;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
B_NO_COLOR_SPACE = 0x0000, //* byte in memory order, high bit first
|
||||
|
||||
// linear color space (little endian is the default)
|
||||
B_RGB32 = 0x0008, //* B[7:0] G[7:0] R[7:0] -[7:0]
|
||||
B_RGBA32 = 0x2008, // B[7:0] G[7:0] R[7:0] A[7:0]
|
||||
B_RGB24 = 0x0003, // B[7:0] G[7:0] R[7:0]
|
||||
B_RGB16 = 0x0005, // G[2:0],B[4:0] R[4:0],G[5:3]
|
||||
B_RGB15 = 0x0010, // G[2:0],B[4:0] -[0],R[4:0],G[4:3]
|
||||
B_RGBA15 = 0x2010, // G[2:0],B[4:0] A[0],R[4:0],G[4:3]
|
||||
B_CMAP8 = 0x0004, // D[7:0]
|
||||
B_GRAY8 = 0x0002, // Y[7:0]
|
||||
B_GRAY1 = 0x0001, // Y0[0],Y1[0],Y2[0],Y3[0],Y4[0],Y5[0],Y6[0],Y7[0]
|
||||
|
||||
// big endian version, when the encoding is not endianess independant
|
||||
B_RGB32_BIG = 0x1008, // -[7:0] R[7:0] G[7:0] B[7:0]
|
||||
B_RGBA32_BIG = 0x3008, // A[7:0] R[7:0] G[7:0] B[7:0]
|
||||
B_RGB24_BIG = 0x1003, // R[7:0] G[7:0] B[7:0]
|
||||
B_RGB16_BIG = 0x1005, // R[4:0],G[5:3] G[2:0],B[4:0]
|
||||
B_RGB15_BIG = 0x1010, // -[0],R[4:0],G[4:3] G[2:0],B[4:0]
|
||||
B_RGBA15_BIG = 0x3010, // A[0],R[4:0],G[4:3] G[2:0],B[4:0]
|
||||
|
||||
// little-endian declarations, for completness
|
||||
B_RGB32_LITTLE = B_RGB32,
|
||||
B_RGBA32_LITTLE = B_RGBA32,
|
||||
B_RGB24_LITTLE = B_RGB24,
|
||||
B_RGB16_LITTLE = B_RGB16,
|
||||
B_RGB15_LITTLE = B_RGB15,
|
||||
B_RGBA15_LITTLE = B_RGBA15,
|
||||
|
||||
// non linear color space -- note that these are here for exchange purposes;
|
||||
// a BBitmap or BView may not necessarily support all these color spaces.
|
||||
|
||||
// Loss/Saturation points are Y 16-235 (absoulte); Cb/Cr 16-240 (center 128)
|
||||
|
||||
B_YCbCr422 = 0x4000, // Y0[7:0] Cb0[7:0] Y1[7:0] Cr0[7:0] Y2[7:0]...
|
||||
// Cb2[7:0] Y3[7:0] Cr2[7:0]
|
||||
B_YCbCr411 = 0x4001, // Cb0[7:0] Y0[7:0] Cr0[7:0] Y1[7:0] Cb4[7:0]...
|
||||
// Y2[7:0] Cr4[7:0] Y3[7:0] Y4[7:0] Y5[7:0]...
|
||||
// Y6[7:0] Y7[7:0]
|
||||
B_YCbCr444 = 0x4003, // Y0[7:0] Cb0[7:0] Cr0[7:0]
|
||||
B_YCbCr420 = 0x4004, // Non-interlaced only, Cb0 Y0 Y1 Cb2 Y2 Y3
|
||||
// on even scan lines, Cr0 Y0 Y1 Cr2 Y2 Y3
|
||||
// on odd scan lines
|
||||
|
||||
// Extrema points are
|
||||
// Y 0 - 207 (absolute)
|
||||
// U -91 - 91 (offset 128)
|
||||
// V -127 - 127 (offset 128)
|
||||
// note that YUV byte order is different from YCbCr
|
||||
// USE YCbCr, not YUV, when that's what you mean!
|
||||
B_YUV422 = 0x4020, // U0[7:0] Y0[7:0] V0[7:0] Y1[7:0] ...
|
||||
// U2[7:0] Y2[7:0] V2[7:0] Y3[7:0]
|
||||
B_YUV411 = 0x4021, // U0[7:0] Y0[7:0] Y1[7:0] V0[7:0] Y2[7:0] Y3[7:0]
|
||||
// U4[7:0] Y4[7:0] Y5[7:0] V4[7:0] Y6[7:0] Y7[7:0]
|
||||
B_YUV444 = 0x4023, // U0[7:0] Y0[7:0] V0[7:0] U1[7:0] Y1[7:0] V1[7:0]
|
||||
B_YUV420 = 0x4024, // Non-interlaced only, U0 Y0 Y1 U2 Y2 Y3
|
||||
// on even scan lines, V0 Y0 Y1 V2 Y2 Y3
|
||||
// on odd scan lines
|
||||
B_YUV9 = 0x402C, // planar? 410?
|
||||
B_YUV12 = 0x402D, // planar? 420?
|
||||
|
||||
B_UVL24 = 0x4030, // U0[7:0] V0[7:0] L0[7:0] ...
|
||||
B_UVL32 = 0x4031, // U0[7:0] V0[7:0] L0[7:0] X0[7:0]...
|
||||
B_UVLA32 = 0x6031, // U0[7:0] V0[7:0] L0[7:0] A0[7:0]...
|
||||
|
||||
B_LAB24 = 0x4032, // L0[7:0] a0[7:0] b0[7:0] ... (a is not alpha!)
|
||||
B_LAB32 = 0x4033, // L0[7:0] a0[7:0] b0[7:0] X0[7:0] ... (b is not alpha!)
|
||||
B_LABA32 = 0x6033, // L0[7:0] a0[7:0] b0[7:0] A0[7:0] ... (A is alpha)
|
||||
|
||||
// red is at hue = 0
|
||||
|
||||
B_HSI24 = 0x4040, // H[7:0] S[7:0] I[7:0]
|
||||
B_HSI32 = 0x4041, // H[7:0] S[7:0] I[7:0] X[7:0]
|
||||
B_HSIA32 = 0x6041, // H[7:0] S[7:0] I[7:0] A[7:0]
|
||||
|
||||
B_HSV24 = 0x4042, // H[7:0] S[7:0] V[7:0]
|
||||
B_HSV32 = 0x4043, // H[7:0] S[7:0] V[7:0] X[7:0]
|
||||
B_HSVA32 = 0x6043, // H[7:0] S[7:0] V[7:0] A[7:0]
|
||||
|
||||
B_HLS24 = 0x4044, // H[7:0] L[7:0] S[7:0]
|
||||
B_HLS32 = 0x4045, // H[7:0] L[7:0] S[7:0] X[7:0]
|
||||
B_HLSA32 = 0x6045, // H[7:0] L[7:0] S[7:0] A[7:0]
|
||||
|
||||
B_CMY24 = 0xC001, // C[7:0] M[7:0] Y[7:0] No gray removal done
|
||||
B_CMY32 = 0xC002, // C[7:0] M[7:0] Y[7:0] X[7:0] No gray removal done
|
||||
B_CMYA32 = 0xE002, // C[7:0] M[7:0] Y[7:0] A[7:0] No gray removal done
|
||||
B_CMYK32 = 0xC003, // C[7:0] M[7:0] Y[7:0] K[7:0]
|
||||
|
||||
// compatibility declarations
|
||||
B_MONOCHROME_1_BIT = B_GRAY1,
|
||||
B_GRAYSCALE_8_BIT = B_GRAY8,
|
||||
B_COLOR_8_BIT = B_CMAP8,
|
||||
B_RGB_32_BIT = B_RGB32,
|
||||
B_RGB_16_BIT = B_RGB15,
|
||||
B_BIG_RGB_32_BIT = B_RGB32_BIG,
|
||||
B_BIG_RGB_16_BIT = B_RGB15_BIG
|
||||
} color_space;
|
||||
|
||||
|
||||
// Find out whether a specific color space is supported by BBitmaps.
|
||||
// Support_flags will be set to what kinds of support are available.
|
||||
// If support_flags is set to 0, false will be returned.
|
||||
enum {
|
||||
B_VIEWS_SUPPORT_DRAW_BITMAP = 0x1,
|
||||
B_BITMAPS_SUPPORT_ATTACHED_VIEWS = 0x2
|
||||
};
|
||||
_IMPEXP_BE bool bitmaps_support_space(color_space space, uint32 * support_flags);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// "pixel_chunk" is the native increment from one pixel starting on an integral byte
|
||||
// to the next. "row_alignment" is the native alignment for pixel scanline starts.
|
||||
// "pixels_per_chunk" is the number of pixels in a pixel_chunk. For instance, B_GRAY1
|
||||
// sets pixel_chunk to 1, row_alignment to 4 and pixels_per_chunk to 8, whereas
|
||||
// B_RGB24 sets pixel_chunk to 3, row_alignment to 4 and pixels_per_chunk to 1.
|
||||
//------------------------------------------------------------------------------
|
||||
_IMPEXP_BE status_t get_pixel_size_for(color_space space, size_t * pixel_chunk,
|
||||
size_t * row_alignment, size_t * pixels_per_chunk);
|
||||
|
||||
|
||||
enum buffer_orientation {
|
||||
B_BUFFER_TOP_TO_BOTTOM,
|
||||
B_BUFFER_BOTTOM_TO_TOP
|
||||
};
|
||||
|
||||
enum buffer_layout {
|
||||
B_BUFFER_NONINTERLEAVED = 1
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
enum drawing_mode {
|
||||
B_OP_COPY,
|
||||
B_OP_OVER,
|
||||
B_OP_ERASE,
|
||||
B_OP_INVERT,
|
||||
B_OP_ADD,
|
||||
B_OP_SUBTRACT,
|
||||
B_OP_BLEND,
|
||||
B_OP_MIN,
|
||||
B_OP_MAX,
|
||||
B_OP_SELECT,
|
||||
B_OP_ALPHA
|
||||
};
|
||||
|
||||
enum source_alpha {
|
||||
B_PIXEL_ALPHA=0,
|
||||
B_CONSTANT_ALPHA
|
||||
};
|
||||
|
||||
enum alpha_function {
|
||||
B_ALPHA_OVERLAY=0,
|
||||
B_ALPHA_COMPOSITE
|
||||
};
|
||||
|
||||
enum {
|
||||
B_8_BIT_640x480 = 0x00000001,
|
||||
B_8_BIT_800x600 = 0x00000002,
|
||||
B_8_BIT_1024x768 = 0x00000004,
|
||||
B_8_BIT_1280x1024 = 0x00000008,
|
||||
B_8_BIT_1600x1200 = 0x00000010,
|
||||
B_16_BIT_640x480 = 0x00000020,
|
||||
B_16_BIT_800x600 = 0x00000040,
|
||||
B_16_BIT_1024x768 = 0x00000080,
|
||||
B_16_BIT_1280x1024 = 0x00000100,
|
||||
B_16_BIT_1600x1200 = 0x00000200,
|
||||
B_32_BIT_640x480 = 0x00000400,
|
||||
B_32_BIT_800x600 = 0x00000800,
|
||||
B_32_BIT_1024x768 = 0x00001000,
|
||||
B_32_BIT_1280x1024 = 0x00002000,
|
||||
B_32_BIT_1600x1200 = 0x00004000,
|
||||
B_8_BIT_1152x900 = 0x00008000,
|
||||
B_16_BIT_1152x900 = 0x00010000,
|
||||
B_32_BIT_1152x900 = 0x00020000,
|
||||
B_15_BIT_640x480 = 0x00040000,
|
||||
B_15_BIT_800x600 = 0x00080000,
|
||||
B_15_BIT_1024x768 = 0x00100000,
|
||||
B_15_BIT_1280x1024 = 0x00200000,
|
||||
B_15_BIT_1600x1200 = 0x00400000,
|
||||
B_15_BIT_1152x900 = 0x00800000,
|
||||
|
||||
// do not use B_FAKE_DEVICE--it will go away!
|
||||
B_FAKE_DEVICE = 0x40000000,
|
||||
B_8_BIT_640x400 = (int)0x80000000
|
||||
};
|
||||
|
||||
#endif // _GRAPHICSDEFS_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <../os/interface/GraphicsDefs.h>
|
||||
|
||||
@@ -1,392 +1 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: InterfaceDefs.h
|
||||
// Author: Erik Jaesler ([email protected])
|
||||
// Description: General Interface Kit definitions and global functions.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _INTERFACE_DEFS_H
|
||||
#define _INTERFACE_DEFS_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BRect;
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
struct key_info {
|
||||
uint32 modifiers;
|
||||
uint8 key_states[16];
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
#define B_UTF8_ELLIPSIS "\xE2\x80\xA6"
|
||||
#define B_UTF8_OPEN_QUOTE "\xE2\x80\x9C"
|
||||
#define B_UTF8_CLOSE_QUOTE "\xE2\x80\x9D"
|
||||
#define B_UTF8_COPYRIGHT "\xC2\xA9"
|
||||
#define B_UTF8_REGISTERED "\xC2\xAE"
|
||||
#define B_UTF8_TRADEMARK "\xE2\x84\xA2"
|
||||
#define B_UTF8_SMILING_FACE "\xE2\x98\xBB"
|
||||
#define B_UTF8_HIROSHI "\xE5\xBC\x98"
|
||||
#ifdef COMPILE_FOR_R5
|
||||
#define B_MAX_MOUSE_BUTTONS 3
|
||||
#else
|
||||
#define B_MAX_MOUSE_BUTTONS 16
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
enum { B_BACKSPACE = 0x08,
|
||||
B_RETURN = 0x0a,
|
||||
B_ENTER = 0x0a,
|
||||
B_SPACE = 0x20,
|
||||
B_TAB = 0x09,
|
||||
B_ESCAPE = 0x1b,
|
||||
B_SUBSTITUTE = 0x1a,
|
||||
|
||||
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 };
|
||||
|
||||
enum { B_F1_KEY = 0x02,
|
||||
B_F2_KEY = 0x03,
|
||||
B_F3_KEY = 0x04,
|
||||
B_F4_KEY = 0x05,
|
||||
B_F5_KEY = 0x06,
|
||||
B_F6_KEY = 0x07,
|
||||
B_F7_KEY = 0x08,
|
||||
B_F8_KEY = 0x09,
|
||||
B_F9_KEY = 0x0a,
|
||||
B_F10_KEY = 0x0b,
|
||||
B_F11_KEY = 0x0c,
|
||||
B_F12_KEY = 0x0d,
|
||||
B_PRINT_KEY = 0x0e,
|
||||
B_SCROLL_KEY = 0x0f,
|
||||
B_PAUSE_KEY = 0x10 };
|
||||
|
||||
struct key_map {
|
||||
uint32 version;
|
||||
uint32 caps_key;
|
||||
uint32 scroll_key;
|
||||
uint32 num_key;
|
||||
uint32 left_shift_key;
|
||||
uint32 right_shift_key;
|
||||
uint32 left_command_key;
|
||||
uint32 right_command_key;
|
||||
uint32 left_control_key;
|
||||
uint32 right_control_key;
|
||||
uint32 left_option_key;
|
||||
uint32 right_option_key;
|
||||
uint32 menu_key;
|
||||
uint32 lock_settings;
|
||||
int32 control_map[128];
|
||||
int32 option_caps_shift_map[128];
|
||||
int32 option_caps_map[128];
|
||||
int32 option_shift_map[128];
|
||||
int32 option_map[128];
|
||||
int32 caps_shift_map[128];
|
||||
int32 caps_map[128];
|
||||
int32 shift_map[128];
|
||||
int32 normal_map[128];
|
||||
int32 acute_dead_key[32];
|
||||
int32 grave_dead_key[32];
|
||||
int32 circumflex_dead_key[32];
|
||||
int32 dieresis_dead_key[32];
|
||||
int32 tilde_dead_key[32];
|
||||
uint32 acute_tables;
|
||||
uint32 grave_tables;
|
||||
uint32 circumflex_tables;
|
||||
uint32 dieresis_tables;
|
||||
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
|
||||
};
|
||||
|
||||
enum vertical_alignment {
|
||||
B_ALIGN_TOP = 0x10L,
|
||||
B_ALIGN_MIDDLE = 0x20,
|
||||
B_ALIGN_BOTTOM = 0x30,
|
||||
B_ALIGN_NO_VERTICAL = -1L
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
enum {
|
||||
B_CONTROL_TABLE = 0x00000001,
|
||||
B_OPTION_CAPS_SHIFT_TABLE = 0x00000002,
|
||||
B_OPTION_CAPS_TABLE = 0x00000004,
|
||||
B_OPTION_SHIFT_TABLE = 0x00000008,
|
||||
B_OPTION_TABLE = 0x00000010,
|
||||
B_CAPS_SHIFT_TABLE = 0x00000020,
|
||||
B_CAPS_TABLE = 0x00000040,
|
||||
B_SHIFT_TABLE = 0x00000080,
|
||||
B_NORMAL_TABLE = 0x00000100
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
enum {
|
||||
B_SHIFT_KEY = 0x00000001,
|
||||
B_COMMAND_KEY = 0x00000002,
|
||||
B_CONTROL_KEY = 0x00000004,
|
||||
B_CAPS_LOCK = 0x00000008,
|
||||
B_SCROLL_LOCK = 0x00000010,
|
||||
B_NUM_LOCK = 0x00000020,
|
||||
B_OPTION_KEY = 0x00000040,
|
||||
B_MENU_KEY = 0x00000080,
|
||||
B_LEFT_SHIFT_KEY = 0x00000100,
|
||||
B_RIGHT_SHIFT_KEY = 0x00000200,
|
||||
B_LEFT_COMMAND_KEY = 0x00000400,
|
||||
B_RIGHT_COMMAND_KEY = 0x00000800,
|
||||
B_LEFT_CONTROL_KEY = 0x00001000,
|
||||
B_RIGHT_CONTROL_KEY = 0x00002000,
|
||||
B_LEFT_OPTION_KEY = 0x00004000,
|
||||
B_RIGHT_OPTION_KEY = 0x00008000
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
enum bitmap_tiling {
|
||||
B_TILE_BITMAP_X = 0x00000001,
|
||||
B_TILE_BITMAP_Y = 0x00000002,
|
||||
B_TILE_BITMAP = 0x00000003
|
||||
};
|
||||
|
||||
enum overlay_options {
|
||||
B_OVERLAY_FILTER_HORIZONTAL = 0x00010000,
|
||||
B_OVERLAY_FILTER_VERTICAL = 0x00020000,
|
||||
B_OVERLAY_MIRROR = 0x00040000,
|
||||
B_OVERLAY_TRANSFER_CHANNEL = 0x00080000
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
_IMPEXP_BE status_t get_deskbar_frame(BRect *frame);
|
||||
|
||||
_IMPEXP_BE const color_map *system_colors();
|
||||
|
||||
_IMPEXP_BE status_t set_screen_space(int32 index, uint32 res,
|
||||
bool stick = true);
|
||||
|
||||
_IMPEXP_BE status_t get_scroll_bar_info(scroll_bar_info *info);
|
||||
_IMPEXP_BE status_t set_scroll_bar_info(scroll_bar_info *info);
|
||||
|
||||
_IMPEXP_BE status_t get_mouse_type(int32 *type);
|
||||
_IMPEXP_BE status_t set_mouse_type(int32 type);
|
||||
_IMPEXP_BE status_t get_mouse_map(mouse_map *map);
|
||||
_IMPEXP_BE status_t set_mouse_map(mouse_map *map);
|
||||
_IMPEXP_BE status_t get_click_speed(bigtime_t *speed);
|
||||
_IMPEXP_BE status_t set_click_speed(bigtime_t speed);
|
||||
_IMPEXP_BE status_t get_mouse_speed(int32 *speed);
|
||||
_IMPEXP_BE status_t set_mouse_speed(int32 speed);
|
||||
_IMPEXP_BE status_t get_mouse_acceleration(int32 *speed);
|
||||
_IMPEXP_BE status_t set_mouse_acceleration(int32 speed);
|
||||
|
||||
_IMPEXP_BE status_t get_key_repeat_rate(int32 *rate);
|
||||
_IMPEXP_BE status_t set_key_repeat_rate(int32 rate);
|
||||
_IMPEXP_BE status_t get_key_repeat_delay(bigtime_t *delay);
|
||||
_IMPEXP_BE status_t set_key_repeat_delay(bigtime_t delay);
|
||||
|
||||
_IMPEXP_BE uint32 modifiers();
|
||||
_IMPEXP_BE status_t get_key_info(key_info *info);
|
||||
_IMPEXP_BE void get_key_map(key_map **map, char **key_buffer);
|
||||
_IMPEXP_BE status_t get_keyboard_id(uint16 *id);
|
||||
_IMPEXP_BE void set_modifier_key(uint32 modifier, uint32 key);
|
||||
_IMPEXP_BE void set_keyboard_locks(uint32 modifiers);
|
||||
|
||||
_IMPEXP_BE rgb_color keyboard_navigation_color();
|
||||
|
||||
_IMPEXP_BE int32 count_workspaces();
|
||||
_IMPEXP_BE void set_workspace_count(int32 count);
|
||||
_IMPEXP_BE int32 current_workspace();
|
||||
_IMPEXP_BE void activate_workspace(int32 workspace);
|
||||
|
||||
_IMPEXP_BE bigtime_t idle_time();
|
||||
|
||||
_IMPEXP_BE void run_select_printer_panel();
|
||||
_IMPEXP_BE void run_add_printer_panel();
|
||||
_IMPEXP_BE void run_be_about();
|
||||
|
||||
_IMPEXP_BE void set_focus_follows_mouse(bool follow);
|
||||
_IMPEXP_BE 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
|
||||
};
|
||||
|
||||
_IMPEXP_BE void set_mouse_mode(mode_mouse mode);
|
||||
_IMPEXP_BE mode_mouse mouse_mode();
|
||||
|
||||
enum color_which {
|
||||
B_PANEL_BACKGROUND_COLOR = 1,
|
||||
B_PANEL_TEXT_COLOR = 10,
|
||||
B_DOCUMENT_BACKGROUND_COLOR = 11,
|
||||
B_DOCUMENT_TEXT_COLOR = 12,
|
||||
B_CONTROL_BACKGROUND_COLOR = 13,
|
||||
B_CONTROL_TEXT_COLOR = 14,
|
||||
B_CONTROL_BORDER_COLOR = 15,
|
||||
B_CONTROL_HIGHLIGHT_COLOR = 16,
|
||||
B_NAVIGATION_BASE_COLOR = 4,
|
||||
B_NAVIGATION_PULSE_COLOR = 17,
|
||||
B_SHINE_COLOR = 18,
|
||||
B_SHADOW_COLOR = 19,
|
||||
|
||||
B_MENU_BACKGROUND_COLOR = 2,
|
||||
B_MENU_SELECTED_BACKGROUND_COLOR = 6,
|
||||
B_MENU_ITEM_TEXT_COLOR = 7,
|
||||
B_MENU_SELECTED_ITEM_TEXT_COLOR = 8,
|
||||
B_MENU_SELECTED_BORDER_COLOR = 9,
|
||||
|
||||
B_TOOLTIP_BACKGROUND_COLOR = 20,
|
||||
B_TOOLTIP_TEXT_COLOR = 21,
|
||||
|
||||
B_SUCCESS_COLOR = 100,
|
||||
B_FAILURE_COLOR = 101,
|
||||
|
||||
// Old name synonyms.
|
||||
B_KEYBOARD_NAVIGATION_COLOR = B_NAVIGATION_BASE_COLOR,
|
||||
B_MENU_SELECTION_BACKGROUND_COLOR = B_MENU_SELECTED_BACKGROUND_COLOR,
|
||||
|
||||
// These are deprecated -- do not use in new code. See BScreen for
|
||||
// the replacement for B_DESKTOP_COLOR.
|
||||
B_DESKTOP_COLOR = 5,
|
||||
B_WINDOW_TAB_COLOR = 3,
|
||||
|
||||
B_RANDOM_COLOR = 0x80000000,
|
||||
B_MICHELANGELO_FAVORITE_COLOR,
|
||||
B_DSANDLER_FAVORITE_SKY_COLOR,
|
||||
B_DSANDLER_FAVORITE_INK_COLOR,
|
||||
B_DSANDLER_FAVORITE_SHOES_COLOR
|
||||
};
|
||||
|
||||
_IMPEXP_BE rgb_color ui_color(color_which which);
|
||||
_IMPEXP_BE 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) */
|
||||
|
||||
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) */
|
||||
|
||||
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;
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif // _INTERFACE_DEFS_H
|
||||
#include <../os/interface/InterfaceDefs.h>
|
||||
|
||||
@@ -1,114 +1 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Point.h
|
||||
// Author: Frans van Nispen
|
||||
// Description: BPoint represents a single x,y coordinate.
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _POINT_H
|
||||
#define _POINT_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
|
||||
class BRect;
|
||||
|
||||
// BPoint class ----------------------------------------------------------------
|
||||
class BPoint {
|
||||
public:
|
||||
float x;
|
||||
float y;
|
||||
|
||||
BPoint();
|
||||
BPoint(float X, float Y);
|
||||
BPoint(const BPoint &p);
|
||||
|
||||
BPoint &operator=(const BPoint &p);
|
||||
void Set(float X, float Y);
|
||||
|
||||
void ConstrainTo(BRect r);
|
||||
void PrintToStream() const;
|
||||
|
||||
BPoint operator+(const BPoint &p) const;
|
||||
BPoint operator-(const BPoint &p) const;
|
||||
BPoint& operator+=(const BPoint &p);
|
||||
BPoint& operator-=(const BPoint &p);
|
||||
|
||||
bool operator!=(const BPoint &p) const;
|
||||
bool operator==(const BPoint &p) const;
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern _IMPEXP_BE const BPoint B_ORIGIN; // returns (0,0)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
inline BPoint::BPoint()
|
||||
{
|
||||
x = y = 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
inline BPoint::BPoint(float X, float Y)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
inline BPoint::BPoint(const BPoint& pt)
|
||||
{
|
||||
x = pt.x;
|
||||
y = pt.y;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
inline BPoint &BPoint::operator=(const BPoint& from)
|
||||
{
|
||||
x = from.x;
|
||||
y = from.y;
|
||||
return *this;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
inline void BPoint::Set(float X, float Y)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _POINT_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <../os/interface/Point.h>
|
||||
|
||||
@@ -1,213 +1 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2005, Haiku
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Rect.h
|
||||
// Author: Frans van Nispen ([email protected])
|
||||
// Description: BRect represents a rectangular area.
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _RECT_H
|
||||
#define _RECT_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <Point.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
class BRect {
|
||||
public:
|
||||
float left;
|
||||
float top;
|
||||
float right;
|
||||
float bottom;
|
||||
|
||||
BRect();
|
||||
BRect(const BRect &r);
|
||||
BRect(float l, float t, float r, float b);
|
||||
BRect(BPoint lt, BPoint rb);
|
||||
|
||||
BRect &operator=(const BRect &r);
|
||||
void Set(float l, float t, float r, float b);
|
||||
|
||||
void PrintToStream() const;
|
||||
|
||||
BPoint LeftTop() const;
|
||||
BPoint RightBottom() const;
|
||||
BPoint LeftBottom() const;
|
||||
BPoint RightTop() const;
|
||||
|
||||
void SetLeftTop(const BPoint p);
|
||||
void SetRightBottom(const BPoint p);
|
||||
void SetLeftBottom(const BPoint p);
|
||||
void SetRightTop(const BPoint p);
|
||||
|
||||
// transformation
|
||||
void InsetBy(BPoint p);
|
||||
void InsetBy(float dx, float dy);
|
||||
void OffsetBy(BPoint p);
|
||||
void OffsetBy(float dx, float dy);
|
||||
void OffsetTo(BPoint p);
|
||||
void OffsetTo(float x, float y);
|
||||
|
||||
// expression transformations
|
||||
BRect& InsetBySelf(BPoint);
|
||||
BRect& InsetBySelf(float dx, float dy);
|
||||
BRect InsetByCopy(BPoint);
|
||||
BRect InsetByCopy(float dx, float dy);
|
||||
BRect& OffsetBySelf(BPoint);
|
||||
BRect& OffsetBySelf(float dx, float dy);
|
||||
BRect OffsetByCopy(BPoint);
|
||||
BRect OffsetByCopy(float dx, float dy);
|
||||
BRect& OffsetToSelf(BPoint);
|
||||
BRect& OffsetToSelf(float dx, float dy);
|
||||
BRect OffsetToCopy(BPoint);
|
||||
BRect OffsetToCopy(float dx, float dy);
|
||||
|
||||
// comparison
|
||||
bool operator==(BRect r) const;
|
||||
bool operator!=(BRect r) const;
|
||||
|
||||
// intersection and union
|
||||
BRect operator&(BRect r) const;
|
||||
BRect operator|(BRect r) const;
|
||||
|
||||
bool Intersects(BRect r) const;
|
||||
bool IsValid() const;
|
||||
float Width() const;
|
||||
int32 IntegerWidth() const;
|
||||
float Height() const;
|
||||
int32 IntegerHeight() const;
|
||||
bool Contains(BPoint p) const;
|
||||
bool Contains(BRect r) const;
|
||||
};
|
||||
|
||||
|
||||
// inline definitions ----------------------------------------------------------
|
||||
|
||||
inline BPoint
|
||||
BRect::LeftTop() const
|
||||
{
|
||||
return *(const BPoint *)&left;
|
||||
}
|
||||
|
||||
inline BPoint
|
||||
BRect::RightBottom() const
|
||||
{
|
||||
return *(const BPoint *)&right;
|
||||
}
|
||||
|
||||
inline BPoint
|
||||
BRect::LeftBottom() const
|
||||
{
|
||||
return BPoint(left, bottom);
|
||||
}
|
||||
|
||||
inline BPoint
|
||||
BRect::RightTop() const
|
||||
{
|
||||
return BPoint(right, top);
|
||||
}
|
||||
|
||||
inline
|
||||
BRect::BRect()
|
||||
{
|
||||
top = left = 0;
|
||||
bottom = right = -1;
|
||||
}
|
||||
|
||||
inline
|
||||
BRect::BRect(float l, float t, float r, float b)
|
||||
{
|
||||
left = l;
|
||||
top = t;
|
||||
right = r;
|
||||
bottom = b;
|
||||
}
|
||||
|
||||
inline
|
||||
BRect::BRect(const BRect &r)
|
||||
{
|
||||
left = r.left;
|
||||
top = r.top;
|
||||
right = r.right;
|
||||
bottom = r.bottom;
|
||||
}
|
||||
|
||||
inline
|
||||
BRect::BRect(BPoint leftTop, BPoint rightBottom)
|
||||
{
|
||||
left = leftTop.x;
|
||||
top = leftTop.y;
|
||||
right = rightBottom.x;
|
||||
bottom = rightBottom.y;
|
||||
}
|
||||
|
||||
inline BRect &
|
||||
BRect::operator=(const BRect& from)
|
||||
{
|
||||
left = from.left;
|
||||
top = from.top;
|
||||
right = from.right;
|
||||
bottom = from.bottom;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void
|
||||
BRect::Set(float l, float t, float r, float b)
|
||||
{
|
||||
left = l;
|
||||
top = t;
|
||||
right = r;
|
||||
bottom = b;
|
||||
}
|
||||
|
||||
inline bool
|
||||
BRect::IsValid() const
|
||||
{
|
||||
return left <= right && top <= bottom;
|
||||
}
|
||||
|
||||
inline int32
|
||||
BRect::IntegerWidth() const
|
||||
{
|
||||
return (int32)ceil(right - left);
|
||||
}
|
||||
|
||||
inline float
|
||||
BRect::Width() const
|
||||
{
|
||||
return right - left;
|
||||
}
|
||||
|
||||
inline int32
|
||||
BRect::IntegerHeight() const
|
||||
{
|
||||
return (int32)ceil(bottom - top);
|
||||
}
|
||||
|
||||
inline float
|
||||
BRect::Height() const
|
||||
{
|
||||
return bottom - top;
|
||||
}
|
||||
|
||||
#endif // _RECT_H
|
||||
#include <../os/interface/Rect.h>
|
||||
|
||||
@@ -1,95 +1 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef _REGION_H
|
||||
#define _REGION_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <Rect.h>
|
||||
|
||||
namespace BPrivate {
|
||||
class ServerLink;
|
||||
class LinkReceiver;
|
||||
};
|
||||
|
||||
/* Integer rect used to define a clipping rectangle. All bounds are inclusive. */
|
||||
/* Moved from DirectWindow.h */
|
||||
typedef struct {
|
||||
int32 left;
|
||||
int32 top;
|
||||
int32 right;
|
||||
int32 bottom;
|
||||
} clipping_rect;
|
||||
|
||||
|
||||
class BRegion {
|
||||
public:
|
||||
BRegion();
|
||||
BRegion(const BRegion& region);
|
||||
BRegion(const BRect rect);
|
||||
virtual ~BRegion();
|
||||
|
||||
BRegion &operator=(const BRegion &from);
|
||||
|
||||
void Set(BRect newBounds);
|
||||
void Set(clipping_rect newBounds);
|
||||
|
||||
BRect Frame() const;
|
||||
clipping_rect FrameInt() const;
|
||||
|
||||
BRect RectAt(int32 index) /*const*/;
|
||||
clipping_rect RectAtInt(int32 index) /*const*/;
|
||||
|
||||
int32 CountRects() /*const*/;
|
||||
|
||||
bool Intersects(BRect rect) const;
|
||||
bool Intersects(clipping_rect rect) const;
|
||||
|
||||
bool Contains(BPoint point) const;
|
||||
bool Contains(int32 x, int32 y) /*const*/;
|
||||
|
||||
void PrintToStream() const;
|
||||
|
||||
void OffsetBy(int32 x, int32 y);
|
||||
|
||||
void MakeEmpty();
|
||||
|
||||
void Include(BRect rect);
|
||||
void Include(clipping_rect rect);
|
||||
void Include(const BRegion*);
|
||||
|
||||
void Exclude(BRect r);
|
||||
void Exclude(clipping_rect r);
|
||||
void Exclude(const BRegion* region);
|
||||
|
||||
void IntersectWith(const BRegion* region);
|
||||
|
||||
private:
|
||||
friend class BDirectWindow;
|
||||
friend class BPrivate::ServerLink;
|
||||
friend class BPrivate::LinkReceiver;
|
||||
|
||||
class Support;
|
||||
friend class Support;
|
||||
|
||||
private:
|
||||
BRegion(const clipping_rect& rect);
|
||||
|
||||
void _AdoptRegionData(BRegion& region);
|
||||
bool _SetSize(long newSize);
|
||||
|
||||
clipping_rect _Convert(const BRect& rect) const;
|
||||
clipping_rect _ConvertToInternal(const BRect& rect) const;
|
||||
clipping_rect _ConvertToInternal(
|
||||
const clipping_rect& rect) const;
|
||||
|
||||
private:
|
||||
long fCount;
|
||||
long fDataSize;
|
||||
clipping_rect fBounds;
|
||||
clipping_rect* fData;
|
||||
};
|
||||
|
||||
#endif // _REGION_H
|
||||
#include <../os/interface/Region.h>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include <../os/interface/Size.h>
|
||||
Reference in New Issue
Block a user