some header files to be R5 compatible

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1617 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2002-10-23 13:54:44 +00:00
parent 16fe4511e7
commit d734a8ce5a
39 changed files with 4652 additions and 0 deletions

View File

@ -0,0 +1,249 @@
#if !defined(_ACCELERANT_H_)
#define _ACCELERANT_H_
#include <BeBuild.h>
#include <SupportDefs.h>
#include <GraphicsDefs.h>
#include <OS.h>
#if defined(__cplusplus)
extern "C" {
#endif
#define B_ACCELERANT_ENTRY_POINT "get_accelerant_hook"
#define B_ACCELERANT_VERSION 1
typedef void * (*GetAccelerantHook)(uint32, void *);
_EXPORT void * get_accelerant_hook(uint32 feature, void *data);
enum {
/* initialization */
B_INIT_ACCELERANT = 0, /* required */
B_ACCELERANT_CLONE_INFO_SIZE, /* required */
B_GET_ACCELERANT_CLONE_INFO, /* required */
B_CLONE_ACCELERANT, /* required */
B_UNINIT_ACCELERANT, /* required */
B_GET_ACCELERANT_DEVICE_INFO, /* required */
B_ACCELERANT_RETRACE_SEMAPHORE, /* optional */
/* mode configuration */
B_ACCELERANT_MODE_COUNT = 0x100, /* required */
B_GET_MODE_LIST, /* required */
B_PROPOSE_DISPLAY_MODE, /* optional */
B_SET_DISPLAY_MODE, /* required */
B_GET_DISPLAY_MODE, /* required */
B_GET_FRAME_BUFFER_CONFIG, /* required */
B_GET_PIXEL_CLOCK_LIMITS, /* required */
B_GET_TIMING_CONSTRAINTS, /* optional */
B_MOVE_DISPLAY, /* optional */
B_SET_INDEXED_COLORS, /* required if driver supports 8bit indexed modes */
B_DPMS_CAPABILITIES, /* required if driver supports DPMS */
B_DPMS_MODE, /* required if driver supports DPMS */
B_SET_DPMS_MODE, /* required if driver supports DPMS */
/* cursor managment */
B_MOVE_CURSOR = 0x200, /* optional */
B_SET_CURSOR_SHAPE, /* optional */
B_SHOW_CURSOR, /* optional */
/* synchronization */
B_ACCELERANT_ENGINE_COUNT = 0x300, /* required */
B_ACQUIRE_ENGINE, /* required */
B_RELEASE_ENGINE, /* required */
B_WAIT_ENGINE_IDLE, /* required */
B_GET_SYNC_TOKEN, /* required */
B_SYNC_TO_TOKEN, /* required */
/* 2D acceleration */
B_SCREEN_TO_SCREEN_BLIT = 0x400, /* optional */
B_FILL_RECTANGLE, /* optional */
B_INVERT_RECTANGLE, /* optional */
B_FILL_SPAN, /* optional */
B_SCREEN_TO_SCREEN_TRANSPARENT_BLIT, /* optional */
B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT, /* optional. NOTE: source and dest may NOT overlap */
/* 3D acceleration */
B_ACCELERANT_PRIVATE_START = (int)0x80000000
};
typedef struct {
uint32 version; /* structure version number */
char name[32]; /* a name the user will recognize the device by */
char chipset[32]; /* the chipset used by the device */
char serial_no[32]; /* serial number for the device */
uint32 memory; /* amount of memory on the device, in bytes */
uint32 dac_speed; /* nominal DAC speed, in MHz */
} accelerant_device_info;
typedef struct {
uint32 pixel_clock; /* kHz */
uint16 h_display; /* in pixels (not character clocks) */
uint16 h_sync_start;
uint16 h_sync_end;
uint16 h_total;
uint16 v_display; /* in lines */
uint16 v_sync_start;
uint16 v_sync_end;
uint16 v_total;
uint32 flags; /* sync polarity, etc. */
} display_timing;
typedef struct {
display_timing timing; /* CTRC info */
uint32 space; /* pixel configuration */
uint16 virtual_width; /* in pixels */
uint16 virtual_height; /* in lines */
uint16 h_display_start; /* first displayed pixel in line */
uint16 v_display_start; /* first displayed line */
uint32 flags; /* mode flags */
} display_mode;
typedef struct {
void *frame_buffer; /* pointer to first byte of frame buffer in virtual memory */
void *frame_buffer_dma; /* pointer to first byte of frame buffer in physical memory for DMA */
uint32 bytes_per_row; /* number of bytes in one virtual_width line */
/* not neccesarily the same as virtual_width * byte_per_pixel */
} frame_buffer_config;
typedef struct {
uint16 h_res; /* minimum effective change in horizontal pixels, usually 8 */
uint16 h_sync_min; /* min/max horizontal sync pulse width in pixels, a multiple of h_res */
uint16 h_sync_max;
uint16 h_blank_min; /* min/max horizontal blank pulse width in pixels, a multiple of h_res */
uint16 h_blank_max;
uint16 v_res; /* minimum effective change in vertical lines, usually 1 */
uint16 v_sync_min; /* min/max vertical sync pulse width in lines, a multiple of v_res */
uint16 v_sync_max;
uint16 v_blank_min; /* min/max vertical blank pulse width in linex, a multiple of v_res */
uint16 v_blank_max;
} display_timing_constraints;
enum { /* mode flags */
B_SCROLL = 1 << 0,
B_8_BIT_DAC = 1 << 1,
B_HARDWARE_CURSOR = 1 << 2,
B_PARALLEL_ACCESS = 1 << 3,
B_DPMS = 1 << 4,
B_IO_FB_NA = 1 << 5
};
enum { /* power saver flags */
B_DPMS_ON = 1 << 0,
B_DPMS_STAND_BY = 1 << 1,
B_DPMS_SUSPEND = 1 << 2,
B_DPMS_OFF = 1 << 3
};
enum { /* timing flags */
B_BLANK_PEDESTAL = 1 << 27,
B_TIMING_INTERLACED = 1 << 28,
B_POSITIVE_HSYNC = 1 << 29,
B_POSITIVE_VSYNC = 1 << 30,
B_SYNC_ON_GREEN = 1 << 31
};
typedef struct {
uint16 src_left; /* guaranteed constrained to virtual width and height */
uint16 src_top;
uint16 dest_left;
uint16 dest_top;
uint16 width; /* 0 to N, where zero means one pixel, one means two pixels, etc. */
uint16 height; /* 0 to M, where zero means one line, one means two lines, etc. */
} blit_params;
typedef struct {
uint16 src_left; /* guaranteed constrained to virtual width and height */
uint16 src_top;
uint16 src_width; /* 0 to N, where zero means one pixel, one means two pixels, etc. */
uint16 src_height; /* 0 to M, where zero means one line, one means two lines, etc. */
uint16 dest_left;
uint16 dest_top;
uint16 dest_width; /* 0 to N, where zero means one pixel, one means two pixels, etc. */
uint16 dest_height; /* 0 to M, where zero means one line, one means two lines, etc. */
} scaled_blit_params;
typedef struct {
uint16 left; /* guaranteed constrained to virtual width and height */
uint16 top;
uint16 right;
uint16 bottom;
} fill_rect_params;
typedef struct {
uint32 engine_id; /* 0 == no engine, 1,2,3 etc individual engines */
uint32 capability_mask; /* features this engine supports */
void *opaque; /* optional pointer to engine private storage */
} engine_token;
enum { /* engine capabilities */
B_2D_ACCELERATION = 1 << 0,
B_3D_ACCELERATION = 1 << 1
};
typedef struct {
uint64 counter; /* counts issued primatives */
uint32 engine_id; /* what engine the counter is for */
char opaque[12]; /* 12 bytes of private storage */
} sync_token;
/* Masks for color info */
/* B_CMAP8 - 0x000000ff */
/* B_RGB15/16 - 0x0000ffff */
/* B_RGB24 - 0x00ffffff */
/* B_RGB32 - 0xffffffff */
typedef status_t (*init_accelerant)(int fd);
typedef ssize_t (*accelerant_clone_info_size)(void);
typedef void (*get_accelerant_clone_info)(void *data);
typedef status_t (*clone_accelerant)(void *data);
typedef void (*uninit_accelerant)(void);
typedef status_t (*get_accelerant_device_info)(accelerant_device_info *adi);
typedef uint32 (*accelerant_mode_count)(void);
typedef status_t (*get_mode_list)(display_mode *);
typedef status_t (*propose_display_mode)(display_mode *target, display_mode *low, display_mode *high);
typedef status_t (*set_display_mode)(display_mode *mode_to_set);
typedef status_t (*get_display_mode)(display_mode *current_mode);
typedef status_t (*get_frame_buffer_config)(frame_buffer_config *a_frame_buffer);
typedef status_t (*get_pixel_clock_limits)(display_mode *dm, uint32 *low, uint32 *high);
typedef status_t (*move_display_area)(uint16 h_display_start, uint16 v_display_start);
typedef status_t (*get_timing_constraints)(display_timing_constraints *dtc);
typedef void (*set_indexed_colors)(uint count, uint8 first, uint8 *color_data, uint32 flags);
typedef uint32 (*dpms_capabilities)(void);
typedef uint32 (*dpms_mode)(void);
typedef status_t (*set_dpms_mode)(uint32 dpms_flags);
typedef sem_id (*accelerant_retrace_semaphore)(void);
typedef status_t (*set_cursor_shape)(uint16 width, uint16 height, uint16 hot_x, uint16 hot_y, uint8 *andMask, uint8 *xorMask);
typedef void (*move_cursor)(uint16 x, uint16 y);
typedef void (*show_cursor)(bool is_visible);
typedef uint32 (*accelerant_engine_count)(void);
typedef status_t (*acquire_engine)(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et);
typedef status_t (*release_engine)(engine_token *et, sync_token *st);
typedef void (*wait_engine_idle)(void);
typedef status_t (*get_sync_token)(engine_token *et, sync_token *st);
typedef status_t (*sync_to_token)(sync_token *st);
typedef void (*screen_to_screen_blit)(engine_token *et, blit_params *list, uint32 count);
typedef void (*fill_rectangle)(engine_token *et, uint32 color, fill_rect_params *list, uint32 count);
typedef void (*invert_rectangle)(engine_token *et, fill_rect_params *list, uint32 count);
typedef void (*screen_to_screen_transparent_blit)(engine_token *et, uint32 transparent_color, blit_params *list, uint32 count);
typedef void (*screen_to_screen_scaled_filtered_blit)(engine_token *et, scaled_blit_params *list, uint32 count);
typedef void (*fill_span)(engine_token *et, uint32 color, uint16 *list, uint32 count);
/*
The uint16 *list points to a list of tripples:
list[N+0] Y co-ordinate of span
list[N+1] Left x co-ordinate of span
list[N+2] Right x co-ordinate of span
where N is in the range 0 to count-1.
*/
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,188 @@
/******************************************************************************
/
/ File: GraphicsCard.h
/
/ Description: App Server interface for graphics card add-ons.
/
/ Copyright 1993-98, Be Incorporated
/
*******************************************************************************/
#ifndef _GRAPHICS_CARD_H
#define _GRAPHICS_CARD_H
#include <BeBuild.h>
#include <GraphicsDefs.h>
#include <SupportDefs.h>
/*-------------------------------------------------------------*/
/*----- Command Constants -------------------------------------*/
enum {
B_OPEN_GRAPHICS_CARD,
B_CLOSE_GRAPHICS_CARD,
B_GET_GRAPHICS_CARD_INFO,
B_GET_GRAPHICS_CARD_HOOKS,
B_SET_INDEXED_COLOR,
B_GET_SCREEN_SPACES,
B_CONFIG_GRAPHICS_CARD,
B_GET_REFRESH_RATES,
B_SET_SCREEN_GAMMA,
B_GET_INFO_FOR_CLONE_SIZE,
B_GET_INFO_FOR_CLONE,
B_SET_CLONED_GRAPHICS_CARD,
B_CLOSE_CLONED_GRAPHICS_CARD,
B_PROPOSE_FRAME_BUFFER,
B_SET_FRAME_BUFFER,
B_SET_DISPLAY_AREA,
B_MOVE_DISPLAY_AREA}
;
/*----- Optional ---------------*/
enum {
B_CRT_CONTROL = 0x0001,
B_GAMMA_CONTROL = 0x0002,
B_FRAME_BUFFER_CONTROL = 0x0004,
B_PARALLEL_BUFFER_ACCESS = 0x0008,
B_LAME_ASS_CARD = 0x0010
};
/*-------------------------------------------------------------*/
/*----- Structures --------------------------------------------*/
typedef struct {
int16 version;
int16 id;
void *frame_buffer;
char rgba_order[4];
int16 flags;
int16 bits_per_pixel;
int16 bytes_per_row;
int16 width;
int16 height;
} graphics_card_info;
typedef struct {
int32 index;
rgb_color color;
} indexed_color;
typedef struct {
uint32 space;
float refresh_rate;
uchar h_position;
uchar v_position;
uchar h_size;
uchar v_size;
} graphics_card_config;
typedef struct {
float min;
float max;
float current;
} refresh_rate_info;
typedef struct {
void *screen_base;
void *io_base;
uint32 vendor_id;
uint32 device_id;
uint32 _reserved1_;
uint32 _reserved2_;
} graphics_card_spec;
typedef struct {
int16 x1;
int16 y1;
int16 x2;
int16 y2;
rgb_color color;
} rgb_color_line;
typedef struct {
int16 x1;
int16 y1;
int16 x2;
int16 y2;
uchar color;
} indexed_color_line;
typedef struct {
int16 bits_per_pixel;
int16 bytes_per_row;
int16 width;
int16 height;
int16 display_width;
int16 display_height;
int16 display_x;
int16 display_y;
} frame_buffer_info;
typedef struct {
uchar red[256];
uchar green[256];
uchar blue[256];
} screen_gamma;
/*-------------------------------------------------------------*/
/*----- Hook Function -----------------------------------------*/
typedef void (*graphics_card_hook) ();
#define B_GRAPHICS_HOOK_COUNT 48
#ifdef __cplusplus
extern "C" {
#endif
_EXPORT int32 control_graphics_card(uint32, void*);
#ifdef __cplusplus
}
#endif
/*-------------------------------------------------------------*/
/*----- Debugging Functions ------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
void dprintf(const char *format, ...);
bool set_dprintf_enabled(bool); /* returns old enable flag */
#ifdef __cplusplus
}
#endif
/*-------------------------------------------------------------*/
/*----- Obsolete ---------------------------------------------*/
#define B_HOOK_COUNT B_GRAPHICS_HOOK_COUNT
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _GRAPHICS_CARD_H */

View File

