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
+218
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 */
+158
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 */
+169
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 */
+126
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
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 */
+120
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 */
+125
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 */
+148
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 */
+165
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 */
+95
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 */
+105
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 */
+156
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 */
+81
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 */
+105
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 */
+106
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 */
+101
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 */
+110
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 */
+106
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 */
+97
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
+145
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 */
+427
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 */