@ -0,0 +1,84 @@
#if ! defined _SCREENSAVER_H
#define _SCREENSAVER_H
#include <BeBuild.h>
#include <DirectWindow.h> // for direct_buffer_info
#include <image.h>
#include <Message.h>
class BView;
class BScreenSaver
{
public:
BScreenSaver(BMessage *archive, image_id);
virtual ~BScreenSaver();
// Return an error if something goes wrong or if you don't
// like the running environment (lack of 3D acceleration,
// lack of sound, ...).
virtual status_t InitCheck();
// Animation start and stop. The view is not yet visible when
// StartSaver is called.
virtual status_t StartSaver(BView *view, bool preview);
virtual void StopSaver();
// This hook is called periodically, you should
// override it to do the drawing. Notice that you
// should clear the screen when frame == 0 if you
// don't want to paint over the desktop.
virtual void Draw(BView *view, int32 frame);
// These hooks are for direct screen access, the first is
// called every time the settings change, the second is
// the equivalent of Draw to be called to access the screen
// directly. Draw and DirectDraw can be used at the same time.
virtual void DirectConnected(direct_buffer_info *info);
virtual void DirectDraw(int32 frame);
// configuration dialog methods
virtual void StartConfig(BView *configView);
virtual void StopConfig();
// Module should fill this in with metadata
// example: randomizable = true
virtual void SupplyInfo(BMessage *info) const;
// Send all the metadata info to the module
virtual void ModulesChanged(const BMessage *info);
// BArchivable like parameter saver method
virtual status_t SaveState(BMessage *into) const;
// These methods can be used to control drawing frequency.
void SetTickSize(bigtime_t ts);
bigtime_t TickSize() const;
// These methods can be used to control animation loop cycles
void SetLoop(int32 on_count, int32 off_count);
int32 LoopOnCount() const;
int32 LoopOffCount() const;
private:
virtual void _ReservedScreenSaver1();
virtual void _ReservedScreenSaver2();
virtual void _ReservedScreenSaver3();
virtual void _ReservedScreenSaver4();
virtual void _ReservedScreenSaver5();
virtual void _ReservedScreenSaver6();
virtual void _ReservedScreenSaver7();
virtual void _ReservedScreenSaver8();
bigtime_t ticksize;
int32 looponcount;
int32 loopoffcount;
uint32 _reservedScreenSaver[6];
};
extern "C" _EXPORT BScreenSaver *instantiate_screen_saver(BMessage *msg, image_id id);
_EXPORT int32 saverVersionID;
#endif

View File

@ -0,0 +1,44 @@
/*******************************************************************************
/
/ File: Background.h
/
/ Description: Defines constants for setting Tracker background images
/
/ Copyright 1998-1999, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _TRACKER_BACKGROUND_H
#define _TRACKER_BACKGROUND_H
/*----------------------------------------------------------------*/
/*----- Tracker background attribute name ----------------------*/
#define B_BACKGROUND_INFO "be:bgndimginfo"
/*----------------------------------------------------------------*/
/*----- Tracker background BMessage entries --------------------*/
#define B_BACKGROUND_IMAGE "be:bgndimginfopath" // string path
#define B_BACKGROUND_MODE "be:bgndimginfomode" // int32, the enum below
#define B_BACKGROUND_ORIGIN "be:bgndimginfooffset" // BPoint
#define B_BACKGROUND_ERASE_TEXT "be:bgndimginfoerasetext" // bool
#define B_BACKGROUND_WORKSPACES "be:bgndimginfoworkspaces" // uint32
/*----------------------------------------------------------------*/
/*----- Background mode values ---------------------------------*/
enum {
B_BACKGROUND_MODE_USE_ORIGIN,
B_BACKGROUND_MODE_CENTERED, // only works on Desktop
B_BACKGROUND_MODE_SCALED, // only works on Desktop
B_BACKGROUND_MODE_TILED
};
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
const int32 B_RESTORE_BACKGROUND_IMAGE = 'Tbgr'; // force a Tracker window to
// use a new background image
#endif /* _TRACKER_BACKGROUND_H */

View File

@ -0,0 +1,27 @@
/******************************************************************************
/
/ File: TrackerAddOn.h
/
/ Description: Protocol for the process_refs() hook function.
/
/ Copyright 1995-98, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
#ifndef _TRACKER_ADDON_H
#define _TRACKER_ADDON_H
#include <BeBuild.h>
struct entry_ref;
class BMessage;
/*-------------------------------------------------------------*/
/*------- This is why you're here: ----------------------------*/
extern "C" _EXPORT void process_refs(entry_ref dir_ref, BMessage* msg, void*);
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _TRACKER_ADDON_H */

View File

@ -0,0 +1 @@
#include "TrackerAddOn.h"

View File

@ -0,0 +1,20 @@
#if !defined(_GRAPHIC_DRIVER_H_)
#define _GRAPHIC_DRIVER_H_
#include <Drivers.h>
/* The API for driver access is C, not C++ */
#ifdef __cplusplus
extern "C" {
#endif
enum {
B_GET_ACCELERANT_SIGNATURE = B_GRAPHIC_DRIVER_BASE
};
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,218 @@
/*******************************************************************************
/
/ File: ChannelControl.h
/
/ Description: BChannelControl is the base class for controls that
/ have several independent values, with minima and maxima.
/
/ Copyright 1998-99, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_CHANNEL_CONTROL_H)
#define _CHANNEL_CONTROL_H
#include <Control.h>
#include <String.h>
class BChannelControl :
public BControl
{
public:
BChannelControl(
BRect frame,
const char * name,
const char * label,
BMessage * model,
int32 channel_count = 1,
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
BChannelControl(
BMessage * from);
virtual ~BChannelControl();
virtual status_t Archive(
BMessage * into,
bool deep = true) const;
virtual void Draw(
BRect area) = 0;
virtual void MouseDown(
BPoint where) = 0;
virtual void KeyDown(
const char * bytes,
int32 size) = 0;
virtual void FrameResized(
float width,
float height);
virtual void SetFont(
const BFont * font,
uint32 mask = B_FONT_ALL);
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void ResizeToPreferred();
virtual void GetPreferredSize(
float * width,
float * height) = 0;
virtual void MessageReceived(
BMessage * message);
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual void SetModificationMessage(
BMessage *message);
BMessage *ModificationMessage() const;
virtual status_t Invoke(BMessage *msg = NULL);
// Perform a full-fledged channel invocation. These methods are
// just like Invoke() and InvokeNotify(), but include information
// about all of the channels in the control.
virtual status_t InvokeChannel(BMessage *msg = NULL,
int32 from_channel = 0,
int32 channel_count = -1,
const bool* in_mask = NULL);
status_t InvokeNotifyChannel(BMessage *msg = NULL,
uint32 kind = B_CONTROL_INVOKED,
int32 from_channel = 0,
int32 channel_count = -1,
const bool* in_mask = NULL);
virtual void SetValue( /* SetCurrentChannel() determines which channel */
int32 value);
virtual status_t SetCurrentChannel(
int32 channel);
int32 CurrentChannel() const;
virtual int32 CountChannels() const;
virtual int32 MaxChannelCount() const = 0;
virtual status_t SetChannelCount(
int32 channel_count);
int32 ValueFor(
int32 channel) const;
virtual int32 GetValue(
int32 * out_values,
int32 from_channel,
int32 channel_count) const;
status_t SetValueFor(
int32 channel,
int32 value);
virtual status_t SetValue(
int32 from_channel,
int32 channel_count,
const int32 * in_values);
status_t SetAllValue(
int32 values);
status_t SetLimitsFor(
int32 channel,
int32 minimum,
int32 maximum);
status_t GetLimitsFor(
int32 channel,
int32 * minimum,
int32 * maximum) const ;
virtual status_t SetLimitsFor(
int32 from_channel,
int32 channel_count,
const int32 * minimum,
const int32 * maximum);
virtual status_t GetLimitsFor(
int32 from_channel,
int32 channel_count,
int32 * minimum,
int32 * maximum) const;
status_t SetLimits(
int32 minimum,
int32 maximum);
status_t GetLimits(
int32 * outMinimum,
int32 * outMaximum) const;
virtual bool SupportsIndividualLimits() const = 0;
virtual status_t SetLimitLabels(
const char * min_label,
const char * max_label);
const char * MinLimitLabel() const;
const char * MaxLimitLabel() const;
virtual status_t SetLimitLabelsFor(
int32 channel,
const char * minLabel,
const char * maxLabel);
virtual status_t SetLimitLabelsFor(
int32 from_channel,
int32 channel_count,
const char * minLabel,
const char * maxLabel);
const char * MinLimitLabelFor(
int32 channel) const;
const char * MaxLimitLabelFor(
int32 channel) const;
private:
BChannelControl( /* unimplemented */
const BChannelControl &);
BChannelControl & operator=( /* unimplemented */
const BChannelControl &);
virtual status_t _Reserverd_ChannelControl_0(void *, ...);
virtual status_t _Reserverd_ChannelControl_1(void *, ...);
virtual status_t _Reserverd_ChannelControl_2(void *, ...);
virtual status_t _Reserverd_ChannelControl_3(void *, ...);
virtual status_t _Reserverd_ChannelControl_4(void *, ...);
virtual status_t _Reserverd_ChannelControl_5(void *, ...);
virtual status_t _Reserverd_ChannelControl_6(void *, ...);
virtual status_t _Reserverd_ChannelControl_7(void *, ...);
virtual status_t _Reserverd_ChannelControl_8(void *, ...);
virtual status_t _Reserverd_ChannelControl_9(void *, ...);
virtual status_t _Reserverd_ChannelControl_10(void *, ...);
virtual status_t _Reserverd_ChannelControl_11(void *, ...);
protected:
inline int32 * const & MinLimitList() const;
inline int32 * const & MaxLimitList() const;
inline int32 * const & ValueList() const;
private:
int32 _m_channel_count;
int32 _m_value_channel;
int32 * _m_channel_min;
int32 * _m_channel_max;
int32 * _m_channel_val;
BString _m_min_label;
BString _m_max_label;
void * _m_multi_labels;
BMessage * fModificationMsg;
uint32 _reserved_[15];
status_t StuffValues(
int32 from_channel,
int32 channel_count,
const int32 * in_values);
};
inline int32 * const & BChannelControl::MinLimitList() const
{
return _m_channel_min;
}
inline int32 * const & BChannelControl::MaxLimitList() const
{
return _m_channel_max;
}
inline int32 * const & BChannelControl::ValueList() const
{
return _m_channel_val;
}
#endif /* _CHANNEL_CONTROL_H */

View File

@ -0,0 +1,158 @@
/*******************************************************************************
/
/ File: ChannelSlider.h
/
/ Description: BChannelSlider implements a slider which can have a number
/ of (on-screen) related values. A typical use is for a stereo
/ volume control.
/
/ Copyright 1998-99, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_CHANNEL_SLIDER_H)
#define _CHANNEL_SLIDER_H
#include <ChannelControl.h>
class BChannelSlider :
public BChannelControl
{
public:
BChannelSlider(
BRect area,
const char * name,
const char * label,
BMessage * model,
int32 channels = 1,
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
BChannelSlider(
BRect area,
const char * name,
const char * label,
BMessage * model,
orientation o,
int32 channels = 1,
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
BChannelSlider(
BMessage * from);
virtual ~BChannelSlider();
static BArchivable * Instantiate(BMessage * from);
virtual status_t Archive(BMessage * into, bool deep = true) const;
virtual orientation Orientation() const;
void SetOrientation(orientation o);
virtual int32 MaxChannelCount() const;
virtual bool SupportsIndividualLimits() const;
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void DetachedFromWindow();
virtual void AllDetached();
virtual void MessageReceived(BMessage *msg);
virtual void Draw(BRect area);
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved( BPoint pt,
uint32 code,
const BMessage * message);
virtual void WindowActivated(bool state);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void KeyUp(const char *bytes, int32 numBytes);
virtual void FrameResized(float width, float height);
virtual void SetFont(const BFont *font, uint32 mask = B_FONT_ALL);
virtual void MakeFocus(bool focusState = true);
virtual void SetEnabled(bool on);
virtual void GetPreferredSize(float *width, float *height);
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
// Perform rendering for an entire slider channel.
virtual void DrawChannel(BView* into,
int32 channel,
BRect area,
bool pressed);
// Draw the groove that appears behind a channel's thumb.
virtual void DrawGroove( BView* into,
int32 channel,
BPoint tl,
BPoint br);
// Draw the thumb for a single channel.
virtual void DrawThumb( BView* into,
int32 channel,
BPoint where,
bool pressed );
virtual const BBitmap * ThumbFor(int32 channel, bool pressed);
virtual BRect ThumbFrameFor(int32 channel);
virtual float ThumbDeltaFor(int32 channel);
virtual float ThumbRangeFor(int32 channel);
private:
typedef BChannelControl inherited;
BChannelSlider( /* unimplemented */
const BChannelSlider &);
BChannelSlider& operator=( /* unimplemented */
const BChannelSlider &);
virtual status_t _Reserved_BChannelSlider_0(void *, ...);
virtual status_t _Reserved_BChannelSlider_1(void *, ...);
virtual status_t _Reserved_BChannelSlider_2(void *, ...);
virtual status_t _Reserved_BChannelSlider_3(void *, ...);
virtual status_t _Reserved_BChannelSlider_4(void *, ...);
virtual status_t _Reserved_BChannelSlider_5(void *, ...);
virtual status_t _Reserved_BChannelSlider_6(void *, ...);
virtual status_t _Reserved_BChannelSlider_7(void *, ...);
float _m_baseline;
float _m_linefeed;
BBitmap * _m_left_knob;
BBitmap * _m_mid_knob;
BBitmap * _m_right_knob;
BBitmap * _m_backing;
BView * _m_backing_view;
bool _m_vertical;
bool _m_padding_[3];
BPoint _m_click_delta;
int32 fCurrentChannel;
bool fAllChannels;
int32* fInitialValues;
float fMinpoint;
int32 fFocusChannel;
uint32 _reserved_[12];
void InitData();
void FinishChange();
void UpdateFontDimens();
void DrawThumbs();
void DrawThumbFrame(
BView * where,
const BRect & area);
bool Vertical();
void Redraw();
void MouseMovedCommon(BPoint , BPoint );
};
#endif /* _CHANNEL_SLIDER_H */

View File

@ -0,0 +1,169 @@
/*******************************************************************************
/
/ File: ColorControl.h
/
/ Description: BColorControl displays a palette of selectable colors.
/
/ Copyright 1996-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _COLOR_CONTROL_H
#define _COLOR_CONTROL_H
#include <BeBuild.h>
#include <Control.h>
class BBitmap;
/*------------------------------------------------------------*/
/*----- layout options for the color control -----------------*/
enum color_control_layout {
B_CELLS_4x64 = 4,
B_CELLS_8x32 = 8,
B_CELLS_16x16 = 16,
B_CELLS_32x8 = 32,
B_CELLS_64x4 = 64
};
class BTextControl;
/*----------------------------------------------------------------*/
/*----- BColorControl class --------------------------------------*/
class BColorControl : public BControl {
public:
BColorControl( BPoint start,
color_control_layout layout,
float cell_size,
const char *name,
BMessage *message = NULL,
bool use_offscreen = false);
virtual ~BColorControl();
BColorControl(BMessage *data);
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void SetValue(int32 color_value);
void SetValue(rgb_color color);
rgb_color ValueAsColor();
virtual void SetEnabled(bool state);
virtual void AttachedToWindow();
virtual void MessageReceived(BMessage *msg);
virtual void Draw(BRect updateRect);
virtual void MouseDown(BPoint where);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void SetCellSize(float size);
float CellSize() const;
virtual void SetLayout(color_control_layout layout);
color_control_layout Layout() const;
virtual void WindowActivated(bool state);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
virtual void DetachedFromWindow();
virtual void GetPreferredSize(float *width, float *height);
virtual void ResizeToPreferred();
virtual status_t Invoke(BMessage *msg = NULL);
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
/*----- Private or reserved -----------------------------------------*/
virtual status_t Perform(perform_code d, void *arg);
private:
virtual void _ReservedColorControl1();
virtual void _ReservedColorControl2();
virtual void _ReservedColorControl3();
virtual void _ReservedColorControl4();
BColorControl &operator=(const BColorControl &);
void LayoutView(bool calc_frame);
void UpdateOffscreen();
void UpdateOffscreen(BRect update);
void DrawColorArea(BView *target, BRect update);
void ColorRamp( BRect r,
BRect where,
BView *target,
rgb_color c,
int16 flag,
bool focused);
void KbAdjustColor(uint32 key);
bool key_down32(uint32 key);
bool key_down8(uint32 key);
static BRect CalcFrame( BPoint start,
color_control_layout layout,
int32 size);
void InitData( color_control_layout layout,
float size,
bool use_offscreen,
BMessage *data = NULL);
void DoMouseMoved(BPoint pt);
void DoMouseUp(BPoint pt);
float fCellSize;
int32 fRows;
int32 fColumns;
struct track_state {
int32 orig_color;
int32 cur_color;
int32 prev_color;
int32 bar_index;
BRect active_area;
BRect r;
rgb_color rgb;
color_space cspace;
};
BTextControl *fRedText;
BTextControl *fGreenText;
BTextControl *fBlueText;
BBitmap *fBitmap;
BView *fOffscreenView;
color_space fLastMode;
float fRound;
int32 fFocusedComponent;
int32 fCachedIndex;
uint32 _reserved[3];
track_state *fTState;
bool fUnused; // fTracking;
bool fFocused;
bool fRetainCache;
bool fFastSet;
};
/*------------------------------------------------------------*/
/*----- inline functions -------------------------------------*/
inline void BColorControl::SetValue(rgb_color color)
{
/* OK, no private parts */
int32 c = (color.red << 24) + (color.green << 16) + (color.blue << 8);
SetValue(c);
}
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _COLOR_CONTROL_H */

View File

@ -0,0 +1,126 @@
/*******************************************************************************
/
/ File: Dragger.h
/
/ Description: BDragger represents a replicant "handle."
/
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _DRAGGER_H
#define _DRAGGER_H
#include <BeBuild.h>
#include <Locker.h>
#include <List.h>
#include <View.h>
class BBitmap;
class BMessage;
class BShelf;
/*----------------------------------------------------------------*/
/*----- BDragger class -------------------------------------------*/
class BDragger : public BView {
public:
BDragger(BRect bounds,
BView *target,
uint32 rmask = B_FOLLOW_NONE,
uint32 flags = B_WILL_DRAW);
BDragger(BMessage *data);
virtual ~BDragger();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect update);
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
virtual void MessageReceived(BMessage *msg);
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
static status_t ShowAllDraggers(); /* system wide!*/
static status_t HideAllDraggers(); /* system wide!*/
static bool AreDraggersDrawn();
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual status_t Perform(perform_code d, void *arg);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float *width, float *height);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
status_t SetPopUp(BPopUpMenu *context_menu);
BPopUpMenu *PopUp() const;
bool InShelf() const;
BView *Target() const;
virtual BBitmap *DragBitmap(BPoint *offset, drawing_mode *mode);
protected:
bool IsVisibilityChanging() const;
/*----- Private or reserved -----------------------------------------*/
private:
friend class _TContainerViewFilter_;
friend class _rep_data_;
friend class BShelf;
friend void _toggle_handles_(bool);
//+virtual void _ReservedDragger1();
virtual void _ReservedDragger2();
virtual void _ReservedDragger3();
virtual void _ReservedDragger4();
BDragger &operator=(const BDragger &);
void ListManage(bool);
status_t determine_relationship();
status_t SetViewToDrag(BView *target);
void SetShelf(BShelf *);
void SetZombied(bool state);
void BuildDefaultPopUp();
void ShowPopUp(BView *target, BPoint where);
static bool sVisible;
static bool sInited;
static BLocker sLock;
static BList sList;
enum relation {
TARGET_UNKNOWN,
TARGET_IS_CHILD,
TARGET_IS_PARENT,
TARGET_IS_SIBLING
};
BView *fTarget;
relation fRelation;
BShelf *fShelf;
bool fTransition;
bool fIsZombie;
char fErrCount;
bool _unused2;
BBitmap *fBitmap;
BPopUpMenu *fPopUp;
uint32 _reserved[3]; /* was 4 */
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _DRAGGER_H */

299
headers/os/interface/Menu.h Normal file
View File

@ -0,0 +1,299 @@
/*******************************************************************************
/
/ File: Menu.h
/
/ Description: BMenu display a menu of selectable items.
/
/ Copyright 1994-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _MENU_H
#define _MENU_H
#include <BeBuild.h>
#include <InterfaceDefs.h>
#include <List.h>
#include <View.h>
/*----------------------------------------------------------------*/
/*----- Menu decalrations and structures -------------------------*/
class BMenuItem;
class BMenuBar;
class BMenuWindow;
class BMenuFrame;
class _ExtraMenuData_;
enum menu_layout {
B_ITEMS_IN_ROW = 0,
B_ITEMS_IN_COLUMN,
B_ITEMS_IN_MATRIX
};
struct menu_info {
float font_size;
font_family f_family;
font_style f_style;
rgb_color background_color;
int32 separator;
bool click_to_open;
bool triggers_always_shown;
};
_IMPEXP_BE status_t set_menu_info(menu_info *info);
_IMPEXP_BE status_t get_menu_info(menu_info *info);
typedef bool (* menu_tracking_hook )(BMenu *, void *);
/*----------------------------------------------------------------*/
/*----- BMenu class ----------------------------------------------*/
class BMenu : public BView
{
public:
BMenu( const char *title,
menu_layout layout = B_ITEMS_IN_COLUMN);
BMenu(const char *title, float width, float height);
virtual ~BMenu();
BMenu(BMessage *data);
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
bool AddItem(BMenuItem *item);
bool AddItem(BMenuItem *item, int32 index);
bool AddItem(BMenuItem *item, BRect frame);
bool AddItem(BMenu *menu);
bool AddItem(BMenu *menu, int32 index);
bool AddItem(BMenu *menu, BRect frame);
bool AddList(BList *list, int32 index);
bool AddSeparatorItem();
bool RemoveItem(BMenuItem *item);
BMenuItem *RemoveItem(int32 index);
bool RemoveItems(int32 index,
int32 count,
bool del = false);
bool RemoveItem(BMenu *menu);
BMenuItem *ItemAt(int32 index) const;
BMenu *SubmenuAt(int32 index) const;
int32 CountItems() const;
int32 IndexOf(BMenuItem *item) const;
int32 IndexOf(BMenu *menu) const;
BMenuItem *FindItem(uint32 command) const;
BMenuItem *FindItem(const char *name) const;
virtual status_t SetTargetForItems(BHandler *target);
virtual status_t SetTargetForItems(BMessenger messenger);
virtual void SetEnabled(bool state);
virtual void SetRadioMode(bool state);
virtual void SetTriggersEnabled(bool state);
virtual void SetMaxContentWidth(float max);
void SetLabelFromMarked(bool on);
bool IsLabelFromMarked();
bool IsEnabled() const;
bool IsRadioMode() const;
bool AreTriggersEnabled() const;
bool IsRedrawAfterSticky() const;
float MaxContentWidth() const;
BMenuItem *FindMarked();
BMenu *Supermenu() const;
BMenuItem *Superitem() const;
virtual void MessageReceived(BMessage *msg);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void Draw(BRect updateRect);
virtual void GetPreferredSize(float *width, float *height);
virtual void ResizeToPreferred();
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
void InvalidateLayout();
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual status_t Perform(perform_code d, void *arg);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
protected:
BMenu( BRect frame,
const char *viewName,
uint32 resizeMask,
uint32 flags,
menu_layout layout,
bool resizeToFit);
virtual BPoint ScreenLocation();
void SetItemMargins( float left,
float top,
float right,
float bottom);
void GetItemMargins( float *left,
float *top,
float *right,
float *bottom) const;
menu_layout Layout() const;
virtual void Show();
void Show(bool selectFirstItem);
void Hide();
BMenuItem *Track( bool start_opened = false,
BRect *special_rect = NULL);
public:
enum add_state {
B_INITIAL_ADD,
B_PROCESSING,
B_ABORT
};
virtual bool AddDynamicItem(add_state s);
virtual void DrawBackground(BRect update);
void SetTrackingHook(menu_tracking_hook func, void *state);
/*----- Private or reserved -----------------------------------------*/
private:
friend BWindow;
friend BMenuBar;
friend BMenuItem;
friend status_t _init_interface_kit_();
friend status_t set_menu_info(menu_info *);
friend status_t get_menu_info(menu_info *);
virtual void _ReservedMenu3();
virtual void _ReservedMenu4();
virtual void _ReservedMenu5();
virtual void _ReservedMenu6();
BMenu &operator=(const BMenu &);
void InitData(BMessage *data = NULL);
bool _show(bool selectFirstItem = false);
void _hide();
BMenuItem *_track(int *action, long start = -1);
bool _AddItem(BMenuItem *item, int32 index);
bool RemoveItems(int32 index,
int32 count,
BMenuItem *item,
bool del = false);
void LayoutItems(int32 index);
void ComputeLayout(int32 index, bool bestFit, bool moveItems,
float* width, float* height);
BRect Bump(BRect current, BPoint extent, int32 index) const;
BPoint ItemLocInRect(BRect frame) const;
BRect CalcFrame(BPoint where, bool *scrollOn);
bool ScrollMenu(BRect bounds, BPoint loc, bool *fast);
void ScrollIntoView(BMenuItem *item);
void DrawItems(BRect updateRect);
int State(BMenuItem **item = NULL) const;
void InvokeItem(BMenuItem *item, bool now = false);
bool OverSuper(BPoint loc);
bool OverSubmenu(BMenuItem *item, BPoint loc);
BMenuWindow *MenuWindow();
void DeleteMenuWindow();
BMenuItem *HitTestItems(BPoint where, BPoint slop = B_ORIGIN) const;
BRect Superbounds() const;
void CacheFontInfo();
void ItemMarked(BMenuItem *item);
void Install(BWindow *target);
void Uninstall();
void SelectItem( BMenuItem *m,
uint32 showSubmenu = 0,
bool selectFirstItem = false);
BMenuItem *CurrentSelection() const;
bool SelectNextItem(BMenuItem *item, bool forward);
BMenuItem *NextItem(BMenuItem *item, bool forward) const;
bool IsItemVisible(BMenuItem *item) const;
void SetIgnoreHidden(bool on);
void SetStickyMode(bool on);
bool IsStickyMode() const;
void CalcTriggers();
const char *ChooseTrigger(const char *title, BList *chars);
void UpdateWindowViewSize(bool upWind = true);
bool IsStickyPrefOn();
void RedrawAfterSticky(BRect bounds);
bool OkToProceed(BMenuItem *);
status_t ParseMsg(BMessage *msg, int32 *sindex, BMessage *spec,
int32 *form, const char **prop,
BMenu **tmenu, BMenuItem **titem, int32 *user_data,
BMessage *reply) const;
status_t DoMenuMsg(BMenuItem **next, BMenu *tar, BMessage *m,
BMessage *r, BMessage *spec, int32 f) const;
status_t DoMenuItemMsg(BMenuItem **next, BMenu *tar, BMessage *m,
BMessage *r, BMessage *spec, int32 f) const;
status_t DoEnabledMsg(BMenuItem *ti, BMenu *tm, BMessage *m,
BMessage *r) const;
status_t DoLabelMsg(BMenuItem *ti, BMenu *tm, BMessage *m,
BMessage *r) const;
status_t DoMarkMsg(BMenuItem *ti, BMenu *tm, BMessage *m,
BMessage *r) const;
status_t DoDeleteMsg(BMenuItem *ti, BMenu *tm, BMessage *m,
BMessage *r) const;
status_t DoCreateMsg(BMenuItem *ti, BMenu *tm, BMessage *m,
BMessage *r, bool menu) const;
static menu_info sMenuInfo;
static bool sSwapped;
BMenuItem *fChosenItem;
BList fItems;
BRect fPad;
BMenuItem *fSelected;
BMenuWindow *fCachedMenuWindow;
BMenu *fSuper;
BMenuItem *fSuperitem;
BRect fSuperbounds;
float fAscent;
float fDescent;
float fFontHeight;
uint32 fState;
menu_layout fLayout;
BRect *fExtraRect;
float fMaxContentWidth;
BPoint *fInitMatrixSize;
_ExtraMenuData_ *fExtraMenuData; // !!
uint32 _reserved[2];
char fTrigger;
bool fResizeToFit;
bool fUseCachedMenuLayout;
bool fEnabled;
bool fDynamicName;
bool fRadioMode;
bool fTrackNewBounds;
bool fStickyMode;
bool fIgnoreHidden;
bool fTriggerEnabled;
bool fRedrawAfterSticky;
bool fAttachAborted;
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _MENU_H */

View File

@ -0,0 +1,120 @@
/*******************************************************************************
/
/ File: Menubar.h
/
/ Description: BMenuBar is a menu that's at the root of a menu hierarchy.
/
/ Copyright 1994-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _MENU_BAR_H
#define _MENU_BAR_H
#include <BeBuild.h>
#include <InterfaceDefs.h>
#include <Menu.h>
#include <OS.h>
/*----------------------------------------------------------------*/
/*----- BmenuBar declarations ------------------------------------*/
enum menu_bar_border {
B_BORDER_FRAME,
B_BORDER_CONTENTS,
B_BORDER_EACH_ITEM
};
class BMenu;
class BWindow;
class BMenuItem;
class BMenuField;
/*----------------------------------------------------------------*/
/*----- BMenuBar class -------------------------------------------*/
class BMenuBar : public BMenu
{
public:
BMenuBar( BRect frame,
const char *title,
uint32 resizeMask =
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
menu_layout layout = B_ITEMS_IN_ROW,
bool resizeToFit = true);
BMenuBar(BMessage *data);
virtual ~BMenuBar();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void SetBorder(menu_bar_border border);
menu_bar_border Border() const;
virtual void Draw(BRect updateRect);
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void MessageReceived(BMessage *msg);
virtual void MouseDown(BPoint where);
virtual void WindowActivated(bool state);
virtual void MouseUp(BPoint where);
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
virtual void Show();
virtual void Hide();
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float *width, float *height);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
/*----- Private or reserved -----------------------------------------*/
virtual status_t Perform(perform_code d, void *arg);
private:
friend BWindow;
friend BMenuItem;
friend BMenuField;
friend BMenu;
virtual void _ReservedMenuBar1();
virtual void _ReservedMenuBar2();
virtual void _ReservedMenuBar3();
virtual void _ReservedMenuBar4();
BMenuBar &operator=(const BMenuBar &);
void StartMenuBar( int32 menuIndex,
bool sticky = true,
bool show_menu = false,
BRect *special_rect = NULL);
static long TrackTask(void *arg);
BMenuItem *Track( int32 *action,
int32 startIndex = -1,
bool showMenu = false);
void StealFocus();
void RestoreFocus();
void InitData(menu_layout layout);
menu_bar_border fBorder;
thread_id fTrackingPID;
int32 fPrevFocusToken;
sem_id fMenuSem;
BRect* fLastBounds;
uint32 _reserved[2]; // was 3
bool fTracking;
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _MENU_BAR_H */

View File

@ -0,0 +1,125 @@
/*******************************************************************************
/
/ File: MenuField.h
/
/ Description: BMenuField displays a labeled pop-up menu.
/
/ Copyright 1994-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _MENU_FIELD_H
#define _MENU_FIELD_H
#include <BeBuild.h>
#include <Menu.h> /* For convenience */
#include <View.h>
class BMenuBar;
/*----------------------------------------------------------------*/
/*----- BMenuField class -----------------------------------------*/
class BMenuField : public BView
{
public:
BMenuField( BRect frame,
const char *name,
const char *label,
BMenu *menu,
uint32 resize = B_FOLLOW_LEFT|B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BMenuField( BRect frame,
const char *name,
const char *label,
BMenu *menu,
bool fixed_size,
uint32 resize = B_FOLLOW_LEFT|B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BMenuField(BMessage *data);
virtual ~BMenuField();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void Draw(BRect update);
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void MouseDown(BPoint where);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void MakeFocus(bool state);
virtual void MessageReceived(BMessage *msg);
virtual void WindowActivated(bool state);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
virtual void DetachedFromWindow();
virtual void AllDetached();
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
BMenu *Menu() const;
BMenuBar *MenuBar() const;
BMenuItem *MenuItem() const;
virtual void SetLabel(const char *label);
const char *Label() const;
virtual void SetEnabled(bool on);
bool IsEnabled() const;
virtual void SetAlignment(alignment label);
alignment Alignment() const;
virtual void SetDivider(float dividing_line);
float Divider() const;
void ShowPopUpMarker();
void HidePopUpMarker();
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float *width, float *height);
/*----- Private or reserved -----------------------------------------*/
virtual status_t Perform(perform_code d, void *arg);
private:
friend class _BMCMenuBar_;
virtual void _ReservedMenuField1();
virtual void _ReservedMenuField2();
virtual void _ReservedMenuField3();
BMenuField &operator=(const BMenuField &);
void InitObject(const char *label);
void InitObject2();
void DrawLabel(BRect bounds, BRect update);
static void InitMenu(BMenu *menu);
static long MenuTask(void *arg);
char *fLabel;
BMenu *fMenu;
BMenuBar *fMenuBar;
alignment fAlign;
float fDivider;
float fStringWidth;
bool fEnabled;
bool fSelected;
bool fTransition;
bool fFixedSizeMB;
thread_id fMenuTaskID;
uint32 _reserved[3];
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _MENU_FIELD_H */

View File

@ -0,0 +1,148 @@
/*******************************************************************************
/
/ File: MenuItem.h
/
/ Description: BMenuItem represents a single item in a BMenu.
/ BSeparatorItem is a cosmetic menu item that demarcates
/ groups of other items.
/
/ Copyright 1994-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _MENU_ITEM_H
#define _MENU_ITEM_H
#include <BeBuild.h>
#include <InterfaceDefs.h>
#include <Archivable.h>
#include <Invoker.h>
#include <Menu.h> /* For convenience */
class BMessage;
class BWindow;
/*----------------------------------------------------------------*/
/*----- BMenuItem class ------------------------------------------*/
class BMenuItem : public BArchivable, public BInvoker {
public:
BMenuItem( const char *label,
BMessage *message,
char shortcut = 0,
uint32 modifiers = 0);
BMenuItem(BMenu *menu, BMessage *message = NULL);
BMenuItem(BMessage *data);
virtual ~BMenuItem();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void SetLabel(const char *name);
virtual void SetEnabled(bool state);
virtual void SetMarked(bool state);
virtual void SetTrigger(char ch);
virtual void SetShortcut(char ch, uint32 modifiers);
const char *Label() const;
bool IsEnabled() const;
bool IsMarked() const;
char Trigger() const;
char Shortcut(uint32 *modifiers = NULL) const;
BMenu *Submenu() const;
BMenu *Menu() const;
BRect Frame() const;
protected:
virtual void GetContentSize(float *width, float *height);
virtual void TruncateLabel(float max, char *new_label);
virtual void DrawContent();
virtual void Draw();
virtual void Highlight(bool on);
bool IsSelected() const;
BPoint ContentLocation() const;
/*----- Private or reserved -----------------------------------------*/
private:
friend BMenu;
friend BPopUpMenu;
friend BMenuBar;
virtual void _ReservedMenuItem1();
virtual void _ReservedMenuItem2();
virtual void _ReservedMenuItem3();
virtual void _ReservedMenuItem4();
BMenuItem(const BMenuItem &);
BMenuItem &operator=(const BMenuItem &);
void InitData();
void InitMenuData(BMenu *menu);
void Install(BWindow *window);
/*----- Protected function -----------------------------------------*/
protected:
virtual status_t Invoke(BMessage *msg = NULL);
/*----- Private or reserved -----------------------------------------*/
private:
void Uninstall();
void SetSuper(BMenu *super);
void Select(bool on);
void DrawMarkSymbol();
void DrawShortcutSymbol();
void DrawSubmenuSymbol();
void DrawControlChar(const char *control);
void SetSysTrigger(char ch);
char *fLabel;
BMenu *fSubmenu;
BWindow *fWindow;
BMenu *fSuper;
BRect fBounds;
uint32 fModifiers;
float fCachedWidth;
int16 fTriggerIndex;
char fUserTrigger;
char fSysTrigger;
char fShortcutChar;
bool fMark;
bool fEnabled;
bool fSelected;
uint32 _reserved[4];
};
/*----------------------------------------------------------------*/
/*----- BSeparatorItem class -------------------------------------*/
class BSeparatorItem : public BMenuItem
{
public:
BSeparatorItem();
BSeparatorItem(BMessage *data);
virtual ~BSeparatorItem();
virtual status_t Archive(BMessage *data, bool deep = true) const;
static BArchivable *Instantiate(BMessage *data);
virtual void SetEnabled(bool state);
protected:
virtual void GetContentSize(float *width, float *height);
virtual void Draw();
/*----- Private or reserved -----------------------------------------*/
private:
virtual void _ReservedSeparatorItem1();
virtual void _ReservedSeparatorItem2();
BSeparatorItem &operator=(const BSeparatorItem &);
uint32 _reserved[1];
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _MENU_ITEM_H */

View File

@ -0,0 +1,165 @@
/*******************************************************************************
/
/ File: MultiChannelControl.h
/
/ Description: BMultiChannelControl is the base class for controls that
/ have several independent values, with minima and maxima.
/
/ Copyright 1998-99, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_MULTI_CHANNEL_CONTROL_H)
#define _MULTI_CHANNEL_CONTROL_H
#include <Control.h>
class BMultiChannelControl :
public BControl
{
public:
BMultiChannelControl(
BRect frame,
const char * name,
const char * label,
BMessage * model,
int32 channel_count = 1,
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
BMultiChannelControl(
BMessage * from);
virtual ~BMultiChannelControl();
virtual status_t Archive(
BMessage * into,
bool deep = true) const;
virtual void Draw(
BRect area) = 0;
virtual void MouseDown(
BPoint where) = 0;
virtual void KeyDown(
const char * bytes,
int32 size) = 0;
virtual void FrameResized(
float width,
float height);
virtual void SetFont(
const BFont * font,
uint32 mask = B_FONT_ALL);
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void ResizeToPreferred();
virtual void GetPreferredSize(
float * width,
float * height) = 0;
virtual void MessageReceived(
BMessage * message);
virtual void SetValue( /* SetValueChannel() determines which channel */
int32 value);
virtual status_t SetCurrentChannel(
int32 channel);
int32 CurrentChannel() const;
virtual int32 CountChannels() const;
virtual int32 MaxChannelCount() const = 0;
virtual status_t SetChannelCount(
int32 channel_count);
int32 ValueFor(
int32 channel) const;
virtual int32 GetValues(
int32 * out_values,
int32 from_channel,
int32 channel_count) const;
status_t SetValueFor(
int32 channel,
int32 value);
virtual status_t SetValues(
int32 from_channel,
int32 channel_count,
const int32 * in_values);
status_t SetAllValues(
int32 values);
status_t SetLimitsFor(
int32 channel,
int32 minimum,
int32 maximum);
status_t GetLimitsFor(
int32 channel,
int32 * minimum,
int32 * maximum) const ;
virtual status_t SetLimits(
int32 from_channel,
int32 channel_count,
const int32 * minimum,
const int32 * maximum);
virtual status_t GetLimits(
int32 from_channel,
int32 channel_count,
int32 * minimum,
int32 * maximum) const;
status_t SetAllLimits(
int32 minimum,
int32 maximum);
virtual status_t SetLimitLabels(
const char * min_label,
const char * max_label);
const char * MinLimitLabel() const;
const char * MaxLimitLabel() const;
private:
BMultiChannelControl( /* unimplemented */
const BMultiChannelControl &);
BMultiChannelControl & operator=( /* unimplemented */
const BMultiChannelControl &);
virtual status_t _Reserverd_MultiChannelControl_0(void *, ...);
virtual status_t _Reserverd_MultiChannelControl_1(void *, ...);
virtual status_t _Reserverd_MultiChannelControl_2(void *, ...);
virtual status_t _Reserverd_MultiChannelControl_3(void *, ...);
virtual status_t _Reserverd_MultiChannelControl_4(void *, ...);
virtual status_t _Reserverd_MultiChannelControl_5(void *, ...);
virtual status_t _Reserverd_MultiChannelControl_6(void *, ...);
virtual status_t _Reserverd_MultiChannelControl_7(void *, ...);
protected:
inline int32 * const & MinLimitList() const;
inline int32 * const & MaxLimitList() const;
inline int32 * const & ValueList() const;
private:
int32 _m_channel_count;
int32 _m_value_channel;
int32 * _m_channel_min;
int32 * _m_channel_max;
int32 * _m_channel_val;
char * _m_min_label;
char * _m_max_label;
uint32 _reserved_[16];
};
inline int32 * const & BMultiChannelControl::MinLimitList() const
{
return _m_channel_min;
}
inline int32 * const & BMultiChannelControl::MaxLimitList() const
{
return _m_channel_max;
}
inline int32 * const & BMultiChannelControl::ValueList() const
{
return _m_channel_val;
}
#endif /* _MULTI_CHANNEL_CONTROL_H */

View File

@ -0,0 +1,95 @@
/*******************************************************************************
/
/ File: OptionControl.h
/
/ Description: A BOptionControl is an abstract interface for BControls that select
/ between a set of named values; the names are displayed to the user, but the
/ corresponding values are returned in Value().
/
/ Copyright 1997-99, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_OPTION_CONTROL_H)
#define _OPTION_CONTROL_H
#include <InterfaceDefs.h>
#include <Control.h>
enum {
B_OPTION_CONTROL_VALUE = '_BMV'
};
class BOptionControl :
public BControl
{
public:
BOptionControl(
BRect frame,
const char * name,
const char * label,
BMessage * message,
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
virtual ~BOptionControl();
virtual void MessageReceived(
BMessage * message);
status_t AddOption(
const char * name,
int32 value);
virtual bool GetOptionAt(
int32 index,
const char ** out_name,
int32 * out_value) = 0;
virtual void RemoveOptionAt(
int32 index) = 0;
virtual int32 CountOptions() const = 0;
virtual status_t AddOptionAt(
const char * name,
int32 value,
int32 index) = 0;
virtual int32 SelectedOption( // index >= 0 returned directly
const char ** name = 0,
int32 * value = 0) const = 0;
virtual status_t SelectOptionFor(
int32 value);
virtual status_t SelectOptionFor(
const char *name);
protected:
BMessage * MakeValueMessage(
int32 value);
private:
BOptionControl(); /* private unimplemented */
BOptionControl(
const BOptionControl & clone);
BOptionControl & operator=(
const BOptionControl & clone);
/* Mmmh, stuffing! */
virtual status_t _Reserved_OptionControl_0(void *, ...);
virtual status_t _Reserved_OptionControl_1(void *, ...);
virtual status_t _Reserved_OptionControl_2(void *, ...);
virtual status_t _Reserved_OptionControl_3(void *, ...);
virtual status_t _Reserved_OptionControl_4(void *, ...);
virtual status_t _Reserved_OptionControl_5(void *, ...);
virtual status_t _Reserved_OptionControl_6(void *, ...);
virtual status_t _Reserved_OptionControl_7(void *, ...);
virtual status_t _Reserved_OptionControl_8(void *, ...);
virtual status_t _Reserved_OptionControl_9(void *, ...);
virtual status_t _Reserved_OptionControl_10(void *, ...);
virtual status_t _Reserved_OptionControl_11(void *, ...);
uint32 _reserved_selection_control_[8];
};
#endif /* _OPTION_CONTROL_H */

View File

@ -0,0 +1,105 @@
/*******************************************************************************
/
/ File: OptionPopUp.h
/
/ Description: A BOptionPopUp is a BControl that has a popup menu.
/
/ Copyright 1997-99, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_OPTION_POP_UP_H)
#define _OPTION_POP_UP_H
#include <OptionControl.h>
class BMenuField;
class BOptionPopUp :
public BOptionControl
{
public:
BOptionPopUp(
BRect frame,
const char * name,
const char * label,
BMessage * message,
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
BOptionPopUp(
BRect frame,
const char * name,
const char * label,
BMessage * message,
bool fixed,
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
~BOptionPopUp();
BMenuField * MenuField();
virtual bool GetOptionAt(
int32 index,
const char ** out_name,
int32 * out_value);
virtual void RemoveOptionAt(
int32 index);
virtual int32 CountOptions() const;
virtual status_t AddOptionAt(
const char * name,
int32 value,
int32 index);
virtual void AllAttached();
virtual void MessageReceived(
BMessage * message);
virtual void SetLabel(
const char *text);
virtual void SetValue(
int32 value);
virtual void SetEnabled(
bool on);
virtual void GetPreferredSize(
float *width,
float *height);
virtual void ResizeToPreferred();
virtual int32 SelectedOption(
const char ** outName = 0,
int32 * outValue = 0) const;
private:
BOptionPopUp(); /* private unimplemented */
BOptionPopUp(
const BOptionPopUp & clone);
BOptionPopUp & operator=(
const BOptionPopUp & clone);
/* Mmmh, stuffing! */
virtual status_t _Reserved_OptionControl_0(void *, ...);
virtual status_t _Reserved_OptionControl_1(void *, ...);
virtual status_t _Reserved_OptionControl_2(void *, ...);
virtual status_t _Reserved_OptionControl_3(void *, ...);
/* Mmmh, stuffing! */
virtual status_t _Reserved_OptionPopUp_0(void *, ...);
virtual status_t _Reserved_OptionPopUp_1(void *, ...);
virtual status_t _Reserved_OptionPopUp_2(void *, ...);
virtual status_t _Reserved_OptionPopUp_3(void *, ...);
virtual status_t _Reserved_OptionPopUp_4(void *, ...);
virtual status_t _Reserved_OptionPopUp_5(void *, ...);
virtual status_t _Reserved_OptionPopUp_6(void *, ...);
virtual status_t _Reserved_OptionPopUp_7(void *, ...);
BMenuField * _mField;
uint32 _reserved_menu_control_[8];
};
#endif /* _OPTION_POP_UP_H */

View File

@ -0,0 +1,156 @@
/*******************************************************************************
/
/ File: OutlineListView.h
/
/ Description: BOutlineListView represents a "nestable" list view.
/
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _OUTLINE_LIST_VIEW_H
#define _OUTLINE_LIST_VIEW_H
#include <BeBuild.h>
#include <ListView.h>
class BListItem;
/*----------------------------------------------------------------*/
/*----- BOutlineListView class -----------------------------------*/
class BOutlineListView : public BListView {
public:
BOutlineListView(BRect frame,
const char * name,
list_view_type type = B_SINGLE_SELECTION_LIST,
uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
| B_NAVIGABLE);
BOutlineListView(BMessage *data);
virtual ~BOutlineListView();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void MouseDown(BPoint where);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
virtual void MouseUp(BPoint where);
virtual bool AddUnder(BListItem *item, BListItem *underItem);
virtual bool AddItem(BListItem *item);
virtual bool AddItem(BListItem *item, int32 fullListIndex);
virtual bool AddList(BList *newItems);
virtual bool AddList(BList *newItems, int32 fullListIndex);
virtual bool RemoveItem(BListItem *item);
virtual BListItem *RemoveItem(int32 fullListIndex);
virtual bool RemoveItems(int32 fullListIndex, int32 count);
/* The following calls operator on the full outlinelist */
BListItem *FullListItemAt(int32 fullListIndex) const;
int32 FullListIndexOf(BPoint point) const;
int32 FullListIndexOf(BListItem *item) const;
BListItem *FullListFirstItem() const;
BListItem *FullListLastItem() const;
bool FullListHasItem(BListItem *item) const;
int32 FullListCountItems() const;
int32 FullListCurrentSelection(int32 index = 0) const;
virtual void MakeEmpty();
bool FullListIsEmpty() const;
void FullListDoForEach(bool (*func)(BListItem *));
void FullListDoForEach(bool (*func)(BListItem *, void *), void*);
BListItem *Superitem(const BListItem *item);
void Expand(BListItem *item);
void Collapse(BListItem *item);
bool IsExpanded(int32 fullListIndex);
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual status_t Perform(perform_code d, void *arg);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float *width, float *height);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
virtual void DetachedFromWindow();
void FullListSortItems(int (*compareFunc)(const BListItem *,
const BListItem *));
void SortItemsUnder(BListItem *underItem,
bool oneLevelOnly,
int (*compareFunc)(const BListItem *,
const BListItem*));
int32 CountItemsUnder(BListItem *under, bool oneLevelOnly) const;
BListItem *EachItemUnder(BListItem *underItem,
bool oneLevelOnly,
BListItem *(*eachFunc)(BListItem *, void *),
void *);
BListItem *ItemUnderAt(BListItem *underItem,
bool oneLevelOnly,
int32 index) const;
protected:
virtual bool DoMiscellaneous(MiscCode code, MiscData * data);
virtual void MessageReceived(BMessage *);
/*----- Private or reserved -----------------------------------------*/
private:
virtual void _ReservedOutlineListView1();
virtual void _ReservedOutlineListView2();
virtual void _ReservedOutlineListView3();
virtual void _ReservedOutlineListView4();
typedef BListView _inherited;
int32 FullListIndex(int32 index) const;
int32 ListViewIndex(int32 index) const;
#if !_PR3_COMPATIBLE_
protected:
#endif
virtual void ExpandOrCollapse(BListItem *underItem, bool expand);
private:
virtual BRect LatchRect(BRect itemRect, int32 level) const;
virtual void DrawLatch(BRect itemRect, int32 level, bool collapsed,
bool highlighted, bool misTracked);
virtual void DrawItem(BListItem *i, BRect cRect, bool complete = false);
BListItem *RemoveCommon(int32 fullListIndex);
BListItem *RemoveOne(int32 fullListIndex);
static void TrackInLatchItem(void *);
static void TrackOutLatchItem(void *);
bool OutlineSwapItems(int32 a, int32 b);
bool OutlineMoveItem(int32 from, int32 to);
bool OutlineReplaceItem(int32 index, BListItem *item);
void CommonMoveItems(int32 from, int32 count, int32 to);
BListItem *SuperitemForIndex(int32 fullListIndex, int32 level);
int32 FindPreviousVisibleIndex(int32 fullListIndex);
BList fullList;
uint32 _reserved[2];
};
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
#endif /* _OUTLINE_LIST_VIEW_H */

View File

@ -0,0 +1,81 @@
/*******************************************************************************
/
/ File: Picture.h
/
/ Description: BPicture records a series of drawing instructions that can
/ be "replayed" later.
/
/ Copyright 1995-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _PICTURE_H
#define _PICTURE_H
#include <BeBuild.h>
#include <InterfaceDefs.h>
#include <Rect.h>
#include <Archivable.h>
class BView;
struct _BPictureExtent_;
/*----------------------------------------------------------------*/
/*----- BPicture class -------------------------------------------*/
class BPicture : public BArchivable {
public:
BPicture();
BPicture(const BPicture &original);
BPicture(BMessage *data);
virtual ~BPicture();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual status_t Perform(perform_code d, void *arg);
status_t Play(void **callBackTable,
int32 tableEntries,
void *userData);
status_t Flatten(BDataIO *stream);
status_t Unflatten(BDataIO *stream);
/*----- Private or reserved -----------------------------------------*/
private:
friend class BWindow;
friend class BView;
friend class BPrintJob;
virtual void _ReservedPicture1();
virtual void _ReservedPicture2();
virtual void _ReservedPicture3();
BPicture &operator=(const BPicture &);
void init_data();
void import_data(const void *data, int32 size, BPicture **subs, int32 subCount);
void import_old_data(const void *data, int32 size);
void set_token(int32 token);
bool assert_local_copy();
bool assert_old_local_copy();
bool assert_server_copy();
/**Deprecated API**/
BPicture(const void *data, int32 size);
const void *Data() const;
int32 DataSize() const;
void usurp(BPicture *lameDuck);
BPicture *step_down();
int32 token;
_BPictureExtent_ *extent;
BPicture *usurped;
uint32 _reserved[3];
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _PICTURE_H */

View File

@ -0,0 +1,105 @@
/*******************************************************************************
/
/ File: PopUpMenu.h
/
/ Description: BPopUpMenu represents a menu that pops up when you
/ activate it.
/
/ Copyright 1994-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _POP_UP_MENU_H
#define _POP_UP_MENU_H
#include <BeBuild.h>
#include <Menu.h>
/*----------------------------------------------------------------*/
/*----- BPopUpMenu class -----------------------------------------*/
class BPopUpMenu : public BMenu
{
public:
BPopUpMenu( const char *title,
bool radioMode = true,
bool autoRename = true,
menu_layout layout = B_ITEMS_IN_COLUMN
);
BPopUpMenu(BMessage *data);
virtual ~BPopUpMenu();
virtual status_t Archive(BMessage *data, bool deep = true) const;
static BArchivable *Instantiate(BMessage *data);
BMenuItem *Go(BPoint where,
bool delivers_message = false,
bool open_anyway = false,
bool async = false);
BMenuItem *Go(BPoint where,
bool delivers_message,
bool open_anyway,
BRect click_to_open,
bool async = false);
virtual void MessageReceived(BMessage *msg);
virtual void MouseDown(BPoint pt);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual status_t Perform(perform_code d, void *arg);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float *width, float *height);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
void SetAsyncAutoDestruct(bool state);
bool AsyncAutoDestruct() const;
protected:
virtual BPoint ScreenLocation();
virtual void _ReservedPopUpMenu1();
virtual void _ReservedPopUpMenu2();
virtual void _ReservedPopUpMenu3();
BPopUpMenu &operator=(const BPopUpMenu &);
/*----- Private or reserved -----------------------------------------*/
private:
BMenuItem *_go( BPoint where,
bool autoInvoke,
bool start_opened,
BRect *special_rect,
bool async);
static int32 entry(void *);
BMenuItem *start_track(BPoint where,
bool autoInvoke,
bool start_opened,
BRect *special_rect);
BPoint fWhere;
bool fUseWhere;
bool fAutoDestruct;
bool _fUnusedBool1;
bool _fUnusedBool2;
thread_id fTrackThread;
uint32 _reserved[3];
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _POP_UP_MENU_H */

View File

@ -0,0 +1,106 @@
/*******************************************************************************
/
/ File: Region.h
/
/ Description: BRegion represents an area that's composed of individual
/ rectangles.
/
/ Copyright 1992-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _REGION_H
#define _REGION_H
#include <BeBuild.h>
#include <Rect.h>
/* Integer rect used to define a cliping rectangle. All bounds are included */
/* Moved from DirectWindow.h */
typedef struct {
int32 left;
int32 top;
int32 right;
int32 bottom;
} clipping_rect;
/*----------------------------------------------------------------*/
/*----- BRegion class --------------------------------------------*/
class BRegion {
public:
BRegion();
BRegion(const BRegion &region);
BRegion(const BRect rect);
virtual ~BRegion();
BRegion &operator=(const BRegion &from);
BRect Frame() const;
clipping_rect FrameInt() const;
BRect RectAt(int32 index);
clipping_rect RectAtInt(int32 index);
int32 CountRects();
void Set(BRect newBounds);
void Set(clipping_rect newBounds);
bool Intersects(BRect r) const;
bool Intersects(clipping_rect r) const;
bool Contains(BPoint pt) const;
bool Contains(int32 x, int32 y);
void PrintToStream() const;
void OffsetBy(int32 dh, int32 dv);
void MakeEmpty();
void Include(BRect r);
void Include(clipping_rect r);
void Include(const BRegion*);
void Exclude(BRect r);
void Exclude(clipping_rect r);
void Exclude(const BRegion*);
void IntersectWith(const BRegion*);
/*----- Private or reserved -----------------------------------------*/
private:
friend class BView;
friend class BDirectWindow;
friend void zero_region(BRegion *a_region);
friend void clear_region(BRegion *a_region);
friend void cleanup_region_1(BRegion *region_in);
friend void cleanup_region(BRegion *region_in);
friend void sort_rects(clipping_rect *rects, long count);
friend void sort_trans(long *lptr1, long *lptr2, long count);
friend void cleanup_region_horizontal(BRegion *region_in);
friend void copy_region(BRegion *src_region, BRegion *dst_region);
friend void copy_region_n(BRegion*, BRegion*, long);
friend void and_region_complex(BRegion*, BRegion*, BRegion*);
friend void and_region_1_to_n(BRegion*, BRegion*, BRegion*);
friend void and_region(BRegion*, BRegion*, BRegion*);
friend void append_region(BRegion*, BRegion*, BRegion*);
friend void r_or(long, long, BRegion*, BRegion*, BRegion*, long*, long *);
friend void or_region_complex(BRegion*, BRegion*, BRegion*);
friend void or_region_1_to_n(BRegion*, BRegion*, BRegion*);
friend void or_region_no_x(BRegion*, BRegion*, BRegion*);
friend void or_region(BRegion*, BRegion*, BRegion*);
friend void sub(long, long, BRegion*, BRegion*, BRegion*, long*, long*);
friend void sub_region_complex(BRegion*, BRegion*, BRegion*);
friend void r_sub(long , long, BRegion*, BRegion*, BRegion*, long*, long*);
friend void sub_region(BRegion*, BRegion*, BRegion*);
void _AddRect(clipping_rect r);
void set_size(long new_size);
long find_small_bottom(long y1, long y2, long *hint, long *where);
private:
long count;
long data_size;
clipping_rect bound;
clipping_rect *data;
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _REGION_H */

View File

@ -0,0 +1,101 @@
/*******************************************************************************
/
/ File: Screen.h
/
/ Description: BScreen provides information about a screen's current
/ display settings. It also lets you set the Desktop color.
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _SCREEN_H
#define _SCREEN_H
#include <BeBuild.h>
#include <Accelerant.h>
#include <GraphicsDefs.h>
#include <Rect.h>
#include <OS.h>
/*----------------------------------------------------------------*/
/*----- BScreen structures and declarations ----------------------*/
class BWindow;
class BPrivateScreen;
/*----------------------------------------------------------------*/
/*----- BScreen class --------------------------------------------*/
class BScreen {
public:
BScreen( screen_id id=B_MAIN_SCREEN_ID );
BScreen( BWindow *win );
~BScreen();
bool IsValid();
status_t SetToNext();
color_space ColorSpace();
BRect Frame();
screen_id ID();
status_t WaitForRetrace();
status_t WaitForRetrace(bigtime_t timeout);
uint8 IndexForColor( rgb_color rgb );
uint8 IndexForColor( uint8 r, uint8 g, uint8 b, uint8 a=255 );
rgb_color ColorForIndex( const uint8 index );
uint8 InvertIndex( uint8 index );
const color_map* ColorMap();
status_t GetBitmap( BBitmap **screen_shot,
bool draw_cursor = true,
BRect *bound = NULL);
status_t ReadBitmap( BBitmap *buffer,
bool draw_cursor = true,
BRect *bound = NULL);
rgb_color DesktopColor();
rgb_color DesktopColor(uint32 index);
void SetDesktopColor( rgb_color rgb, bool stick=true );
void SetDesktopColor( rgb_color rgb, uint32 index, bool stick=true );
status_t ProposeMode(display_mode *target, const display_mode *low, const display_mode *high);
status_t GetModeList(display_mode **mode_list, uint32 *count);
status_t GetMode(display_mode *mode);
status_t GetMode(uint32 workspace, display_mode *mode);
status_t SetMode(display_mode *mode, bool makeDefault = false);
status_t SetMode(uint32 workspace, display_mode *mode, bool makeDefault = false);
status_t GetDeviceInfo(accelerant_device_info *adi);
status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
status_t GetTimingConstraints(display_timing_constraints *dtc);
status_t SetDPMS(uint32 dpms_state);
uint32 DPMSState(void);
uint32 DPMSCapabilites(void);
BPrivateScreen* private_screen();
/*----- Private or reserved -----------------------------------------*/
private:
status_t ProposeDisplayMode(display_mode *target, const display_mode *low, const display_mode *high);
BScreen &operator=(const BScreen &screen);
BScreen(const BScreen &screen);
void* BaseAddress();
uint32 BytesPerRow();
BPrivateScreen *screen;
};
/*----------------------------------------------------------------*/
/*----- inline definitions ---------------------------------------*/
inline uint8 BScreen::IndexForColor( rgb_color rgb )
{ return IndexForColor(rgb.red,rgb.green,rgb.blue,rgb.alpha); }
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _SCREEN_H */

View File

@ -0,0 +1,110 @@
/*******************************************************************************
/
/ File: ScrollBar.h
/
/ Description: BScrollBar displays and controls a scrollbar.
/
/ Copyright 1992-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _SCROLL_BAR_H
#define _SCROLL_BAR_H
#include <BeBuild.h>
#include <View.h>
/*----------------------------------------------------------------*/
/*----- scroll bar defines ---------------------------------------*/
#define B_V_SCROLL_BAR_WIDTH 14.0
#define B_H_SCROLL_BAR_HEIGHT 14.0
/*----------------------------------------------------------------*/
/*----- BScrollBar class -----------------------------------------*/
class BScrollBar : public BView {
public:
BScrollBar( BRect frame,
const char *name,
BView *target,
float min,
float max,
orientation direction);
BScrollBar(BMessage *data);
virtual ~BScrollBar();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void AttachedToWindow();
void SetValue(float value);
float Value() const;
void SetProportion(float);
float Proportion() const;
virtual void ValueChanged(float newValue);
void SetRange(float min, float max);
void GetRange(float *min, float *max) const;
void SetSteps(float smallStep, float largeStep);
void GetSteps(float *smallStep, float *largeStep) const;
void SetTarget(BView *target);
void SetTarget(const char *targetName);
BView *Target() const;
orientation Orientation() const;
virtual void MessageReceived(BMessage *msg);
virtual void MouseDown(BPoint pt);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
virtual void DetachedFromWindow();
virtual void Draw(BRect updateRect);
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float *width, float *height);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
virtual status_t GetSupportedSuites(BMessage *data);
/*----- Private or reserved -----------------------------------------*/
virtual status_t Perform(perform_code d, void *arg);
private:
friend class BWindow;
friend class BApplication;
virtual void _ReservedScrollBar1();
virtual void _ReservedScrollBar2();
virtual void _ReservedScrollBar3();
virtual void _ReservedScrollBar4();
BScrollBar &operator=(const BScrollBar &);
void InitObject(float min, float max, orientation o, BView *t);
float fMin;
float fMax;
float fSmallStep;
float fLargeStep;
float fValue;
float fProportion;
BView* fTarget;
orientation fOrientation;
char *fTargetName;
uint32 _reserved[4];
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _SCROLL_BAR_H */

View File

@ -0,0 +1,106 @@
/*******************************************************************************
/
/ File: ScrollView.h
/
/ Description: BScrollView provides scrolling machinery for its contents
/ (where the "contents" is some other view).
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _SCROLL_VIEW_H
#define _SCROLL_VIEW_H
#include <BeBuild.h>
#include <ScrollBar.h> /* For convenience */
#include <View.h>
/*----------------------------------------------------------------*/
/*----- BScrollView class ----------------------------------------*/
class BScrollView : public BView {
public:
BScrollView(const char *name,
BView *target,
uint32 resizeMask = B_FOLLOW_LEFT |
B_FOLLOW_TOP,
uint32 flags = 0,
bool horizontal = false,
bool vertical = false,
border_style border = B_FANCY_BORDER);
BScrollView(BMessage *data);
virtual ~BScrollView();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void Draw(BRect updateRect);
virtual void AttachedToWindow();
BScrollBar *ScrollBar(orientation flag) const;
virtual void SetBorder(border_style border);
border_style Border() const;
virtual status_t SetBorderHighlighted(bool state);
bool IsBorderHighlighted() const;
void SetTarget(BView *new_target);
BView *Target() const;
virtual void MessageReceived(BMessage *msg);
virtual void MouseDown(BPoint pt);
virtual void WindowActivated(bool state);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float *width, float *height);
virtual void MakeFocus(bool state = true);
virtual status_t GetSupportedSuites(BMessage *data);
/*----- Private or reserved -----------------------------------------*/
virtual status_t Perform(perform_code d, void *arg);
private:
friend class BView;
virtual void _ReservedScrollView1();
virtual void _ReservedScrollView2();
virtual void _ReservedScrollView3();
virtual void _ReservedScrollView4();
BScrollView &operator=(const BScrollView &);
static BRect CalcFrame(BView *, bool, bool, border_style);
int32 ModFlags(int32, border_style);
void InitObject();
BView *fTarget;
BScrollBar *fHSB;
BScrollBar *fVSB;
border_style fBorder;
uint16 fPrevWidth;
uint16 fPrevHeight;
uint32 _reserved[3]; /* was 4 */
bool fHighlighted;
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _SCROLL_VIEW_H */

View File

@ -0,0 +1,97 @@
/*******************************************************************************
/
/ File: Shape.h
/
/ Description: BShape encapsulates a Postscript-style "path"
/
/ Copyright 1992-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _SHAPE_H
#define _SHAPE_H
#include <BeBuild.h>
#include <Archivable.h>
/*----------------------------------------------------------------*/
/*----- BShapeIterator class -------------------------------------*/
class BShapeIterator {
public:
BShapeIterator();
virtual ~BShapeIterator();
virtual status_t IterateMoveTo(BPoint *point);
virtual status_t IterateLineTo(int32 lineCount, BPoint *linePts);
virtual status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPts);
virtual status_t IterateClose();
status_t Iterate(BShape *shape);
private:
virtual void _ReservedShapeIterator1();
virtual void _ReservedShapeIterator2();
virtual void _ReservedShapeIterator3();
virtual void _ReservedShapeIterator4();
uint32 reserved[4];
};
/*----------------------------------------------------------------*/
/*----- BShape class ---------------------------------------------*/
class BShape : public BArchivable {
public:
BShape();
BShape(const BShape &copyFrom);
BShape(BMessage *data);
virtual ~BShape();
virtual status_t Archive(BMessage *into, bool deep = true) const;
static BArchivable *Instantiate(BMessage *data);
void Clear();
BRect Bounds() const;
status_t AddShape(const BShape *other);
status_t MoveTo(BPoint point);
status_t LineTo(BPoint linePoint);
status_t BezierTo(BPoint controlPoints[3]);
status_t Close();
/*----- Private or reserved ---------------*/
virtual status_t Perform(perform_code d, void *arg);
private:
virtual void _ReservedShape1();
virtual void _ReservedShape2();
virtual void _ReservedShape3();
virtual void _ReservedShape4();
friend BShapeIterator;
friend class TPicture;
friend BView;
friend class BFont;
void GetData(int32 *opCount, int32 *ptCount, uint32 **opList, BPoint **ptList);
void SetData(int32 opCount, int32 ptCount, uint32 *opList, BPoint *ptList);
void InitData();
uint32 fState;
uint32 fBuildingOp;
void * fPrivateData;
uint32 reserved[4];
public:
/*----- Deprecated ---------------*/
BShape(BShape &copyFrom);
BRect Bounds();
status_t AddShape(BShape *other);
};
#endif

View File

@ -0,0 +1,145 @@
/*******************************************************************************
/
/ File: Shelf.h
/
/ Description: BShelf stores replicant views that are dropped onto it
/
/ Copyright 1996-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _SHELF_H
#define _SHELF_H
#include <BeBuild.h>
#include <Handler.h>
#include <List.h>
class BDataIO;
class BView;
class BEntry;
extern "C" void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
const BMessage*, const BView*);
/*----------------------------------------------------------------*/
/*----- BShelf class ---------------------------------------------*/
class BShelf : public BHandler {
public:
BShelf(BView *view,
bool allow_drags = true,
const char *shelf_type = NULL);
BShelf(const entry_ref *ref,
BView *view,
bool allow_drags = true,
const char *shelf_type = NULL);
BShelf(BDataIO *stream,
BView *view,
bool allow_drags = true,
const char *shelf_type = NULL);
BShelf(BMessage *data);
virtual ~BShelf();
virtual status_t Archive(BMessage *data, bool deep = true) const;
static BArchivable *Instantiate(BMessage *data);
virtual void MessageReceived(BMessage *msg);
status_t Save();
virtual void SetDirty(bool state);
bool IsDirty() const;
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual status_t Perform(perform_code d, void *arg);
bool AllowsDragging() const;
void SetAllowsDragging(bool state);
bool AllowsZombies() const;
void SetAllowsZombies(bool state);
bool DisplaysZombies() const;
void SetDisplaysZombies(bool state);
bool IsTypeEnforced() const;
void SetTypeEnforced(bool state);
status_t SetSaveLocation(BDataIO *data_io);
status_t SetSaveLocation(const entry_ref *ref);
BDataIO *SaveLocation(entry_ref *ref) const;
status_t AddReplicant(BMessage *data, BPoint location);
status_t DeleteReplicant(BView *replicant);
status_t DeleteReplicant(BMessage *data);
status_t DeleteReplicant(int32 index);
int32 CountReplicants() const;
BMessage *ReplicantAt(int32 index,
BView **view = NULL,
uint32 *uid = NULL,
status_t *perr = NULL) const;
int32 IndexOf(const BView *replicant_view) const;
int32 IndexOf(const BMessage *archive) const;
int32 IndexOf(uint32 id) const;
protected:
virtual bool CanAcceptReplicantMessage(BMessage*) const;
virtual bool CanAcceptReplicantView(BRect, BView*, BMessage*) const;
virtual BPoint AdjustReplicantBy(BRect, BMessage*) const;
virtual void ReplicantDeleted(int32 index,
const BMessage *archive,
const BView *replicant);
/*----- Private or reserved -----------------------------------------*/
private:
friend class _TContainerViewFilter_;
friend void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
const BMessage*, const BView*);
virtual void _ReservedShelf2();
virtual void _ReservedShelf3();
virtual void _ReservedShelf4();
virtual void _ReservedShelf5();
#if !_PR3_COMPATIBLE_
virtual void _ReservedShelf6();
virtual void _ReservedShelf7();
virtual void _ReservedShelf8();
#endif
BShelf(const BShelf&);
BShelf &operator=(const BShelf &);
status_t _Archive(BMessage *data) const;
void InitData(BEntry *entry,
BDataIO *stream,
BView *view,
bool allow_drags);
status_t RealAddReplicant(BMessage *data,
BPoint *loc,
uint32 uid);
status_t GetProperty(BMessage *msg, BMessage *reply);
BView *fContainerView;
BDataIO *fStream;
BEntry *fEntry;
BList fReplicants;
_TContainerViewFilter_ *fFilter;
uint32 fGenCount;
bool fAllowDragging;
bool fDirty;
bool fDisplayZombies;
bool fAllowZombies;
bool fTypeEnforced;
uint32 _reserved[3]; /* was 5 */
#if !_PR3_COMPATIBLE_
uint32 _more_reserved[5];
#endif
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _SHELF_H */

View File

@ -0,0 +1,427 @@
/*******************************************************************************
/
/ File: TextView.h
/
/ Description: BTextView displays and manages styled text.
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _TEXTVIEW_H
#define _TEXTVIEW_H
#include <BeBuild.h>
#include <View.h>
/*----------------------------------------------------------------*/
/*----- BTextView structures and definitions ---------------------*/
struct text_run {
int32 offset; /* byte offset of first character of run*/
BFont font; /* font of run*/
rgb_color color; /* color of run*/
};
struct text_run_array {
int32 count; /* number of text runs*/
text_run runs[1]; /* array of count number of runs*/
};
enum undo_state {
B_UNDO_UNAVAILABLE,
B_UNDO_TYPING,
B_UNDO_CUT,
B_UNDO_PASTE,
B_UNDO_CLEAR,
B_UNDO_DROP
};
#if _PR2_COMPATIBLE_
extern "C" void _ReservedTextView2__9BTextViewFv(BTextView *object,
BMessage *drag,
BBitmap **bitmap,
BPoint *point,
BHandler **handler);
#endif
class BBitmap;
class BClipboard;
class BFile;
class BList;
class _BTextGapBuffer_;
class _BLineBuffer_;
class _BStyleBuffer_;
class _BWidthBuffer_;
class _BUndoBuffer_;
class _BInlineInput_;
class _BTextTrackState_;
class _BTextChangeResult_;
extern "C" status_t _init_interface_kit_();
/*----------------------------------------------------------------*/
/*----- BTextView class ------------------------------------------*/
class BTextView : public BView {
public:
BTextView(BRect frame,
const char *name,
BRect textRect,
uint32 resizeMask,
uint32 flags = B_WILL_DRAW | B_PULSE_NEEDED);
BTextView(BRect frame,
const char *name,
BRect textRect,
const BFont *initialFont,
const rgb_color *initialColor,
uint32 resizeMask,
uint32 flags);
BTextView(BMessage *data);
virtual ~BTextView();
static BArchivable* Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect inRect);
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where,
uint32 code,
const BMessage *message);
virtual void WindowActivated(bool state);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void Pulse();
virtual void FrameResized(float width, float height);
virtual void MakeFocus(bool focusState = true);
virtual void MessageReceived(BMessage *message);
virtual BHandler* ResolveSpecifier(BMessage *message,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual status_t Perform(perform_code d, void *arg);
void SetText(const char *inText,
const text_run_array *inRuns = NULL);
void SetText(const char *inText,
int32 inLength,
const text_run_array *inRuns = NULL);
void SetText(BFile *inFile,
int32 startOffset,
int32 inLength,
const text_run_array *inRuns = NULL);
void Insert(const char *inText,
const text_run_array *inRuns = NULL);
void Insert(const char *inText,
int32 inLength,
const text_run_array *inRuns = NULL);
void Insert(int32 startOffset,
const char *inText,
int32 inLength,
const text_run_array *inRuns = NULL);
void Delete();
void Delete(int32 startOffset, int32 endOffset);
const char* Text() const;
int32 TextLength() const;
void GetText(int32 offset,
int32 length,
char *buffer) const;
uchar ByteAt(int32 offset) const;
int32 CountLines() const;
int32 CurrentLine() const;
void GoToLine(int32 lineNum);
virtual void Cut(BClipboard *clipboard);
virtual void Copy(BClipboard *clipboard);
virtual void Paste(BClipboard *clipboard);
void Clear();
virtual bool AcceptsPaste(BClipboard *clipboard);
virtual bool AcceptsDrop(const BMessage *inMessage);
virtual void Select(int32 startOffset, int32 endOffset);
void SelectAll();
void GetSelection(int32 *outStart, int32 *outEnd) const;
void SetFontAndColor(const BFont *inFont,
uint32 inMode = B_FONT_ALL,
const rgb_color *inColor = NULL);
void SetFontAndColor(int32 startOffset,
int32 endOffset,
const BFont *inFont,
uint32 inMode = B_FONT_ALL,
const rgb_color *inColor = NULL);
void GetFontAndColor(int32 inOffset,
BFont *outFont,
rgb_color *outColor = NULL) const;
void GetFontAndColor(BFont *outFont,
uint32 *outMode,
rgb_color *outColor = NULL,
bool *outEqColor = NULL) const;
void SetRunArray(int32 startOffset,
int32 endOffset,
const text_run_array *inRuns);
text_run_array* RunArray(int32 startOffset,
int32 endOffset,
int32 *outSize = NULL) const;
int32 LineAt(int32 offset) const;
int32 LineAt(BPoint point) const;
BPoint PointAt(int32 inOffset, float *outHeight = NULL) const;
int32 OffsetAt(BPoint point) const;
int32 OffsetAt(int32 line) const;
virtual void FindWord(int32 inOffset,
int32 *outFromOffset,
int32 *outToOffset);
virtual bool CanEndLine(int32 offset);
float LineWidth(int32 lineNum = 0) const;
float LineHeight(int32 lineNum = 0) const;
float TextHeight(int32 startLine, int32 endLine) const;
void GetTextRegion(int32 startOffset,
int32 endOffset,
BRegion *outRegion) const;
virtual void ScrollToOffset(int32 inOffset);
void ScrollToSelection();
void Highlight(int32 startOffset, int32 endOffset);
void SetTextRect(BRect rect);
BRect TextRect() const;
void SetStylable(bool stylable);
bool IsStylable() const;
void SetTabWidth(float width);
float TabWidth() const;
void MakeSelectable(bool selectable = true);
bool IsSelectable() const;
void MakeEditable(bool editable = true);
bool IsEditable() const;
void SetWordWrap(bool wrap);
bool DoesWordWrap() const;
void SetMaxBytes(int32 max);
int32 MaxBytes() const;
void DisallowChar(uint32 aChar);
void AllowChar(uint32 aChar);
void SetAlignment(alignment flag);
alignment Alignment() const;
void SetAutoindent(bool state);
bool DoesAutoindent() const;
void SetColorSpace(color_space colors);
color_space ColorSpace() const;
void MakeResizable(bool resize, BView *resizeView = NULL);
bool IsResizable() const;
void SetDoesUndo(bool undo);
bool DoesUndo() const;
void HideTyping(bool enabled);
bool IsTypingHidden(void) const;
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float *width, float *height);
virtual void AllAttached();
virtual void AllDetached();
static void* FlattenRunArray(const text_run_array *inArray,
int32 *outSize = NULL);
static text_run_array* UnflattenRunArray(const void *data,
int32 *outSize = NULL);
protected:
virtual void InsertText(const char *inText,
int32 inLength,
int32 inOffset,
const text_run_array *inRuns);
virtual void DeleteText(int32 fromOffset, int32 toOffset);
public:
virtual void Undo(BClipboard *clipboard);
undo_state UndoState(bool *isRedo) const;
protected:
virtual void GetDragParameters(BMessage *drag,
BBitmap **bitmap,
BPoint *point,
BHandler **handler);
/*----- Private or reserved -----------------------------------------*/
private:
friend status_t _init_interface_kit_();
friend class _BTextTrackState_;
#if _PR2_COMPATIBLE_
friend void _ReservedTextView2__9BTextViewFv(BTextView *object,
BMessage *drag,
BBitmap **bitmap,
BPoint *point,
BHandler **handler);
#endif
virtual void _ReservedTextView3();
virtual void _ReservedTextView4();
virtual void _ReservedTextView5();
virtual void _ReservedTextView6();
virtual void _ReservedTextView7();
virtual void _ReservedTextView8();
#if !_PR3_COMPATIBLE_
virtual void _ReservedTextView9();
virtual void _ReservedTextView10();
virtual void _ReservedTextView11();
virtual void _ReservedTextView12();
#endif
void InitObject(BRect textRect,
const BFont *initialFont,
const rgb_color *initialColor);
void HandleBackspace();
void HandleArrowKey(uint32 inArrowKey);
void HandleDelete();
void HandlePageKey(uint32 inPageKey);
void HandleAlphaKey(const char *bytes, int32 numBytes);
void Refresh(int32 fromOffset,
int32 toOffset,
bool erase,
bool scroll);
void RecalLineBreaks(int32 *startLine, int32 *endLine);
int32 FindLineBreak(int32 fromOffset,
float *outAscent,
float *outDescent,
float *ioWidth);
float StyledWidth(int32 fromOffset,
int32 length,
float *outAscent = NULL,
float *outDescent = NULL) const;
float ActualTabWidth(float location) const;
void DoInsertText(const char *inText,
int32 inLength,
int32 inOffset,
const text_run_array *inRuns,
_BTextChangeResult_ *outResult);
void DoDeleteText(int32 fromOffset,
int32 toOffset,
_BTextChangeResult_ *outResult);
void DrawLines(int32 startLine,
int32 endLine,
int32 startOffset = -1,
bool erase = false);
void DrawCaret(int32 offset);
void InvertCaret();
void DragCaret(int32 offset);
void StopMouseTracking();
bool PerformMouseUp(BPoint where);
bool PerformMouseMoved(BPoint where,
uint32 code);
void TrackMouse(BPoint where, const BMessage *message,
bool force = false);
void TrackDrag(BPoint where);
void InitiateDrag();
bool MessageDropped(BMessage *inMessage,
BPoint where,
BPoint offset);
void UpdateScrollbars();
void AutoResize();
void NewOffscreen(float padding = 0.0F);
void DeleteOffscreen();
void Activate();
void Deactivate();
void NormalizeFont(BFont *font);
uint32 CharClassification(int32 offset) const;
int32 NextInitialByte(int32 offset) const;
int32 PreviousInitialByte(int32 offset) const;
bool GetProperty(BMessage *specifier,
int32 form,
const char *property,
BMessage *reply);
bool SetProperty(BMessage *specifier,
int32 form,
const char *property,
BMessage *reply);
bool CountProperties(BMessage *specifier,
int32 form,
const char *property,
BMessage *reply);
void HandleInputMethodChanged(BMessage *message);
void HandleInputMethodLocationRequest();
void CancelInputMethod();
static void LockWidthBuffer();
static void UnlockWidthBuffer();
_BTextGapBuffer_* fText;
_BLineBuffer_* fLines;
_BStyleBuffer_* fStyles;
BRect fTextRect;
int32 fSelStart;
int32 fSelEnd;
bool fCaretVisible;
bigtime_t fCaretTime;
int32 fClickOffset;
int32 fClickCount;
bigtime_t fClickTime;
int32 fDragOffset;
uint8 fCursor;
bool fActive;
bool fStylable;
float fTabWidth;
bool fSelectable;
bool fEditable;
bool fWrap;
int32 fMaxBytes;
BList* fDisallowedChars;
alignment fAlignment;
bool fAutoindent;
BBitmap* fOffscreen;
color_space fColorSpace;
bool fResizable;
BView* fContainerView;
_BUndoBuffer_* fUndo; /* was _reserved[0] */
_BInlineInput_* fInline; /* was _reserved[1] */
BMessageRunner * fDragRunner; /* was _reserved[2] */
BMessageRunner * fClickRunner; /* was _reserved[3] */
BPoint fWhere;
_BTextTrackState_* fTrackingMouse; /* was _reserved[6] */
_BTextChangeResult_* fTextChange; /* was _reserved[7] */
uint32 _reserved[1]; /* was 8 */
#if !_PR3_COMPATIBLE_
uint32 _more_reserved[8];
#endif
static _BWidthBuffer_* sWidths;
static sem_id sWidthSem;
static int32 sWidthAtom;
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _TEXT_VIEW_H */

View File

@ -0,0 +1,44 @@
/*******************************************************************************
/
/ File: fs_query.h
/
/ Description: C interface to the BeOS file system query mechanism.
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
#ifndef _FS_QUERY_H
#define _FS_QUERY_H
#include <BeBuild.h>
#include <OS.h>
#include <dirent.h>
/* flags for fs_open_query() */
#define B_LIVE_QUERY 0x00000001
#ifdef __cplusplus
extern "C" {
#endif
_IMPEXP_ROOT DIR *fs_open_query(dev_t device, const char *query, uint32 flags);
_IMPEXP_ROOT DIR *fs_open_live_query(dev_t device, const char *query,
uint32 flags, port_id port, int32 token);
_IMPEXP_ROOT int fs_close_query(DIR *d);
_IMPEXP_ROOT struct dirent *fs_read_query(DIR *d);
_IMPEXP_ROOT status_t get_path_for_dirent(struct dirent *dent, char *buf,
size_t len);
#ifdef __cplusplus
}
#endif
#endif /* _FS_QUERY_H */

View File

@ -0,0 +1,54 @@
/*****************************************************************************
File: scheduler.h
Description: Scheduling inquiry functions
Copyright 1998-, Be Incorporated, All Rights Reserved.
*****************************************************************************/
#if !defined(SCHEDULER_H)
#define SCHEDULER_H
#include <SupportDefs.h>
#include <OS.h>
/* To get a good thread priority, call suggest_thread_priority() with the following information: */
/* 'what' is a bit mask describing what you're doing in the thread. */
/* 'period' is how many times a second your thread needs to run (-1 if you're running continuously.) */
/* 'jitter' is an estimate (in us) of how much that period can vary, as long as it stays centered on the average. */
/* 'length' is how long (in us) you expect to run for each invocation. */
/* "invocation" means, typically, receiving a message, dispatching it, and then returning to reading a message. */
/* MANIPULATION means both filtering and compression/decompression. */
/* PLAYBACK and RECORDING means threads feeding/reading ACTUAL HARDWARE ONLY. */
/* 0 means don't care */
enum be_task_flags { /* bitmasks for "what" */
B_DEFAULT_MEDIA_PRIORITY = 0,
B_OFFLINE_PROCESSING = 0x1,
B_STATUS_RENDERING = 0x2, /* can also use this for "preview" type things */
B_USER_INPUT_HANDLING = 0x4,
B_LIVE_VIDEO_MANIPULATION = 0x8, /* non-live processing is OFFLINE_PROCESSING */
B_VIDEO_PLAYBACK = 0x10, /* feeding hardware */
B_VIDEO_RECORDING = 0x20, /* grabbing from hardware */
B_LIVE_AUDIO_MANIPULATION = 0x40, /* non-live processing is OFFLINE_PROCESSING */
B_AUDIO_PLAYBACK = 0x80, /* feeding hardware */
B_AUDIO_RECORDING = 0x100, /* grabbing from hardware */
B_LIVE_3D_RENDERING = 0x200, /* non-live rendering is OFFLINE_PROCESSING */
B_NUMBER_CRUNCHING = 0x400,
B_MIDI_PROCESSING = 0x800
};
#if defined(__cplusplus)
extern "C" {
_IMPEXP_ROOT int32 suggest_thread_priority(uint32 task_flags = B_DEFAULT_MEDIA_PRIORITY,
int32 period = 0, bigtime_t jitter = 0, bigtime_t length = 0);
_IMPEXP_ROOT bigtime_t estimate_max_scheduling_latency(thread_id th = -1); /* default is current thread */
}
#else
_IMPEXP_ROOT int32 suggest_thread_priority(uint32 what, int32 period, bigtime_t jitter, bigtime_t length);
_IMPEXP_ROOT bigtime_t estimate_max_scheduling_latency(thread_id th); /* default is current thread */
#endif
#endif /* SCHEDULER_H */

View File

@ -0,0 +1,33 @@
/***************************************************************************
//
// File: Alias.h
//
// Description: path->alias->path functions
//
// Copyright 1992-98, Be Incorporated, All Rights Reserved.
//
***************************************************************************/
#ifndef _ALIAS_H
#define _ALIAS_H
#ifndef _BE_BUILD_H
#include <BeBuild.h>
#endif
#include <SupportDefs.h>
class BPath;
class BDataIO;
_IMPEXP_BE status_t resolve_link(const char *path, BPath *result,
bool block = false);
_IMPEXP_BE status_t write_alias(const char *path, BDataIO *s,
size_t *len = NULL);
_IMPEXP_BE status_t write_alias(const char *path, void *buf, size_t *len);
_IMPEXP_BE status_t read_alias(BDataIO *s, BPath *result, size_t *len = NULL,
bool block = false);
_IMPEXP_BE status_t read_alias(const void *buf, BPath *result, size_t *len,
bool block = false);
#endif

View File

@ -0,0 +1,151 @@
/*******************************************************************************
/
/ File: FilePanel.h
/
/ Description: BFilePanel and BRefFilter classes, and
/ run_open_panel()/run_save_panel functions.
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
#ifndef _FILE_PANEL_H
#define _FILE_PANEL_H
#ifndef _BE_BUILD_H
#include <BeBuild.h>
#endif
#include <sys/stat.h>
#include <Entry.h>
#include <Directory.h>
#include <Node.h>
/*- Old fashioned, one-shot, heavily-defaulted panel functions. -*/
extern _IMPEXP_TRACKER void run_open_panel();
extern _IMPEXP_TRACKER void run_save_panel();
/*---BRefFilter--------------------------------------------------*/
/* BRefFilter is used by BFilePanel. Every time the user selects
* an item in a file panel, the Filter() func is sent to the
* panel's BRefFilter object. Filter()'s return value determines
* whether the item is admitted into the panel's list of
* displayed items. Optional.
*/
class BRefFilter {
public:
virtual bool Filter(const entry_ref *, BNode *, struct stat *,
const char *mimetype) = 0;
};
/*---File Panel constants etc------------------------------------*/
enum file_panel_mode {
B_OPEN_PANEL,
B_SAVE_PANEL
};
enum file_panel_button {
B_CANCEL_BUTTON,
B_DEFAULT_BUTTON
};
class BWindow;
class BMessenger;
class BMessage;
/*---------------------------------------------------------------*/
/*----BFilePanel-------------------------------------------------*/
/* Most of the contructor parameters can also be set through individual
* funcs. But these can't:
*
* file_panel_mode mode
* uint32 node_flavors
* bool modal
*/
class BFilePanel {
public:
BFilePanel(file_panel_mode mode = B_OPEN_PANEL,
BMessenger *target = 0,
const entry_ref *start_directory = 0,
uint32 node_flavors = 0,
bool allow_multiple_selection = true,
BMessage *message = 0,
BRefFilter * = 0,
bool modal = false,
bool hide_when_done = true);
virtual ~BFilePanel();
void Show();
void Hide();
bool IsShowing() const;
virtual void WasHidden();
virtual void SelectionChanged();
virtual void SendMessage(const BMessenger*, BMessage*);
BWindow* Window() const;
BMessenger Messenger() const;
BRefFilter* RefFilter() const;
void GetPanelDirectory(entry_ref *) const;
file_panel_mode PanelMode() const;
void SetTarget(BMessenger);
void SetMessage(BMessage *msg);
void SetRefFilter(BRefFilter* filter);
void SetSaveText(const char* text);
void SetButtonLabel(file_panel_button, const char *label);
void SetPanelDirectory(const BEntry *new_directory);
void SetPanelDirectory(const BDirectory *new_directory);
void SetPanelDirectory(const entry_ref *new_directory);
void SetPanelDirectory(const char *new_directory);
void SetHideWhenDone(bool);
bool HidesWhenDone(void) const;
void Refresh();
void Rewind();
status_t GetNextSelectedRef(entry_ref*);
private:
#if !_PR3_COMPATIBLE_
virtual void _ReservedFilePanel1();
virtual void _ReservedFilePanel2();
virtual void _ReservedFilePanel3();
virtual void _ReservedFilePanel4();
virtual void _ReservedFilePanel5();
virtual void _ReservedFilePanel6();
virtual void _ReservedFilePanel7();
virtual void _ReservedFilePanel8();
#endif
BWindow *fWindow;
#if !_PR3_COMPATIBLE_
uint32 _reserved[10];
#endif
public:
// deprecated calls, do not use
BFilePanel(file_panel_mode mode, BMessenger *, entry_ref *,
uint32 , bool, BMessage *, BRefFilter *, bool modal,
bool hide_when_done);
void SetPanelDirectory(BEntry*);
void SetPanelDirectory(BDirectory*);
void SetPanelDirectory(entry_ref*);
};
#endif

View File

@ -0,0 +1,76 @@
/***************************************************************************
//
// File: NodeMonitor.h
//
// Description: The Node Monitor
//
// Copyright 1992-98, Be Incorporated, All Rights Reserved.
//
***************************************************************************/
#ifndef _NODE_MONITOR_H
#define _NODE_MONITOR_H
#ifndef _BE_BUILD_H
#include <BeBuild.h>
#endif
#include <StorageDefs.h>
#include <Node.h>
#include <Messenger.h>
class BLooper;
class BHandler;
_IMPEXP_BE status_t watch_node(const node_ref *node,
uint32 flags,
BMessenger target);
_IMPEXP_BE status_t watch_node(const node_ref *node,
uint32 flags,
const BHandler *handler,
const BLooper *looper = NULL);
_IMPEXP_BE status_t stop_watching(BMessenger target);
_IMPEXP_BE status_t stop_watching(const BHandler *handler,
const BLooper *looper=NULL);
/* Flags for the watch_node() call.
* Note that B_WATCH_MOUNT is NOT included in
* B_WATCH_ALL -- the latter is a convenience
* for watching all watchable state changes for
* a specific node. Watching for volumes
* being mounted and unmounted (B_WATCH_MOUNT)
* is in a category by itself.
*
* BVolumeRoster provides a handy cover for
* volume watching.
*/
enum {
B_STOP_WATCHING = 0x0000,
B_WATCH_NAME = 0x0001,
B_WATCH_STAT = 0x0002,
B_WATCH_ATTR = 0x0004,
B_WATCH_DIRECTORY = 0x0008,
B_WATCH_ALL = 0x000f,
B_WATCH_MOUNT = 0x0010
};
/* When a node monitor notification
* returns to the target, the "opcode" field
* will hold one of these values. The other
* fields in the message tell you which
* node (or device) changed. See the documentation
* for the names of these other fields.
*/
#define B_ENTRY_CREATED 1
#define B_ENTRY_REMOVED 2
#define B_ENTRY_MOVED 3
#define B_STAT_CHANGED 4
#define B_ATTR_CHANGED 5
#define B_DEVICE_MOUNTED 6
#define B_DEVICE_UNMOUNTED 7
#endif

29
headers/os/support/Beep.h Normal file
View File

@ -0,0 +1,29 @@
/******************************************************************************
/
/ File: Beep.h
/
/ Description: System beep function.
/
/ Copyright 1993-98, Be Incorporated
/
******************************************************************************/
#ifndef _BEEP_H
#define _BEEP_H
#include <BeBuild.h>
#include <SupportDefs.h>
_IMPEXP_BE status_t beep();
_IMPEXP_BE status_t system_beep(const char * event_name);
#if defined(__cplusplus)
#define _BEEP_FLAGS = 0
#else
#define _BEEP_FLAGS
#endif
_IMPEXP_BE status_t add_system_beep_event(const char * event_name, uint32 flags _BEEP_FLAGS);
#endif /* _BEEP_H */

View File

@ -0,0 +1,73 @@
/******************************************************************************
/
/ File: BufferIO.h
/
/ Description: A buffered adapter for BPositionIO
/
/ Copyright 1998, Be Incorporated
/
******************************************************************************/
#if !defined(_BUFFER_IO_H)
#define _BUFFER_IO_H
#include <DataIO.h>
class BBufferIO : public BPositionIO
{
public:
enum {
DEFAULT_BUF_SIZE = 65536L
};
BBufferIO(
BPositionIO * stream,
size_t buf_size = DEFAULT_BUF_SIZE,
bool owns_stream = true);
virtual ~BBufferIO();
virtual ssize_t ReadAt(
off_t pos,
void *buffer,
size_t size);
virtual ssize_t WriteAt(
off_t pos,
const void *buffer,
size_t size);
virtual off_t Seek(
off_t position,
uint32 seek_mode);
virtual off_t Position() const;
virtual status_t SetSize(
off_t size);
virtual status_t Flush();
BPositionIO * Stream() const;
size_t BufferSize() const;
bool OwnsStream() const;
void SetOwnsStream(
bool owns_stream);
void PrintToStream() const;
private:
off_t m_buffer_start;
BPositionIO * m_stream;
char * m_buffer;
size_t m_buffer_phys;
size_t m_buffer_used;
uint32 _reserved_ints[6];
bool m_buffer_dirty;
bool m_owns_stream;
bool _reserved_bools[6];
virtual status_t _Reserved_BufferIO_0(void *);
virtual status_t _Reserved_BufferIO_1(void *);
virtual status_t _Reserved_BufferIO_2(void *);
virtual status_t _Reserved_BufferIO_3(void *);
virtual status_t _Reserved_BufferIO_4(void *);
};
#endif /* _BUFFER_IO_H */

114
headers/os/support/Debug.h Normal file
View File

@ -0,0 +1,114 @@
/******************************************************************************
/
/ File: Debug.h
/
/ Description: Compile time and runtime switchable debug macros.
/
/ Copyright 1993-98, Be Incorporated
/
******************************************************************************/
#ifndef _DEBUG_H
#define _DEBUG_H
#include <BeBuild.h>
#include <SupportDefs.h>
#include <stdarg.h>
#include <stdio.h>
#include <malloc.h>
#include <OS.h>
/*------------------------------*/
/*----- Private... -------------*/
#ifdef __cplusplus
extern "C" {
#endif
extern _IMPEXP_ROOT bool _rtDebugFlag;
_IMPEXP_ROOT bool _debugFlag();
_IMPEXP_ROOT bool _setDebugFlag(bool);
_IMPEXP_ROOT int _debugPrintf(const char *, ...);
_IMPEXP_ROOT int _sPrintf(const char *, ...);
_IMPEXP_ROOT int _xdebugPrintf(const char *, ...);
_IMPEXP_ROOT int _debuggerAssert(const char *, int, char *);
#ifdef __cplusplus
}
#endif
/*-------- ...to here ----------*/
/*-------------------------------------------------------------*/
/*----- Debug macros ------------------------------------------*/
#if DEBUG
#define SET_DEBUG_ENABLED(FLAG) _setDebugFlag(FLAG)
#define IS_DEBUG_ENABLED() _debugFlag()
#define SERIAL_PRINT(ARGS) _sPrintf ARGS
#define PRINT(ARGS) _debugPrintf ARGS
#define PRINT_OBJECT(OBJ) if (_rtDebugFlag) { \
PRINT(("%s\t", #OBJ)); \
(OBJ).PrintToStream(); \
} ((void) 0)
#define TRACE() _debugPrintf("File: %s, Line: %d, Thread: %d\n", \
__FILE__, __LINE__, find_thread(NULL))
#define SERIAL_TRACE() _sPrintf("File: %s, Line: %d, Thread: %d\n", \
__FILE__, __LINE__, find_thread(NULL))
#define DEBUGGER(MSG) if (_rtDebugFlag) debugger(MSG)
#if !defined(ASSERT)
#define ASSERT(E) (!(E) ? _debuggerAssert(__FILE__,__LINE__, #E) \
: (int)0)
#endif
#define ASSERT_WITH_MESSAGE(expr, msg) \
(!(expr) ? _debuggerAssert( __FILE__,__LINE__, msg) \
: (int)0)
#define TRESPASS() DEBUGGER("Should not be here");
#define DEBUG_ONLY(arg) arg
#else /* DEBUG == 0 */
#define SET_DEBUG_ENABLED(FLAG) (void)0
#define IS_DEBUG_ENABLED() (void)0
#define SERIAL_PRINT(ARGS) (void)0
#define PRINT(ARGS) (void)0
#define PRINT_OBJECT(OBJ) (void)0
#define TRACE() (void)0
#define SERIAL_TRACE() (void)0
#define DEBUGGER(MSG) (void)0
#if !defined(ASSERT)
#define ASSERT(E) (void)0
#endif
#define ASSERT_WITH_MESSAGE(expr, msg) \
(void)0
#define TRESPASS() (void)0
#define DEBUG_ONLY(x)
#endif
#if !__MWERKS__
// STATIC_ASSERT is a compile-time check that can be used to
// verify static expressions such as: STATIC_ASSERT(sizeof(int64) == 8);
#define STATIC_ASSERT(x) \
do { \
struct __staticAssertStruct__ { \
char __static_assert_failed__[2*(x) - 1]; \
}; \
} while (false)
#else
#define STATIC_ASSERT(x)
// the STATIC_ASSERT above doesn't work too well with mwcc because
// of scoping bugs; for now make it do nothing
#endif
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _DEBUG_H */

51
headers/os/support/TLS.h Normal file
View File

@ -0,0 +1,51 @@
#ifndef _TLS_H
#define _TLS_H 1
#include <BeBuild.h>
#include <SupportDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
extern _IMPEXP_ROOT int32 tls_allocate(void);
#if __INTEL__
static inline void * tls_get(int32 index) {
void *ret;
__asm__ __volatile__ (
"movl %%fs:(,%%edx, 4), %%eax \n\t"
: "=a"(ret) : "d"(index) );
return ret;
}
static inline void * tls_address(int32 index) {
void *ret;
__asm__ __volatile__ (
"movl %%fs:0, %%eax \n\t"
"leal (%%eax, %%edx, 4), %%eax \n\t"
: "=a"(ret) : "d"(index) );
return ret;
}
static inline void tls_set(int32 index, void *value) {
__asm__ __volatile__ (
"movl %%eax, %%fs:(,%%edx, 4) \n\t"
: : "d"(index), "a"(value) );
}
#else
extern _IMPEXP_ROOT void * tls_get(int32 index);
extern _IMPEXP_ROOT void ** tls_address(int32 index);
extern _IMPEXP_ROOT void tls_set(int32 index, void *value);
#endif
#ifdef __cplusplus
}
#endif
#endif

67
headers/os/support/UTF8.h Normal file
View File

@ -0,0 +1,67 @@
/******************************************************************************
/
/ File: UTF8.h
/
/ Description: UTF-8 conversion functions.
/
/ Copyright 1993-98, Be Incorporated
/
******************************************************************************/
#ifndef _UTF8_H
#define _UTF8_H
#include <BeBuild.h>
#include <InterfaceDefs.h>
#include <SupportDefs.h>
/*------------------------------------------------------------*/
/*------- Conversion Flavors ---------------------------------*/
enum {
B_ISO1_CONVERSION, /* ISO 8859-1 */
B_ISO2_CONVERSION, /* ISO 8859-2 */
B_ISO3_CONVERSION, /* ISO 8859-3 */
B_ISO4_CONVERSION, /* ISO 8859-4 */
B_ISO5_CONVERSION, /* ISO 8859-5 */
B_ISO6_CONVERSION, /* ISO 8859-6 */
B_ISO7_CONVERSION, /* ISO 8859-7 */
B_ISO8_CONVERSION, /* ISO 8859-8 */
B_ISO9_CONVERSION, /* ISO 8859-9 */
B_ISO10_CONVERSION, /* ISO 8859-10 */
B_MAC_ROMAN_CONVERSION, /* Macintosh Roman */
B_SJIS_CONVERSION, /* Shift-JIS */
B_EUC_CONVERSION, /* EUC Packed Japanese */
B_JIS_CONVERSION, /* JIS X 0208-1990 */
B_MS_WINDOWS_CONVERSION, /* MS-Windows Codepage 1252 */
B_UNICODE_CONVERSION, /* Unicode 2.0 */
B_KOI8R_CONVERSION, /* KOI8-R */
B_MS_WINDOWS_1251_CONVERSION, /* MS-Windows Codepage 1251 */
B_MS_DOS_866_CONVERSION, /* MS-DOS Codepage 866 */
B_MS_DOS_CONVERSION, /* MS-DOS Codepage 437 */
B_EUC_KR_CONVERSION /* EUC Korean */
};
/*-------------------------------------------------------------*/
/*------- Conversion Functions --------------------------------*/
_IMPEXP_TEXTENCODING status_t convert_to_utf8(uint32 srcEncoding,
const char *src,
int32 *srcLen,
char *dst,
int32 *dstLen,
int32 *state,
char substitute = B_SUBSTITUTE);
_IMPEXP_TEXTENCODING status_t convert_from_utf8(uint32 dstEncoding,
const char *src,
int32 *srcLen,
char *dst,
int32 *dstLen,
int32 *state,
char substitute = B_SUBSTITUTE);
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _UTF8_H */

185
headers/os/support/syslog.h Normal file
View File

@ -0,0 +1,185 @@
/******************************************************************************
/
/ File: syslog.h
/
/ Description: System event logging mechanism.
/
/ Copyright 1993-98, Be Incorporated
/
*******************************************************************************/
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)syslog.h 7.20 (Berkeley) 2/23/91
*/
#ifndef _SYS_LOG_H
#define _SYS_LOG_H
#ifndef _BE_BUILD_H
#include <BeBuild.h>
#endif
/*-------------------------------------------------------------*/
/*----- Priority ----------------------------------------------*/
#define LOG_EMERG 0
#define LOG_PANIC LOG_EMERG
#define LOG_ALERT 1
#define LOG_CRIT 2
#define LOG_ERR 3
#define LOG_WARNING 4
#define LOG_NOTICE 5
#define LOG_INFO 6
#define LOG_DEBUG 7
#define LOG_NPRIORITIES 8
#define LOG_PRIMASK 0x07
#define LOG_PRI(p) ((p) & LOG_PRIMASK)
#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
#ifdef SYSLOG_NAMES
#define INTERNAL_NOPRI 0x8
#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0)
static char *prioritynames[] = {
"panic",
"alert",
"crit",
"err",
"warning",
"notice",
"info",
"debug",
"none",
NULL
};
#endif /* SYSLOG_NAMES */
/*-------------------------------------------------------------*/
/*----- Facility ----------------------------------------------*/
#define LOG_KERN (0<<3)
#define LOG_USER (1<<3)
#define LOG_MAIL (2<<3)
#define LOG_DAEMON (3<<3)
#define LOG_AUTH (4<<3)
#define LOG_SYSLOG (5<<3)
#define LOG_LPR (6<<3)
#define LOG_NEWS (7<<3)
#define LOG_UUCP (8<<3)
#define LOG_CRON (9<<3)
#define LOG_AUTHPRIV (10<<3)
/*----- Private or reserved ---------------*/
#define LOG_LOCAL0 (16<<3)
#define LOG_LOCAL1 (17<<3)
#define LOG_LOCAL2 (18<<3)
#define LOG_LOCAL3 (19<<3)
#define LOG_LOCAL4 (20<<3)
#define LOG_LOCAL5 (21<<3)
#define LOG_LOCAL6 (22<<3)
#define LOG_LOCAL7 (23<<3)
/*-----------------------------------------*/
#define LOG_NFACILITIES 24
#define LOG_FACMASK 0x03f8
#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
#ifdef SYSLOG_NAMES
static char *facilitynames[] = {
"kern", "user", "mail", "daemon",
"auth", "syslogd", "lpr", "news",
"uucp", "cron", "authpriv", "",
"", "", "", "",
"local0", "local1", "local2", "local3",
"local4", "local5", "local6", "local7",
NULL
};
#endif /* SYSLOG_NAMES */
/*-------------------------------------------------------------*/
/*----- Logging ----------------------------------------------*/
#ifdef KERNEL
#define LOG_PRINTF -1
#endif
/*----- setlogmask args ---------------*/
#define LOG_MASK(pri) (1 << (pri))
#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1)
/*----- openlog options ---------------*/
#define LOG_OPTIONSMASK 0x000ff000
#define LOG_OPTIONS(p) ((p) & LOG_OPTIONSMASK)
#define LOG_PID (0x01<<12)
#define LOG_THID LOG_PID
#define LOG_TMID LOG_PID
#define LOG_CONS (0x02<<12) /* no-op */
#define LOG_ODELAY (0x04<<12) /* no-op */
#define LOG_NDELAY (0x08<<12) /* no-op */
#define LOG_SERIAL (0x10<<12)
#define LOG_PERROR (0x20<<12)
#ifdef __cplusplus
extern "C" {
#endif
/*----- Logging Functions ---------------*/
_IMPEXP_BE void closelog (void);
_IMPEXP_BE void closelog_team (void);
_IMPEXP_BE void closelog_thread (void);
_IMPEXP_BE void openlog (char *, int, int);
_IMPEXP_BE void openlog_team (char *, int, int);
_IMPEXP_BE void openlog_thread (char *, int, int);
_IMPEXP_BE void syslog (int, char *, ...);
_IMPEXP_BE void log_team (int, char *, ...);
_IMPEXP_BE void log_thread (int, char *, ...);
_IMPEXP_BE int setlogmask (int);
_IMPEXP_BE int setlogmask_team (int);
_IMPEXP_BE int setlogmask_thread (int);
#ifdef __cplusplus
}
#endif
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _SYS_LOG_H */