Merged changes from branch build_system_redesign at revision 14573.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2005-10-29 16:27:43 +00:00
parent 5412b02d50
commit 338b8dc301
1836 changed files with 114718 additions and 14057 deletions
+155
View File
@@ -0,0 +1,155 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Alert.h
// Author: Erik Jaesler ([email protected])
// Description: BAlert displays a modal alert window.
//------------------------------------------------------------------------------
#ifndef _ALERT_H
#define _ALERT_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Window.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class BBitmap;
class BButton;
class BInvoker;
class BTextView;
// enum for flavors of alert ---------------------------------------------------
enum alert_type {
B_EMPTY_ALERT = 0,
B_INFO_ALERT,
B_IDEA_ALERT,
B_WARNING_ALERT,
B_STOP_ALERT
};
enum button_spacing {
B_EVEN_SPACING = 0,
B_OFFSET_SPACING
};
// BAlert class ----------------------------------------------------------------
class BAlert : public BWindow
{
public:
BAlert( const char *title,
const char *text,
const char *button1,
const char *button2 = NULL,
const char *button3 = NULL,
button_width width = B_WIDTH_AS_USUAL,
alert_type type = B_INFO_ALERT);
BAlert( const char *title,
const char *text,
const char *button1,
const char *button2,
const char *button3,
button_width width,
button_spacing spacing,
alert_type type = B_INFO_ALERT);
virtual ~BAlert();
// Archiving
BAlert(BMessage *data);
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
// BAlert guts
void SetShortcut(int32 button_index, char key);
char Shortcut(int32 button_index) const;
int32 Go();
status_t Go(BInvoker *invoker);
virtual void MessageReceived(BMessage *an_event);
virtual void FrameResized(float new_width, float new_height);
BButton *ButtonAt(int32 index) const;
BTextView *TextView() const;
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual void DispatchMessage(BMessage *msg, BHandler *handler);
virtual void Quit();
virtual bool QuitRequested();
static BPoint AlertPosition(float width, float height);
// Private or reserved ---------------------------------------------------------
virtual status_t Perform(perform_code d, void *arg);
private:
friend class _BAlertFilter_;
virtual void _ReservedAlert1();
virtual void _ReservedAlert2();
virtual void _ReservedAlert3();
void InitObject(const char *text,
const char *button1,
const char *button2 = NULL,
const char *button3 = NULL,
button_width width = B_WIDTH_AS_USUAL,
button_spacing spacing = B_EVEN_SPACING,
alert_type type = B_INFO_ALERT);
BBitmap *InitIcon();
sem_id fAlertSem;
int32 fAlertVal;
BButton *fButtons[3];
BTextView *fTextView;
char fKeys[3];
alert_type fMsgType;
button_width fButtonWidth;
BInvoker *fInvoker;
uint32 _reserved[4];
};
//------------------------------------------------------------------------------
#endif // _ALERT_H
/*
* $Log $
*
* $Id $
*
*/
+112
View File
@@ -0,0 +1,112 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2005, Haiku, Inc.
//
// Distributed under the terms of the MIT license.
//
// File Name: Bitmap.h
// Author: Ingo Weinhold ([email protected])
// Description: BBitmap objects represent off-screen windows that
// contain bitmap data.
//------------------------------------------------------------------------------
#ifndef _BITMAP_H
#define _BITMAP_H
#include <Archivable.h>
#include <InterfaceDefs.h>
#include <Rect.h>
enum {
B_BITMAP_CLEAR_TO_WHITE = 0x00000001,
B_BITMAP_ACCEPTS_VIEWS = 0x00000002,
B_BITMAP_IS_AREA = 0x00000004,
B_BITMAP_IS_LOCKED = 0x00000008 | B_BITMAP_IS_AREA,
B_BITMAP_IS_CONTIGUOUS = 0x00000010 | B_BITMAP_IS_LOCKED,
B_BITMAP_IS_OFFSCREEN = 0x00000020,
B_BITMAP_WILL_OVERLAY = 0x00000040 | B_BITMAP_IS_OFFSCREEN,
B_BITMAP_RESERVE_OVERLAY_CHANNEL = 0x00000080,
B_BITMAP_NO_SERVER_LINK = 0x00000100
};
#define B_ANY_BYTES_PER_ROW -1
//----------------------------------------------------------------//
//----- BBitmap class --------------------------------------------//
class BBitmap : public BArchivable {
public:
BBitmap(BRect bounds, uint32 flags, color_space colorSpace,
int32 bytesPerRow = B_ANY_BYTES_PER_ROW,
screen_id screenID = B_MAIN_SCREEN_ID);
BBitmap(BRect bounds, color_space colorSpace, bool acceptsViews = false,
bool needsContiguous = false);
BBitmap(const BBitmap *source, bool acceptsViews = false,
bool needsContiguous = false);
virtual ~BBitmap();
// Archiving
BBitmap(BMessage *data);
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
status_t InitCheck() const;
bool IsValid() const;
status_t LockBits(uint32 *state = NULL);
void UnlockBits();
area_id Area() const;
void *Bits() const;
int32 BitsLength() const;
int32 BytesPerRow() const;
color_space ColorSpace() const;
BRect Bounds() const;
void SetBits(const void *data, int32 length, int32 offset,
color_space colorSpace);
// not part of the R5 API
status_t ImportBits(const void *data, int32 length, int32 bpr,
int32 offset, color_space colorSpace);
status_t ImportBits(const BBitmap *bitmap);
status_t GetOverlayRestrictions(overlay_restrictions *restrictions) const;
//----- Private or reserved -----------------------------------------//
virtual status_t Perform(perform_code d, void *arg);
private:
virtual void _ReservedBitmap1();
virtual void _ReservedBitmap2();
virtual void _ReservedBitmap3();
BBitmap(const BBitmap &);
BBitmap &operator=(const BBitmap &);
char *get_shared_pointer() const;
int32 get_server_token() const;
void InitObject(BRect bounds, color_space colorSpace, uint32 flags,
int32 bytesPerRow, screen_id screenID);
void CleanUp();
void AssertPtr();
void *fBasePtr;
int32 fSize;
color_space fColorSpace;
BRect fBounds;
int32 fBytesPerRow;
int32 fServerToken;
int32 fToken;
uint8 unused;
area_id fArea;
area_id fOrigArea;
uint32 fFlags;
status_t fInitError;
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif // _BITMAP_H
+126
View File
@@ -0,0 +1,126 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Box.h
// Author: Marc Flerackers ([email protected])
// Description: BBox objects group views together and draw a border
// around them.
//------------------------------------------------------------------------------
#ifndef _BOX_H
#define _BOX_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <View.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
// BBox class ------------------------------------------------------------------
class BBox : public BView {
public:
BBox(BRect frame,
const char *name = NULL,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS |
B_NAVIGABLE_JUMP,
border_style border = B_FANCY_BORDER);
virtual ~BBox();
/* Archiving */
BBox(BMessage *archive);
static BArchivable *Instantiate(BMessage *archive);
virtual status_t Archive(BMessage *archive, bool deep = true) const;
virtual void SetBorder(border_style border);
border_style Border() const;
void SetLabel(const char *string);
status_t SetLabel(BView *viewLabel);
const char *Label() const;
BView *LabelView() const;
virtual void Draw(BRect updateRect);
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void FrameResized(float width, float height);
virtual void MessageReceived(BMessage *message);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void WindowActivated(bool active);
virtual void MouseMoved(BPoint point, uint32 transit,
const BMessage *message);
virtual void FrameMoved(BPoint newLocation);
virtual BHandler *ResolveSpecifier(BMessage *message,
int32 index,
BMessage *specifier,
int32 what,
const char *property);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float *width, float *height);
virtual void MakeFocus(bool focused = true);
virtual status_t GetSupportedSuites(BMessage *message);
virtual status_t Perform(perform_code d, void *arg);
private:
virtual void _ReservedBox1();
virtual void _ReservedBox2();
BBox &operator=(const BBox &);
void InitObject(BMessage *data = NULL);
void DrawPlain();
void DrawFancy();
void ClearAnyLabel();
char *fLabel;
BRect fBounds;
border_style fStyle;
BView *fLabelView;
uint32 _reserved[1];
};
//------------------------------------------------------------------------------
#endif // _BOX_H
/*
* $Log $
*
* $Id $
*
*/
+122
View File
@@ -0,0 +1,122 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Button.h
// Author: Marc Flerackers ([email protected])
// Description: BButton displays and controls a button in a window.
//------------------------------------------------------------------------------
#ifndef _BUTTON_H
#define _BUTTON_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Control.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
// BButton class ---------------------------------------------------------------
class BButton : public BControl {
public:
BButton(BRect frame,
const char *name,
const char *label,
BMessage *message,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
virtual ~BButton();
BButton(BMessage *archive);
static BArchivable *Instantiate(BMessage *archive);
virtual status_t Archive (BMessage *archive, bool deep = true) const;
virtual void Draw(BRect updateRect);
virtual void MouseDown(BPoint point);
virtual void AttachedToWindow();
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void MakeDefault(bool flag);
virtual void SetLabel(const char *string);
bool IsDefault() const;
virtual void MessageReceived(BMessage *message);
virtual void WindowActivated(bool active);
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
virtual void MouseUp(BPoint point);
virtual void DetachedFromWindow();
virtual void SetValue(int32 value);
virtual void GetPreferredSize (float *width, float *height);
virtual void ResizeToPreferred();
virtual status_t Invoke(BMessage *message = NULL);
virtual void FrameMoved(BPoint newLocation);
virtual void FrameResized(float width, float height);
virtual void MakeFocus(bool focused = true);
virtual void AllAttached();
virtual void AllDetached();
virtual BHandler *ResolveSpecifier(BMessage *message,
int32 index,
BMessage *specifier,
int32 what,
const char *property);
virtual status_t GetSupportedSuites(BMessage *message);
virtual status_t Perform(perform_code d, void *arg);
private:
virtual void _ReservedButton1();
virtual void _ReservedButton2();
virtual void _ReservedButton3();
BButton &operator=(const BButton &);
BRect DrawDefault(BRect bounds, bool enabled);
void DrawFocusLine(float x, float y, float width,
bool bVisible);
status_t Execute ();
float fCachedWidth;
bool fDrawAsDefault;
uint32 _reserved[3];
};
//------------------------------------------------------------------------------
#endif // _BUTTON_H
/*
* $Log $
*
* $Id $
*
*/
+221
View File
@@ -0,0 +1,221 @@
/*******************************************************************************
/
/ 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 void _Reserverd_ChannelControl_0(void *, ...);
virtual void _Reserverd_ChannelControl_1(void *, ...);
virtual void _Reserverd_ChannelControl_2(void *, ...);
virtual void _Reserverd_ChannelControl_3(void *, ...);
virtual void _Reserverd_ChannelControl_4(void *, ...);
virtual void _Reserverd_ChannelControl_5(void *, ...);
virtual void _Reserverd_ChannelControl_6(void *, ...);
virtual void _Reserverd_ChannelControl_7(void *, ...);
virtual void _Reserverd_ChannelControl_8(void *, ...);
virtual void _Reserverd_ChannelControl_9(void *, ...);
virtual void _Reserverd_ChannelControl_10(void *, ...);
virtual void _Reserverd_ChannelControl_11(void *, ...);
protected:
inline int32 * const & MinLimitList() const;
inline int32 * const & MaxLimitList() const;
inline int32 * const & ValueList() const;
private:
int32 fChannelCount;
int32 fCurrentChannel;
int32 * fChannelMin;
int32 * fChannelMax;
int32 * fChannelValues;
BString fMinLabel;
BString fMaxLabel;
void * fMultiLabels;
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 fChannelMin;
}
inline int32 * const & BChannelControl::MaxLimitList() const
{
return fChannelMax;
}
inline int32 * const & BChannelControl::ValueList() const
{
return fChannelValues;
}
#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 void _Reserved_BChannelSlider_0(void *, ...);
virtual void _Reserved_BChannelSlider_1(void *, ...);
virtual void _Reserved_BChannelSlider_2(void *, ...);
virtual void _Reserved_BChannelSlider_3(void *, ...);
virtual void _Reserved_BChannelSlider_4(void *, ...);
virtual void _Reserved_BChannelSlider_5(void *, ...);
virtual void _Reserved_BChannelSlider_6(void *, ...);
virtual void _Reserved_BChannelSlider_7(void *, ...);
float fBaseLine;
float fLineFeed;
BBitmap * fLeftKnob;
BBitmap * fMidKnob;
BBitmap * fRightKnob;
BBitmap * fBacking;
BView * fBackingView;
bool fVertical;
bool fPadding[3];
BPoint fClickDelta;
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() const;
void Redraw();
void MouseMovedCommon(BPoint , BPoint );
};
#endif /* _CHANNEL_SLIDER_H */
+113
View File
@@ -0,0 +1,113 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: CheckBox.h
// Author: Marc Flerackers ([email protected])
// Description: BCheckBox displays an on/off control.
//------------------------------------------------------------------------------
#ifndef _CHECK_BOX_H
#define _CHECK_BOX_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Control.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
// BCheckBox class -------------------------------------------------------------
class BCheckBox : public BControl {
public:
BCheckBox(BRect frame,
const char *name,
const char *label,
BMessage *message,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
virtual ~BCheckBox();
/* Archiving */
BCheckBox(BMessage *archive);
static BArchivable *Instantiate(BMessage *archive);
virtual status_t Archive(BMessage *archive, bool deep = true) const;
virtual void Draw(BRect updateRect);
virtual void AttachedToWindow();
virtual void MouseDown(BPoint point);
virtual void MessageReceived(BMessage *message);
virtual void WindowActivated(bool active);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
virtual void DetachedFromWindow();
virtual void SetValue(int32 value);
virtual void GetPreferredSize(float *width, float *height);
virtual void ResizeToPreferred();
virtual status_t Invoke(BMessage *message = NULL);
virtual void FrameMoved(BPoint newLocation);
virtual void FrameResized(float width, float height);
virtual BHandler *ResolveSpecifier(BMessage *message,
int32 index,
BMessage *specifier,
int32 what,
const char *property);
virtual status_t GetSupportedSuites(BMessage *message);
virtual void MakeFocus(bool focused = true);
virtual void AllAttached();
virtual void AllDetached();
virtual status_t Perform(perform_code d, void *arg);
private:
virtual void _ReservedCheckBox1();
virtual void _ReservedCheckBox2();
virtual void _ReservedCheckBox3();
BRect _CheckBoxFrame() const;
BCheckBox &operator=(const BCheckBox &);
bool fOutlined;
uint32 _reserved[2];
};
//------------------------------------------------------------------------------
#endif // _CHECK_BOX_H
/*
* $Log $
*
* $Id $
*
*/
+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 */
+44
View File
@@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: ColorUtils.h
// Author: DarkWyrm <[email protected]>
// Description: Miscellaneous useful functions for working with colors
//
//
//------------------------------------------------------------------------------
#ifndef COLORUTILS_H_
#define COLORUTILS_H_
#include <GraphicsDefs.h>
void SetRGBColor(rgb_color *col,uint8 r, uint8 g, uint8 b, uint8 a=255);
void SetRGBColor15(rgb_color *col,uint16 color);
void SetRGBColor16(rgb_color *col,uint16 color);
void SetRGBColor(rgb_color *col,uint32 color);
uint8 FindClosestColor(const rgb_color *palette, rgb_color color);
uint16 FindClosestColor15(rgb_color color);
uint16 FindClosestColor16(rgb_color color);
rgb_color MakeBlendColor(rgb_color col, rgb_color col2, float position);
#endif
+140
View File
@@ -0,0 +1,140 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Control.h
// Author: Marc Flerackers ([email protected])
// Description: BControl is the base class for user-event handling objects.
//------------------------------------------------------------------------------
#ifndef _CONTROL_H
#define _CONTROL_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Invoker.h>
#include <Message.h> /* For convenience */
#include <View.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
enum {
B_CONTROL_OFF = 0,
B_CONTROL_ON = 1
};
// Globals ---------------------------------------------------------------------
class BWindow;
// BControl class --------------------------------------------------------------
class BControl : public BView, public BInvoker {
public:
BControl(BRect frame,
const char *name,
const char *label,
BMessage *message,
uint32 resizingMode,
uint32 flags);
virtual ~BControl();
BControl(BMessage *archive);
static BArchivable *Instantiate(BMessage *archive);
virtual status_t Archive(BMessage *archive, bool deep = true) const;
virtual void WindowActivated(bool active);
virtual void AttachedToWindow();
virtual void MessageReceived(BMessage *message);
virtual void MakeFocus(bool focused = true);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
virtual void DetachedFromWindow();
virtual void SetLabel(const char *string);
const char *Label() const;
virtual void SetValue(int32 value);
int32 Value() const;
virtual void SetEnabled(bool enabled);
bool IsEnabled() const;
virtual void GetPreferredSize(float *width, float *height);
virtual void ResizeToPreferred();
virtual status_t Invoke(BMessage *message = NULL);
virtual BHandler *ResolveSpecifier(BMessage *message,
int32 index,
BMessage *specifier,
int32 what,
const char *property);
virtual status_t GetSupportedSuites(BMessage *message);
virtual void AllAttached();
virtual void AllDetached();
virtual status_t Perform(perform_code d, void *arg);
protected:
bool IsFocusChanging() const;
bool IsTracking() const;
void SetTracking(bool state);
void SetValueNoUpdate(int32 value);
private:
virtual void _ReservedControl1();
virtual void _ReservedControl2();
virtual void _ReservedControl3();
virtual void _ReservedControl4();
BControl &operator=(const BControl &);
void InitData(BMessage *data = NULL);
char *fLabel;
int32 fValue;
bool fEnabled;
bool fFocusChanging;
bool fTracking;
bool fWantsNav;
uint32 _reserved[4];
};
//------------------------------------------------------------------------------
#endif // _CONTROL_H
/*
* $Log $
*
* $Id $
*
*/
+93
View File
@@ -0,0 +1,93 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Deskbar.h
// Author: Jeremy Rand ([email protected])
// Description: BDeskbar allows one to control the deskbar from an
// application.
//------------------------------------------------------------------------------
#ifndef _DESKBAR_H
#define _DESKBAR_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Rect.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class BMessenger;
class BView;
// enum for deskbar locations --------------------------------------------------
enum deskbar_location {
B_DESKBAR_TOP,
B_DESKBAR_BOTTOM,
B_DESKBAR_LEFT_TOP,
B_DESKBAR_RIGHT_TOP,
B_DESKBAR_LEFT_BOTTOM,
B_DESKBAR_RIGHT_BOTTOM
};
// BDeskbar class -------------------------------------------------------------
class BDeskbar
{
public:
BDeskbar();
~BDeskbar();
// Location member functions
BRect Frame(void) const;
deskbar_location Location(bool *isExpanded = NULL) const;
status_t SetLocation(deskbar_location location, bool expanded = false);
bool IsExpanded(void) const;
status_t Expand(bool expand);
// Item querying member functions
status_t GetItemInfo(int32 id, const char **name) const;
status_t GetItemInfo(const char *name, int32 *id) const;
bool HasItem(int32 id) const;
bool HasItem(const char *name) const;
uint32 CountItems(void) const;
// Item modification member functions
status_t AddItem(BView *archivableView, int32 *id = NULL);
status_t AddItem(entry_ref *addon, int32 *id = NULL);
status_t RemoveItem(int32 id);
status_t RemoveItem(const char *name);
private:
BMessenger *fMessenger;
uint32 _reserved[12];
};
//------------------------------------------------------------------------------
#endif // _DESKBAR_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 */
+358
View File
@@ -0,0 +1,358 @@
#ifndef _FONT_H_
#define _FONT_H_
#include <BeBuild.h>
#include <SupportDefs.h>
#include <InterfaceDefs.h>
/*----------------------------------------------------------------*/
/*----- BFont defines and structures -----------------------------*/
#define B_FONT_FAMILY_LENGTH 63
typedef char font_family[B_FONT_FAMILY_LENGTH + 1];
#define B_FONT_STYLE_LENGTH 63
typedef char font_style[B_FONT_STYLE_LENGTH + 1];
enum {
B_CHAR_SPACING = 0,
B_STRING_SPACING = 1,
B_BITMAP_SPACING = 2,
B_FIXED_SPACING = 3
};
enum font_direction {
B_FONT_LEFT_TO_RIGHT = 0,
B_FONT_RIGHT_TO_LEFT = 1
};
enum {
B_DISABLE_ANTIALIASING = 0x00000001,
B_FORCE_ANTIALIASING = 0x00000002
};
enum {
B_TRUNCATE_END = 0,
B_TRUNCATE_BEGINNING = 1,
B_TRUNCATE_MIDDLE = 2,
B_TRUNCATE_SMART = 3
};
enum {
B_UNICODE_UTF8 = 0,
B_ISO_8859_1 = 1,
B_ISO_8859_2 = 2,
B_ISO_8859_3 = 3,
B_ISO_8859_4 = 4,
B_ISO_8859_5 = 5,
B_ISO_8859_6 = 6,
B_ISO_8859_7 = 7,
B_ISO_8859_8 = 8,
B_ISO_8859_9 = 9,
B_ISO_8859_10 = 10,
B_MACINTOSH_ROMAN = 11
};
enum {
B_SCREEN_FONT_CACHE = 0x0001,
B_PRINTING_FONT_CACHE = 0x0002,
B_DEFAULT_CACHE_SETTING = 0x0004,
B_APP_CACHE_SETTING = 0x0008
};
enum {
B_HAS_TUNED_FONT = 0x0001,
B_IS_FIXED = 0x0002
};
enum {
B_ITALIC_FACE = 0x0001,
B_UNDERSCORE_FACE = 0x0002,
B_NEGATIVE_FACE = 0x0004,
B_OUTLINED_FACE = 0x0008,
B_STRIKEOUT_FACE = 0x0010,
B_BOLD_FACE = 0x0020,
B_REGULAR_FACE = 0x0040
};
enum font_metric_mode {
B_SCREEN_METRIC = 0,
B_PRINTING_METRIC = 1
};
enum font_file_format {
B_TRUETYPE_WINDOWS = 0,
B_POSTSCRIPT_TYPE1_WINDOWS = 1
};
class unicode_block {
public:
inline unicode_block();
inline unicode_block(uint64 block2, uint64 block1);
inline bool Includes(const unicode_block &block) const;
inline unicode_block operator&(const unicode_block &block) const;
inline unicode_block operator|(const unicode_block &block) const;
inline unicode_block &operator=(const unicode_block &block);
inline bool operator==(const unicode_block &block) const;
inline bool operator!=(const unicode_block &block) const;
private:
uint64 fData[2];
};
struct edge_info {
float left;
float right;
};
struct font_height {
float ascent;
float descent;
float leading;
};
struct escapement_delta {
float nonspace;
float space;
};
struct font_cache_info {
int32 sheared_font_penalty;
int32 rotated_font_penalty;
float oversize_threshold;
int32 oversize_penalty;
int32 cache_size;
float spacing_size_threshold;
};
struct tuned_font_info {
float size;
float shear;
float rotation;
uint32 flags;
uint16 face;
};
class BShape;
class BString;
class BFontPrivate;
class BFont {
public:
BFont(void);
BFont(const BFont &font);
BFont(const BFont *font);
status_t SetFamilyAndStyle(const font_family family,
const font_style style);
void SetFamilyAndStyle(uint32 code);
status_t SetFamilyAndFace(const font_family family, uint16 face);
void SetSize(float size);
void SetShear(float shear);
void SetRotation(float rotation);
void SetSpacing(uint8 spacing);
void SetEncoding(uint8 encoding);
void SetFace(uint16 face);
void SetFlags(uint32 flags);
void GetFamilyAndStyle(font_family *family,
font_style *style) const;
uint32 FamilyAndStyle(void) const;
float Size(void) const;
float Shear(void) const;
float Rotation(void) const;
uint8 Spacing(void) const;
uint8 Encoding(void) const;
uint16 Face(void) const;
uint32 Flags(void) const;
font_direction Direction(void) const;
bool IsFixed(void) const;
bool IsFullAndHalfFixed(void) const;
BRect BoundingBox(void) const;
unicode_block Blocks(void) const;
font_file_format FileFormat(void) const;
int32 CountTuned(void) const;
void GetTunedInfo(int32 index, tuned_font_info *info) const;
void TruncateString(BString* in_out,
uint32 mode,
float width) const;
void GetTruncatedStrings(const char *stringArray[],
int32 numStrings,
uint32 mode,
float width,
BString resultArray[]) const;
void GetTruncatedStrings(const char *stringArray[],
int32 numStrings,
uint32 mode,
float width,
char *resultArray[]) const;
float StringWidth(const char *string) const;
float StringWidth(const char *string, int32 length) const;
void GetStringWidths(const char *stringArray[],
const int32 lengthArray[],
int32 numStrings,
float widthArray[]) const;
void GetEscapements(const char charArray[],
int32 numChars,
float escapementArray[]) const;
void GetEscapements(const char charArray[],
int32 numChars,
escapement_delta *delta,
float escapementArray[]) const;
void GetEscapements(const char charArray[],
int32 numChars,
escapement_delta *delta,
BPoint escapementArray[]) const;
void GetEscapements(const char charArray[],
int32 numChars,
escapement_delta *delta,
BPoint escapementArray[],
BPoint offsetArray[]) const;
void GetEdges(const char charArray[],
int32 numBytes,
edge_info edgeArray[]) const;
void GetHeight(font_height *height) const;
void GetBoundingBoxesAsGlyphs(const char charArray[],
int32 numChars,
font_metric_mode mode,
BRect boundingBoxArray[]) const;
void GetBoundingBoxesAsString(const char charArray[],
int32 numChars,
font_metric_mode mode,
escapement_delta *delta,
BRect boundingBoxArray[]) const;
void GetBoundingBoxesForStrings(const char *stringArray[],
int32 numStrings,
font_metric_mode mode,
escapement_delta deltas[],
BRect boundingBoxArray[]) const;
void GetGlyphShapes(const char charArray[],
int32 numChars,
BShape *glyphShapeArray[]) const;
void GetHasGlyphs(const char charArray[],
int32 numChars,
bool hasArray[]) const;
BFont& operator=(const BFont &font);
bool operator==(const BFont &font) const;
bool operator!=(const BFont &font) const;
void PrintToStream(void) const;
private:
friend void _font_control_(BFont*, int32, void*);
uint16 fFamilyID;
uint16 fStyleID;
float fSize;
float fShear;
float fRotation;
uint8 fSpacing;
uint8 fEncoding;
uint16 fFace;
uint32 fFlags;
font_height fHeight;
uint32 _reserved[3];
void SetPacket(void *packet) const;
void GetTruncatedStrings64(const char *stringArray[],
int32 numStrings,
uint32 mode,
float width,
char *resultArray[]) const;
void GetTruncatedStrings64(const char *stringArray[],
int32 numStrings,
uint32 mode,
float width,
BString resultArray[]) const;
void _GetEscapements_(const char charArray[],
int32 numChars,
escapement_delta *delta,
uint8 mode,
float *escapements,
float *offsets = NULL) const;
void _GetBoundingBoxes_(const char charArray[],
int32 numChars,
font_metric_mode mode,
bool string_escapement,
escapement_delta *delta,
BRect boundingBoxArray[]) const;
};
/*----------------------------------------------------------------*/
/*----- BFont related declarations -------------------------------*/
extern const BFont *be_plain_font;
extern const BFont *be_bold_font;
extern const BFont *be_fixed_font;
int32 count_font_families(void);
status_t get_font_family(int32 index, font_family *name, uint32 *flags=NULL);
int32 count_font_styles(font_family name);
status_t get_font_style(font_family family, int32 index, font_style *name,
uint32 *flags=NULL);
status_t get_font_style(font_family family, int32 index, font_style *name,
uint16 *face, uint32 *flags=NULL);
bool update_font_families(bool check_only);
status_t get_font_cache_info(uint32 id, void *set);
status_t set_font_cache_info(uint32 id, void *set);
/*----------------------------------------------------------------*/
/*----- unicode_block inlines ------------------------------------*/
unicode_block::unicode_block() { fData[0] = fData[1] = 0LL; }
unicode_block::unicode_block(uint64 block2, uint64 block1) {
fData[0] = block1;
fData[1] = block2;
}
bool unicode_block::Includes(const unicode_block &block) const {
return (((fData[0] & block.fData[0]) == block.fData[0]) &&
((fData[1] & block.fData[1]) == block.fData[1]));
}
unicode_block unicode_block::operator&(const unicode_block &block) const {
unicode_block res;
res.fData[0] = fData[0] & block.fData[0];
res.fData[1] = fData[1] & block.fData[1];
return res;
}
unicode_block unicode_block::operator|(const unicode_block &block) const {
unicode_block res;
res.fData[0] = fData[0] | block.fData[0];
res.fData[1] = fData[1] | block.fData[1];
return res;
}
unicode_block &unicode_block::operator=(const unicode_block &block) {
fData[0] = block.fData[0];
fData[1] = block.fData[1];
return *this;
}
bool unicode_block::operator==(const unicode_block &block) const {
return ((fData[0] == block.fData[0]) && (fData[1] == block.fData[1]));
}
bool unicode_block::operator!=(const unicode_block &block) const {
return ((fData[0] != block.fData[0]) || (fData[1] != block.fData[1]));
}
#endif
+337
View File
@@ -0,0 +1,337 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: GraphicsDefs.h
// Author: Frans van Nispen
// Description: BMessageFilter class creates objects that filter
// in-coming BMessages.
//------------------------------------------------------------------------------
#ifndef _GRAPHICS_DEFS_H
#define _GRAPHICS_DEFS_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <SupportDefs.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
//------------------------------------------------------------------------------
typedef struct pattern {
uint8 data[8];
} pattern;
#ifdef __cplusplus
inline bool
operator==(const pattern& a, const pattern& b)
{
return (*(uint64*)a.data == *(uint64*)b.data);
}
#endif // __cplusplus
extern _IMPEXP_BE const pattern B_SOLID_HIGH;
extern _IMPEXP_BE const pattern B_MIXED_COLORS;
extern _IMPEXP_BE const pattern B_SOLID_LOW;
//------------------------------------------------------------------------------
typedef struct rgb_color {
uint8 red;
uint8 green;
uint8 blue;
uint8 alpha;
#if defined(__cplusplus)
// some convenient additions
inline bool
operator==(const rgb_color& other) const
{
return *(const uint32 *)this == *(const uint32 *)&other;
}
inline bool
operator!=(const rgb_color& other) const
{
return *(const uint32 *)this != *(const uint32 *)&other;
}
#endif
} rgb_color;
//------------------------------------------------------------------------------
extern _IMPEXP_BE const rgb_color B_TRANSPARENT_COLOR;
extern _IMPEXP_BE const uint8 B_TRANSPARENT_MAGIC_CMAP8;
extern _IMPEXP_BE const uint16 B_TRANSPARENT_MAGIC_RGBA15;
extern _IMPEXP_BE const uint16 B_TRANSPARENT_MAGIC_RGBA15_BIG;
extern _IMPEXP_BE const uint32 B_TRANSPARENT_MAGIC_RGBA32;
extern _IMPEXP_BE const uint32 B_TRANSPARENT_MAGIC_RGBA32_BIG;
extern _IMPEXP_BE const uint8 B_TRANSPARENT_8_BIT;
extern _IMPEXP_BE const rgb_color B_TRANSPARENT_32_BIT;
//------------------------------------------------------------------------------
typedef struct color_map {
int32 id;
rgb_color color_list[256];
uint8 inversion_map[256];
uint8 index_map[32768];
} color_map;
typedef struct overlay_rect_limits {
uint16 horizontal_alignment;
uint16 vertical_alignment;
uint16 width_alignment;
uint16 height_alignment;
uint16 min_width;
uint16 max_width;
uint16 min_height;
uint16 max_height;
uint32 reserved[8];
} overlay_rect_limits;
typedef struct overlay_restrictions {
overlay_rect_limits source;
overlay_rect_limits destination;
float min_width_scale;
float max_width_scale;
float min_height_scale;
float max_height_scale;
uint32 reserved[8];
} overlay_restrictions;
//------------------------------------------------------------------------------
struct screen_id { int32 id; };
extern _IMPEXP_BE const struct screen_id B_MAIN_SCREEN_ID;
//------------------------------------------------------------------------------
typedef enum
{
B_NO_COLOR_SPACE = 0x0000, //* byte in memory order, high bit first
// linear color space (little endian is the default)
B_RGB32 = 0x0008, //* B[7:0] G[7:0] R[7:0] -[7:0]
B_RGBA32 = 0x2008, // B[7:0] G[7:0] R[7:0] A[7:0]
B_RGB24 = 0x0003, // B[7:0] G[7:0] R[7:0]
B_RGB16 = 0x0005, // G[2:0],B[4:0] R[4:0],G[5:3]
B_RGB15 = 0x0010, // G[2:0],B[4:0] -[0],R[4:0],G[4:3]
B_RGBA15 = 0x2010, // G[2:0],B[4:0] A[0],R[4:0],G[4:3]
B_CMAP8 = 0x0004, // D[7:0]
B_GRAY8 = 0x0002, // Y[7:0]
B_GRAY1 = 0x0001, // Y0[0],Y1[0],Y2[0],Y3[0],Y4[0],Y5[0],Y6[0],Y7[0]
// big endian version, when the encoding is not endianess independant
B_RGB32_BIG = 0x1008, // -[7:0] R[7:0] G[7:0] B[7:0]
B_RGBA32_BIG = 0x3008, // A[7:0] R[7:0] G[7:0] B[7:0]
B_RGB24_BIG = 0x1003, // R[7:0] G[7:0] B[7:0]
B_RGB16_BIG = 0x1005, // R[4:0],G[5:3] G[2:0],B[4:0]
B_RGB15_BIG = 0x1010, // -[0],R[4:0],G[4:3] G[2:0],B[4:0]
B_RGBA15_BIG = 0x3010, // A[0],R[4:0],G[4:3] G[2:0],B[4:0]
// little-endian declarations, for completness
B_RGB32_LITTLE = B_RGB32,
B_RGBA32_LITTLE = B_RGBA32,
B_RGB24_LITTLE = B_RGB24,
B_RGB16_LITTLE = B_RGB16,
B_RGB15_LITTLE = B_RGB15,
B_RGBA15_LITTLE = B_RGBA15,
// non linear color space -- note that these are here for exchange purposes;
// a BBitmap or BView may not necessarily support all these color spaces.
// Loss/Saturation points are Y 16-235 (absoulte); Cb/Cr 16-240 (center 128)
B_YCbCr422 = 0x4000, // Y0[7:0] Cb0[7:0] Y1[7:0] Cr0[7:0] Y2[7:0]...
// Cb2[7:0] Y3[7:0] Cr2[7:0]
B_YCbCr411 = 0x4001, // Cb0[7:0] Y0[7:0] Cr0[7:0] Y1[7:0] Cb4[7:0]...
// Y2[7:0] Cr4[7:0] Y3[7:0] Y4[7:0] Y5[7:0]...
// Y6[7:0] Y7[7:0]
B_YCbCr444 = 0x4003, // Y0[7:0] Cb0[7:0] Cr0[7:0]
B_YCbCr420 = 0x4004, // Non-interlaced only, Cb0 Y0 Y1 Cb2 Y2 Y3
// on even scan lines, Cr0 Y0 Y1 Cr2 Y2 Y3
// on odd scan lines
// Extrema points are
// Y 0 - 207 (absolute)
// U -91 - 91 (offset 128)
// V -127 - 127 (offset 128)
// note that YUV byte order is different from YCbCr
// USE YCbCr, not YUV, when that's what you mean!
B_YUV422 = 0x4020, // U0[7:0] Y0[7:0] V0[7:0] Y1[7:0] ...
// U2[7:0] Y2[7:0] V2[7:0] Y3[7:0]
B_YUV411 = 0x4021, // U0[7:0] Y0[7:0] Y1[7:0] V0[7:0] Y2[7:0] Y3[7:0]
// U4[7:0] Y4[7:0] Y5[7:0] V4[7:0] Y6[7:0] Y7[7:0]
B_YUV444 = 0x4023, // U0[7:0] Y0[7:0] V0[7:0] U1[7:0] Y1[7:0] V1[7:0]
B_YUV420 = 0x4024, // Non-interlaced only, U0 Y0 Y1 U2 Y2 Y3
// on even scan lines, V0 Y0 Y1 V2 Y2 Y3
// on odd scan lines
B_YUV9 = 0x402C, // planar? 410?
B_YUV12 = 0x402D, // planar? 420?
B_UVL24 = 0x4030, // U0[7:0] V0[7:0] L0[7:0] ...
B_UVL32 = 0x4031, // U0[7:0] V0[7:0] L0[7:0] X0[7:0]...
B_UVLA32 = 0x6031, // U0[7:0] V0[7:0] L0[7:0] A0[7:0]...
B_LAB24 = 0x4032, // L0[7:0] a0[7:0] b0[7:0] ... (a is not alpha!)
B_LAB32 = 0x4033, // L0[7:0] a0[7:0] b0[7:0] X0[7:0] ... (b is not alpha!)
B_LABA32 = 0x6033, // L0[7:0] a0[7:0] b0[7:0] A0[7:0] ... (A is alpha)
// red is at hue = 0
B_HSI24 = 0x4040, // H[7:0] S[7:0] I[7:0]
B_HSI32 = 0x4041, // H[7:0] S[7:0] I[7:0] X[7:0]
B_HSIA32 = 0x6041, // H[7:0] S[7:0] I[7:0] A[7:0]
B_HSV24 = 0x4042, // H[7:0] S[7:0] V[7:0]
B_HSV32 = 0x4043, // H[7:0] S[7:0] V[7:0] X[7:0]
B_HSVA32 = 0x6043, // H[7:0] S[7:0] V[7:0] A[7:0]
B_HLS24 = 0x4044, // H[7:0] L[7:0] S[7:0]
B_HLS32 = 0x4045, // H[7:0] L[7:0] S[7:0] X[7:0]
B_HLSA32 = 0x6045, // H[7:0] L[7:0] S[7:0] A[7:0]
B_CMY24 = 0xC001, // C[7:0] M[7:0] Y[7:0] No gray removal done
B_CMY32 = 0xC002, // C[7:0] M[7:0] Y[7:0] X[7:0] No gray removal done
B_CMYA32 = 0xE002, // C[7:0] M[7:0] Y[7:0] A[7:0] No gray removal done
B_CMYK32 = 0xC003, // C[7:0] M[7:0] Y[7:0] K[7:0]
// compatibility declarations
B_MONOCHROME_1_BIT = B_GRAY1,
B_GRAYSCALE_8_BIT = B_GRAY8,
B_COLOR_8_BIT = B_CMAP8,
B_RGB_32_BIT = B_RGB32,
B_RGB_16_BIT = B_RGB15,
B_BIG_RGB_32_BIT = B_RGB32_BIG,
B_BIG_RGB_16_BIT = B_RGB15_BIG
} color_space;
// Find out whether a specific color space is supported by BBitmaps.
// Support_flags will be set to what kinds of support are available.
// If support_flags is set to 0, false will be returned.
enum {
B_VIEWS_SUPPORT_DRAW_BITMAP = 0x1,
B_BITMAPS_SUPPORT_ATTACHED_VIEWS = 0x2
};
_IMPEXP_BE bool bitmaps_support_space(color_space space, uint32 * support_flags);
//------------------------------------------------------------------------------
// "pixel_chunk" is the native increment from one pixel starting on an integral byte
// to the next. "row_alignment" is the native alignment for pixel scanline starts.
// "pixels_per_chunk" is the number of pixels in a pixel_chunk. For instance, B_GRAY1
// sets pixel_chunk to 1, row_alignment to 4 and pixels_per_chunk to 8, whereas
// B_RGB24 sets pixel_chunk to 3, row_alignment to 4 and pixels_per_chunk to 1.
//------------------------------------------------------------------------------
_IMPEXP_BE status_t get_pixel_size_for(color_space space, size_t * pixel_chunk,
size_t * row_alignment, size_t * pixels_per_chunk);
enum buffer_orientation {
B_BUFFER_TOP_TO_BOTTOM,
B_BUFFER_BOTTOM_TO_TOP
};
enum buffer_layout {
B_BUFFER_NONINTERLEAVED = 1
};
//------------------------------------------------------------------------------
enum drawing_mode {
B_OP_COPY,
B_OP_OVER,
B_OP_ERASE,
B_OP_INVERT,
B_OP_ADD,
B_OP_SUBTRACT,
B_OP_BLEND,
B_OP_MIN,
B_OP_MAX,
B_OP_SELECT,
B_OP_ALPHA
};
enum source_alpha {
B_PIXEL_ALPHA=0,
B_CONSTANT_ALPHA
};
enum alpha_function {
B_ALPHA_OVERLAY=0,
B_ALPHA_COMPOSITE
};
enum {
B_8_BIT_640x480 = 0x00000001,
B_8_BIT_800x600 = 0x00000002,
B_8_BIT_1024x768 = 0x00000004,
B_8_BIT_1280x1024 = 0x00000008,
B_8_BIT_1600x1200 = 0x00000010,
B_16_BIT_640x480 = 0x00000020,
B_16_BIT_800x600 = 0x00000040,
B_16_BIT_1024x768 = 0x00000080,
B_16_BIT_1280x1024 = 0x00000100,
B_16_BIT_1600x1200 = 0x00000200,
B_32_BIT_640x480 = 0x00000400,
B_32_BIT_800x600 = 0x00000800,
B_32_BIT_1024x768 = 0x00001000,
B_32_BIT_1280x1024 = 0x00002000,
B_32_BIT_1600x1200 = 0x00004000,
B_8_BIT_1152x900 = 0x00008000,
B_16_BIT_1152x900 = 0x00010000,
B_32_BIT_1152x900 = 0x00020000,
B_15_BIT_640x480 = 0x00040000,
B_15_BIT_800x600 = 0x00080000,
B_15_BIT_1024x768 = 0x00100000,
B_15_BIT_1280x1024 = 0x00200000,
B_15_BIT_1600x1200 = 0x00400000,
B_15_BIT_1152x900 = 0x00800000,
// do not use B_FAKE_DEVICE--it will go away!
B_FAKE_DEVICE = 0x40000000,
B_8_BIT_640x400 = (int)0x80000000
};
#endif // _GRAPHICSDEFS_H
/*
* $Log $
*
* $Id $
*
*/
+88
View File
@@ -0,0 +1,88 @@
/******************************************************************************
/
/ File: Input.h
/
/ Description: Functions and class to manage input devices.
/
/ Copyright 1998, Be Incorporated, All Rights Reserved.
/
******************************************************************************/
#ifndef _INPUT_H
#define _INPUT_H
#include <BeBuild.h>
#include <Messenger.h>
#include <SupportDefs.h>
enum input_method_op {
B_INPUT_METHOD_STARTED = 0,
B_INPUT_METHOD_STOPPED = 1,
B_INPUT_METHOD_CHANGED = 2,
B_INPUT_METHOD_LOCATION_REQUEST = 3
};
enum input_device_type {
B_POINTING_DEVICE = 0,
B_KEYBOARD_DEVICE = 1,
B_UNDEFINED_DEVICE = 2
};
/*
what == B_INPUT_DEVICES_CHANGED
FindString("name", name_of_device);
FindInt32("opcode", input_device_notification);
*/
enum input_device_notification {
B_INPUT_DEVICE_ADDED = 0x0001,
B_INPUT_DEVICE_STARTED = 0x0002,
B_INPUT_DEVICE_STOPPED = 0x0004,
B_INPUT_DEVICE_REMOVED = 0x0008
};
class BInputDevice;
_IMPEXP_BE BInputDevice* find_input_device(const char *name);
_IMPEXP_BE status_t get_input_devices(BList *list);
_IMPEXP_BE status_t watch_input_devices(BMessenger target, bool start);
class BInputDevice {
public:
~BInputDevice();
const char* Name() const;
input_device_type Type() const;
bool IsRunning() const;
status_t Start();
status_t Stop();
status_t Control(uint32 code,
BMessage *message);
static status_t Start(input_device_type type);
static status_t Stop(input_device_type type);
static status_t Control(input_device_type type,
uint32 code,
BMessage *message);
private:
friend BInputDevice* find_input_device(const char *name);
friend status_t get_input_devices(BList *list);
BInputDevice();
void set_name_and_type(const char *name,
input_device_type type);
char* fName;
input_device_type fType;
uint32 _reserved[4];
};
#endif
+392
View File
@@ -0,0 +1,392 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: InterfaceDefs.h
// Author: Erik Jaesler ([email protected])
// Description: General Interface Kit definitions and global functions.
//------------------------------------------------------------------------------
#ifndef _INTERFACE_DEFS_H
#define _INTERFACE_DEFS_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <GraphicsDefs.h>
#include <OS.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class BRect;
/*----------------------------------------------------------------*/
struct key_info {
uint32 modifiers;
uint8 key_states[16];
};
/*----------------------------------------------------------------*/
#define B_UTF8_ELLIPSIS "\xE2\x80\xA6"
#define B_UTF8_OPEN_QUOTE "\xE2\x80\x9C"
#define B_UTF8_CLOSE_QUOTE "\xE2\x80\x9D"
#define B_UTF8_COPYRIGHT "\xC2\xA9"
#define B_UTF8_REGISTERED "\xC2\xAE"
#define B_UTF8_TRADEMARK "\xE2\x84\xA2"
#define B_UTF8_SMILING_FACE "\xE2\x98\xBB"
#define B_UTF8_HIROSHI "\xE5\xBC\x98"
#ifdef COMPILE_FOR_R5
#define B_MAX_MOUSE_BUTTONS 3
#else
#define B_MAX_MOUSE_BUTTONS 16
#endif
/*----------------------------------------------------------------*/
enum { B_BACKSPACE = 0x08,
B_RETURN = 0x0a,
B_ENTER = 0x0a,
B_SPACE = 0x20,
B_TAB = 0x09,
B_ESCAPE = 0x1b,
B_SUBSTITUTE = 0x1a,
B_LEFT_ARROW = 0x1c,
B_RIGHT_ARROW = 0x1d,
B_UP_ARROW = 0x1e,
B_DOWN_ARROW = 0x1f,
B_INSERT = 0x05,
B_DELETE = 0x7f,
B_HOME = 0x01,
B_END = 0x04,
B_PAGE_UP = 0x0b,
B_PAGE_DOWN = 0x0c,
B_FUNCTION_KEY = 0x10 };
enum { B_F1_KEY = 0x02,
B_F2_KEY = 0x03,
B_F3_KEY = 0x04,
B_F4_KEY = 0x05,
B_F5_KEY = 0x06,
B_F6_KEY = 0x07,
B_F7_KEY = 0x08,
B_F8_KEY = 0x09,
B_F9_KEY = 0x0a,
B_F10_KEY = 0x0b,
B_F11_KEY = 0x0c,
B_F12_KEY = 0x0d,
B_PRINT_KEY = 0x0e,
B_SCROLL_KEY = 0x0f,
B_PAUSE_KEY = 0x10 };
struct key_map {
uint32 version;
uint32 caps_key;
uint32 scroll_key;
uint32 num_key;
uint32 left_shift_key;
uint32 right_shift_key;
uint32 left_command_key;
uint32 right_command_key;
uint32 left_control_key;
uint32 right_control_key;
uint32 left_option_key;
uint32 right_option_key;
uint32 menu_key;
uint32 lock_settings;
int32 control_map[128];
int32 option_caps_shift_map[128];
int32 option_caps_map[128];
int32 option_shift_map[128];
int32 option_map[128];
int32 caps_shift_map[128];
int32 caps_map[128];
int32 shift_map[128];
int32 normal_map[128];
int32 acute_dead_key[32];
int32 grave_dead_key[32];
int32 circumflex_dead_key[32];
int32 dieresis_dead_key[32];
int32 tilde_dead_key[32];
uint32 acute_tables;
uint32 grave_tables;
uint32 circumflex_tables;
uint32 dieresis_tables;
uint32 tilde_tables;
};
struct mouse_map {
uint32 button[B_MAX_MOUSE_BUTTONS];
};
/*----------------------------------------------------------------*/
enum border_style {
B_PLAIN_BORDER,
B_FANCY_BORDER,
B_NO_BORDER
};
/*----------------------------------------------------------------*/
enum orientation {
B_HORIZONTAL,
B_VERTICAL
};
/*----------------------------------------------------------------*/
enum button_width {
B_WIDTH_AS_USUAL,
B_WIDTH_FROM_WIDEST,
B_WIDTH_FROM_LABEL
};
/*----------------------------------------------------------------*/
enum join_mode {
B_ROUND_JOIN=0,
B_MITER_JOIN,
B_BEVEL_JOIN,
B_BUTT_JOIN,
B_SQUARE_JOIN
};
enum cap_mode {
B_ROUND_CAP=B_ROUND_JOIN,
B_BUTT_CAP=B_BUTT_JOIN,
B_SQUARE_CAP=B_SQUARE_JOIN
};
const float B_DEFAULT_MITER_LIMIT = 10.0F;
/*----------------------------------------------------------------*/
struct scroll_bar_info {
bool proportional;
bool double_arrows;
int32 knob;
int32 min_knob_size;
};
/*----------------------------------------------------------------*/
enum alignment {
B_ALIGN_LEFT,
B_ALIGN_RIGHT,
B_ALIGN_CENTER
};
enum vertical_alignment {
B_ALIGN_TOP = 0x10L,
B_ALIGN_MIDDLE = 0x20,
B_ALIGN_BOTTOM = 0x30,
B_ALIGN_NO_VERTICAL = -1L
};
/*----------------------------------------------------------------*/
enum {
B_CONTROL_TABLE = 0x00000001,
B_OPTION_CAPS_SHIFT_TABLE = 0x00000002,
B_OPTION_CAPS_TABLE = 0x00000004,
B_OPTION_SHIFT_TABLE = 0x00000008,
B_OPTION_TABLE = 0x00000010,
B_CAPS_SHIFT_TABLE = 0x00000020,
B_CAPS_TABLE = 0x00000040,
B_SHIFT_TABLE = 0x00000080,
B_NORMAL_TABLE = 0x00000100
};
/*----------------------------------------------------------------*/
enum {
B_SHIFT_KEY = 0x00000001,
B_COMMAND_KEY = 0x00000002,
B_CONTROL_KEY = 0x00000004,
B_CAPS_LOCK = 0x00000008,
B_SCROLL_LOCK = 0x00000010,
B_NUM_LOCK = 0x00000020,
B_OPTION_KEY = 0x00000040,
B_MENU_KEY = 0x00000080,
B_LEFT_SHIFT_KEY = 0x00000100,
B_RIGHT_SHIFT_KEY = 0x00000200,
B_LEFT_COMMAND_KEY = 0x00000400,
B_RIGHT_COMMAND_KEY = 0x00000800,
B_LEFT_CONTROL_KEY = 0x00001000,
B_RIGHT_CONTROL_KEY = 0x00002000,
B_LEFT_OPTION_KEY = 0x00004000,
B_RIGHT_OPTION_KEY = 0x00008000
};
/*----------------------------------------------------------------*/
enum bitmap_tiling {
B_TILE_BITMAP_X = 0x00000001,
B_TILE_BITMAP_Y = 0x00000002,
B_TILE_BITMAP = 0x00000003
};
enum overlay_options {
B_OVERLAY_FILTER_HORIZONTAL = 0x00010000,
B_OVERLAY_FILTER_VERTICAL = 0x00020000,
B_OVERLAY_MIRROR = 0x00040000,
B_OVERLAY_TRANSFER_CHANNEL = 0x00080000
};
/*----------------------------------------------------------------*/
_IMPEXP_BE status_t get_deskbar_frame(BRect *frame);
_IMPEXP_BE const color_map *system_colors();
_IMPEXP_BE status_t set_screen_space(int32 index, uint32 res,
bool stick = true);
_IMPEXP_BE status_t get_scroll_bar_info(scroll_bar_info *info);
_IMPEXP_BE status_t set_scroll_bar_info(scroll_bar_info *info);
_IMPEXP_BE status_t get_mouse_type(int32 *type);
_IMPEXP_BE status_t set_mouse_type(int32 type);
_IMPEXP_BE status_t get_mouse_map(mouse_map *map);
_IMPEXP_BE status_t set_mouse_map(mouse_map *map);
_IMPEXP_BE status_t get_click_speed(bigtime_t *speed);
_IMPEXP_BE status_t set_click_speed(bigtime_t speed);
_IMPEXP_BE status_t get_mouse_speed(int32 *speed);
_IMPEXP_BE status_t set_mouse_speed(int32 speed);
_IMPEXP_BE status_t get_mouse_acceleration(int32 *speed);
_IMPEXP_BE status_t set_mouse_acceleration(int32 speed);
_IMPEXP_BE status_t get_key_repeat_rate(int32 *rate);
_IMPEXP_BE status_t set_key_repeat_rate(int32 rate);
_IMPEXP_BE status_t get_key_repeat_delay(bigtime_t *delay);
_IMPEXP_BE status_t set_key_repeat_delay(bigtime_t delay);
_IMPEXP_BE uint32 modifiers();
_IMPEXP_BE status_t get_key_info(key_info *info);
_IMPEXP_BE void get_key_map(key_map **map, char **key_buffer);
_IMPEXP_BE status_t get_keyboard_id(uint16 *id);
_IMPEXP_BE void set_modifier_key(uint32 modifier, uint32 key);
_IMPEXP_BE void set_keyboard_locks(uint32 modifiers);
_IMPEXP_BE rgb_color keyboard_navigation_color();
_IMPEXP_BE int32 count_workspaces();
_IMPEXP_BE void set_workspace_count(int32 count);
_IMPEXP_BE int32 current_workspace();
_IMPEXP_BE void activate_workspace(int32 workspace);
_IMPEXP_BE bigtime_t idle_time();
_IMPEXP_BE void run_select_printer_panel();
_IMPEXP_BE void run_add_printer_panel();
_IMPEXP_BE void run_be_about();
_IMPEXP_BE void set_focus_follows_mouse(bool follow);
_IMPEXP_BE bool focus_follows_mouse();
enum mode_mouse {
B_NORMAL_MOUSE = 0,
B_FOCUS_FOLLOWS_MOUSE = 1,
B_WARP_MOUSE = 3,
B_INSTANT_WARP_MOUSE = 7
};
_IMPEXP_BE void set_mouse_mode(mode_mouse mode);
_IMPEXP_BE mode_mouse mouse_mode();
enum color_which {
B_PANEL_BACKGROUND_COLOR = 1,
B_PANEL_TEXT_COLOR = 10,
B_DOCUMENT_BACKGROUND_COLOR = 11,
B_DOCUMENT_TEXT_COLOR = 12,
B_CONTROL_BACKGROUND_COLOR = 13,
B_CONTROL_TEXT_COLOR = 14,
B_CONTROL_BORDER_COLOR = 15,
B_CONTROL_HIGHLIGHT_COLOR = 16,
B_NAVIGATION_BASE_COLOR = 4,
B_NAVIGATION_PULSE_COLOR = 17,
B_SHINE_COLOR = 18,
B_SHADOW_COLOR = 19,
B_MENU_BACKGROUND_COLOR = 2,
B_MENU_SELECTED_BACKGROUND_COLOR = 6,
B_MENU_ITEM_TEXT_COLOR = 7,
B_MENU_SELECTED_ITEM_TEXT_COLOR = 8,
B_MENU_SELECTED_BORDER_COLOR = 9,
B_TOOLTIP_BACKGROUND_COLOR = 20,
B_TOOLTIP_TEXT_COLOR = 21,
B_SUCCESS_COLOR = 100,
B_FAILURE_COLOR = 101,
// Old name synonyms.
B_KEYBOARD_NAVIGATION_COLOR = B_NAVIGATION_BASE_COLOR,
B_MENU_SELECTION_BACKGROUND_COLOR = B_MENU_SELECTED_BACKGROUND_COLOR,
// These are deprecated -- do not use in new code. See BScreen for
// the replacement for B_DESKTOP_COLOR.
B_DESKTOP_COLOR = 5,
B_WINDOW_TAB_COLOR = 3,
B_RANDOM_COLOR = 0x80000000,
B_MICHELANGELO_FAVORITE_COLOR,
B_DSANDLER_FAVORITE_SKY_COLOR,
B_DSANDLER_FAVORITE_INK_COLOR,
B_DSANDLER_FAVORITE_SHOES_COLOR
};
_IMPEXP_BE rgb_color ui_color(color_which which);
_IMPEXP_BE rgb_color tint_color(rgb_color color, float tint);
extern "C" status_t _init_interface_kit_();
/* effects on standard gray level */
const float B_LIGHTEN_MAX_TINT = 0.0F; /* 216 --> 255.0 (255) */
const float B_LIGHTEN_2_TINT = 0.385F; /* 216 --> 240.0 (240) */
const float B_LIGHTEN_1_TINT = 0.590F; /* 216 --> 232.0 (232) */
const float B_NO_TINT = 1.0F; /* 216 --> 216.0 (216) */
const float B_DARKEN_1_TINT = 1.147F; /* 216 --> 184.2 (184) */
const float B_DARKEN_2_TINT = 1.295F; /* 216 --> 152.3 (152) */
const float B_DARKEN_3_TINT = 1.407F; /* 216 --> 128.1 (128) */
const float B_DARKEN_4_TINT = 1.555F; /* 216 --> 96.1 (96) */
const float B_DARKEN_MAX_TINT = 2.0F; /* 216 --> 0.0 (0) */
const float B_DISABLED_LABEL_TINT = B_DARKEN_3_TINT;
const float B_HIGHLIGHT_BACKGROUND_TINT = B_DARKEN_2_TINT;
const float B_DISABLED_MARK_TINT = B_LIGHTEN_2_TINT;
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif // _INTERFACE_DEFS_H
+87
View File
@@ -0,0 +1,87 @@
/*******************************************************************************
/
/ File: ListItem.h
/
/ Description: BListView represents a one-dimensional list view.
/
/ Copyright 1996-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _LIST_ITEM_H
#define _LIST_ITEM_H
#include <BeBuild.h>
#include <Archivable.h>
#include <Rect.h>
class BFont;
class BMessage;
class BOutlineListView;
class BView;
/*----------------------------------------------------------------*/
/*----- BListItem class ------------------------------------------*/
class BListItem : public BArchivable {
public:
BListItem(uint32 outlineLevel = 0, bool expanded = true);
BListItem(BMessage *data);
virtual ~BListItem();
virtual status_t Archive(BMessage *data, bool deep = true) const;
float Height() const;
float Width() const;
bool IsSelected() const;
void Select();
void Deselect();
virtual void SetEnabled(bool on);
bool IsEnabled() const;
void SetHeight(float height);
void SetWidth(float width);
virtual void DrawItem(BView *owner,
BRect bounds,
bool complete = false) = 0;
virtual void Update(BView *owner, const BFont *font);
virtual status_t Perform(perform_code d, void *arg);
bool IsExpanded() const;
void SetExpanded(bool expanded);
uint32 OutlineLevel() const;
/*----- Private or reserved -----------------------------------------*/
private:
friend class BOutlineListView;
bool HasSubitems() const;
virtual void _ReservedListItem1();
virtual void _ReservedListItem2();
BListItem(const BListItem &);
BListItem &operator=(const BListItem &);
/* calls used by BOutlineListView*/
bool IsItemVisible() const;
void SetItemVisible(bool);
uint32 _reserved[2];
float fWidth;
float fHeight;
uint32 fLevel;
bool fSelected;
bool fEnabled;
bool fExpanded;
bool fHasSubitems : 1;
bool fVisible : 1;
};
/*-------------------------------------------------------------*/
#include <StringItem.h> /* to maintain compatibility */
#endif /* _LIST_ITEM_H */
+201
View File
@@ -0,0 +1,201 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
// Distributed under the terms of the OpenBeOS license
//
// File: ListView.h
// Author: Axel Doerfler
// Description: BListView represents a one-dimensional list view.
//
//------------------------------------------------------------------------------
#ifndef _LIST_VIEW_H
#define _LIST_VIEW_H
#include <Invoker.h>
#include <View.h>
#include <List.h>
#include <ListItem.h>
struct track_data;
enum list_view_type {
B_SINGLE_SELECTION_LIST,
B_MULTIPLE_SELECTION_LIST
};
#ifdef USE_OPENBEOS_NAMESPACE
namespace OpenBeOS {
#endif
//----- BListView class ------------------------------------------
class BListView : public BView, public BInvoker
{
public:
BListView(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);
BListView(BMessage *data);
virtual ~BListView() ;
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void Draw(BRect updateRect);
virtual void MessageReceived(BMessage *msg);
virtual void MouseDown(BPoint where);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void MakeFocus(bool state = true);
virtual void FrameResized(float newWidth, float newHeight);
virtual void TargetedByScrollView(BScrollView *scroller);
void ScrollTo(float x, float y);
virtual void ScrollTo(BPoint where);
virtual bool AddItem(BListItem *item);
virtual bool AddItem(BListItem *item, int32 atIndex);
virtual bool AddList(BList *newItems);
virtual bool AddList(BList *newItems, int32 atIndex);
virtual bool RemoveItem(BListItem *item);
virtual BListItem *RemoveItem(int32 index);
virtual bool RemoveItems(int32 index, int32 count);
virtual void SetSelectionMessage(BMessage *message);
virtual void SetInvocationMessage(BMessage *message);
BMessage *SelectionMessage() const;
uint32 SelectionCommand() const;
BMessage *InvocationMessage() const;
uint32 InvocationCommand() const;
virtual void SetListType(list_view_type type);
list_view_type ListType() const;
BListItem *ItemAt(int32 index) const;
int32 IndexOf(BPoint point) const;
int32 IndexOf(BListItem *item) const;
BListItem *FirstItem() const;
BListItem *LastItem() const;
bool HasItem(BListItem *item) const;
int32 CountItems() const;
virtual void MakeEmpty();
bool IsEmpty() const;
void DoForEach(bool (*func)(BListItem *));
void DoForEach(bool (*func)(BListItem *, void *), void *);
const BListItem **Items() const;
void InvalidateItem(int32 index);
void ScrollToSelection();
void Select(int32 index, bool extend = false);
void Select(int32 from, int32 to, bool extend = false);
bool IsItemSelected(int32 index) const;
int32 CurrentSelection(int32 index = 0) const;
virtual status_t Invoke(BMessage *msg = NULL);
void DeselectAll();
void DeselectExcept(int32 except_from, int32 except_to);
void Deselect(int32 index);
virtual void SelectionChanged();
void SortItems(int (*cmp)(const void *, const void *));
/* These functions bottleneck through DoMiscellaneous() */
bool SwapItems(int32 a, int32 b);
bool MoveItem(int32 from, int32 to);
bool ReplaceItem(int32 index, BListItem *item);
virtual void AttachedToWindow();
virtual void FrameMoved(BPoint new_position);
BRect ItemFrame(int32 index);
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 code, void *arg);
virtual void WindowActivated(bool state);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 code, const BMessage *msg);
virtual void DetachedFromWindow();
virtual bool InitiateDrag(BPoint point, int32 itemIndex, bool initialySelected);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float *width, float *height);
virtual void AllAttached();
virtual void AllDetached();
protected:
enum MiscCode { B_NO_OP, B_REPLACE_OP, B_MOVE_OP, B_SWAP_OP };
union MiscData {
struct Spare { int32 data[5]; };
struct Replace { int32 index; BListItem *item; } replace;
struct Move { int32 from; int32 to; } move;
struct Swap { int32 a; int32 b; } swap;
};
virtual bool DoMiscellaneous(MiscCode code, MiscData *data);
//----- Private or reserved -----------------------------------------
private:
friend class BOutlineListView;
virtual void _ReservedListView2();
virtual void _ReservedListView3();
virtual void _ReservedListView4();
BListView &operator=(const BListView &);
void InitObject(list_view_type type);
void FixupScrollBar();
void InvalidateFrom(int32 index);
status_t PostMsg(BMessage *msg);
void FontChanged();
int32 RangeCheck(int32 index);
bool _Select(int32 index, bool extend);
bool _Select(int32 from, int32 to, bool extend);
bool _Deselect(int32 index);
void Deselect(int32 from, int32 to);
bool _DeselectAll(int32 except_from, int32 except_to);
void PerformDelayedSelect();
bool TryInitiateDrag(BPoint where);
int32 CalcFirstSelected(int32 after);
int32 CalcLastSelected(int32 before);
virtual void DrawItem(BListItem *item, BRect itemRect, bool complete = false);
bool DoSwapItems(int32 a, int32 b);
bool DoMoveItem(int32 from, int32 to);
bool DoReplaceItem(int32 index, BListItem *item);
void RescanSelection(int32 from, int32 to);
void DoMouseUp(BPoint where);
void DoMouseMoved(BPoint where);
BList fList;
list_view_type fListType;
int32 fFirstSelected;
int32 fLastSelected;
int32 fAnchorIndex;
float fWidth;
BMessage *fSelectMessage;
BScrollView *fScrollView;
track_data *fTrack;
uint32 _reserved[3];
};
inline void
BListView::ScrollTo(float x, float y)
{
/* OK, no private parts */
ScrollTo(BPoint(x, y));
}
/*-------------------------------------------------------------*/
#ifdef USE_OPENBEOS_NAMESPACE
}
#endif
#endif /* _LIST_VIEW_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 class BWindow;
friend class BMenuBar;
friend class 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 class BWindow;
friend class BMenuItem;
friend class BMenuField;
friend class 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 */
+124
View File
@@ -0,0 +1,124 @@
/*******************************************************************************
/
/ 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 class BMenu;
friend class BPopUpMenu;
friend class 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];
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
// We moved BSeparatorItem's declaration to its own file, but for source
// compatibility we have to export that class from here too.
#include <SeparatorItem.h>
#endif /* _MENU_ITEM_H */
@@ -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 */
@@ -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 */
@@ -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 */
+105
View File
@@ -0,0 +1,105 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Picture.h
// Author: Marc Flerackers ([email protected])
// Description: BPicture records a series of drawing instructions that can
// be "replayed" later.
//------------------------------------------------------------------------------
#ifndef _PICTURE_H
#define _PICTURE_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <InterfaceDefs.h>
#include <Rect.h>
#include <Archivable.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
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
+151
View File
@@ -0,0 +1,151 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: PictureButton.h
// Author: Graham MacDonald ([email protected])
// Description: BPictureButton displays and controls a picture button in a
// window.
//------------------------------------------------------------------------------
#ifndef _PICTURE_BUTTON_H
#define _PICTURE_BUTTON_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Control.h>
#include <Picture.h> /* For convenience */
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
enum {
B_ONE_STATE_BUTTON,
B_TWO_STATE_BUTTON
};
// BPictureButton class --------------------------------------------------------
class BPictureButton : public BControl
{
public:
BPictureButton (BRect frame,
const char* name,
BPicture *off,
BPicture *on,
BMessage *message,
uint32 behavior = B_ONE_STATE_BUTTON,
uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flgs = B_WILL_DRAW | B_NAVIGABLE);
BPictureButton (BMessage *data);
virtual ~BPictureButton ();
static BArchivable *Instantiate (BMessage *data);
virtual status_t Archive (BMessage *data, bool deep = true) const;
virtual void Draw (BRect updateRect);
virtual void MouseDown (BPoint point);
virtual void KeyDown (const char *bytes, int32 numBytes);
virtual void SetEnabledOn (BPicture *on);
virtual void SetEnabledOff (BPicture *off);
virtual void SetDisabledOn (BPicture *on);
virtual void SetDisabledOff (BPicture *off);
BPicture *EnabledOn () const;
BPicture *EnabledOff () const;
BPicture *DisabledOn () const;
BPicture *DisabledOff () const;
virtual void SetBehavior (uint32 behavior);
uint32 Behavior () const;
virtual void MessageReceived (BMessage *msg);
virtual void MouseUp (BPoint point);
virtual void WindowActivated (bool state);
virtual void MouseMoved (BPoint pt, uint32 code, const BMessage *msg);
virtual void AttachedToWindow ();
virtual void DetachedFromWindow ();
virtual void SetValue (int32 value);
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 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:
virtual void _ReservedPictureButton1 ();
virtual void _ReservedPictureButton2 ();
virtual void _ReservedPictureButton3 ();
BPictureButton &operator= (const BPictureButton &);
void Redraw ();
void InitData ();
BPicture *fEnabledOff;
BPicture *fEnabledOn;
BPicture *fDisabledOff;
BPicture *fDisabledOn;
bool fOutlined;
uint32 fBehavior;
uint32 _reserved[4];
};
//------------------------------------------------------------------------------
#endif /* _PICTURE_BUTTON_H */
/*
* $Log $
*
* $Id $
*
*/
+114
View File
@@ -0,0 +1,114 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Point.h
// Author: Frans van Nispen
// Description: BPoint represents a single x,y coordinate.
//------------------------------------------------------------------------------
#ifndef _POINT_H
#define _POINT_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <SupportDefs.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class BRect;
// BPoint class ----------------------------------------------------------------
class BPoint {
public:
float x;
float y;
BPoint();
BPoint(float X, float Y);
BPoint(const BPoint &p);
BPoint &operator=(const BPoint &p);
void Set(float X, float Y);
void ConstrainTo(BRect r);
void PrintToStream() const;
BPoint operator+(const BPoint &p) const;
BPoint operator-(const BPoint &p) const;
BPoint& operator+=(const BPoint &p);
BPoint& operator-=(const BPoint &p);
bool operator!=(const BPoint &p) const;
bool operator==(const BPoint &p) const;
};
//------------------------------------------------------------------------------
extern _IMPEXP_BE const BPoint B_ORIGIN; // returns (0,0)
//------------------------------------------------------------------------------
inline BPoint::BPoint()
{
x = y = 0;
}
//------------------------------------------------------------------------------
inline BPoint::BPoint(float X, float Y)
{
x = X;
y = Y;
}
//------------------------------------------------------------------------------
inline BPoint::BPoint(const BPoint& pt)
{
x = pt.x;
y = pt.y;
}
//------------------------------------------------------------------------------
inline BPoint &BPoint::operator=(const BPoint& from)
{
x = from.x;
y = from.y;
return *this;
}
//------------------------------------------------------------------------------
inline void BPoint::Set(float X, float Y)
{
x = X;
y = Y;
}
//------------------------------------------------------------------------------
#endif // _POINT_H
/*
* $Log $
*
* $Id $
*
*/
+84
View File
@@ -0,0 +1,84 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Polygon.h
// Author: Marc Flerackers ([email protected])
// Description: BPolygon represents a n-sided area.
//------------------------------------------------------------------------------
#ifndef _POLYGON_H
#define _POLYGON_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <InterfaceDefs.h>
#include <Rect.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
// BPolygon class --------------------------------------------------------------
class BPolygon {
public:
BPolygon(const BPoint *ptArray, int32 numPoints);
BPolygon();
BPolygon(const BPolygon *poly);
virtual ~BPolygon();
BPolygon &operator=(const BPolygon &from);
BRect Frame() const;
void AddPoints(const BPoint *ptArray, int32 numPoints);
int32 CountPoints() const;
void MapTo(BRect srcRect, BRect dstRect);
void PrintToStream() const;
private:
friend class BView;
void compute_bounds();
void map_pt(BPoint *point, BRect srcRect, BRect dstRect);
void map_rect(BRect *rect, BRect srcRect, BRect dstRect);
BRect fBounds;
int32 fCount;
BPoint *fPts;
};
//------------------------------------------------------------------------------
#endif // _POLYGON_H_
/*
* $Log $
*
* $Id $
*
*/
+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 */
+123
View File
@@ -0,0 +1,123 @@
/*******************************************************************************
/
/ File: PrintJob.h
/
/ Description: BPrintJob runs a printing session.
/
/ Copyright 1996-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _PRINTSESSION_H
#define _PRINTSESSION_H
#include <BeBuild.h>
#include <Picture.h> /* For convenience */
#include <Rect.h>
class BView;
/*----------------------------------------------------------------*/
/*----- BPrintJob related structures -----------------------------*/
struct print_file_header {
int32 version;
int32 page_count;
off_t first_page;
int32 _reserved_3_;
int32 _reserved_4_;
int32 _reserved_5_;
};
struct _page_header_;
/*----------------------------------------------------------------*/
/*----- BPrintJob class ------------------------------------------*/
class BPrintJob {
public:
enum // These values are returned by PrinterType()
{
B_BW_PRINTER = 0,
B_COLOR_PRINTER
};
BPrintJob(const char *job_name);
virtual ~BPrintJob();
void BeginJob();
void CommitJob();
status_t ConfigJob();
void CancelJob();
status_t ConfigPage();
void SpoolPage();
bool CanContinue();
virtual void DrawView(BView *a_view, BRect a_rect, BPoint where);
BMessage *Settings() /* const */ ;
void SetSettings(BMessage *a_msg);
bool IsSettingsMessageValid(BMessage *a_msg) const;
BRect PaperRect();
BRect PrintableRect();
void GetResolution(int32 *xdpi, int32 *ydpi);
int32 FirstPage() /* const */ ;
int32 LastPage() /* const */ ;
int32 PrinterType(void * = NULL) const;
/*----- Private or reserved -----------------------------------------*/
private:
virtual void _ReservedPrintJob1();
virtual void _ReservedPrintJob2();
virtual void _ReservedPrintJob3();
virtual void _ReservedPrintJob4();
BPrintJob(const BPrintJob &);
BPrintJob &operator=(const BPrintJob &);
void RecurseView(BView *v, BPoint origin, BPicture *p, BRect r);
void MangleName(char *filename);
void HandlePageSetup(BMessage *setup);
bool HandlePrintSetup(BMessage *setup);
void NewPage();
void EndLastPage();
void AddSetupSpec();
void AddPicture(BPicture *picture, BRect *rect, BPoint where);
char* GetCurrentPrinterName() const;
void LoadDefaultSettings();
char * print_job_name;
int32 page_number;
BFile * spoolFile;
print_file_header current_header;
BRect paper_size;
BRect usable_size;
int pr_error;
char spool_file_name[256];
BMessage *setup_msg;
BMessage *default_setup_msg;
char stop_the_show;
int32 first_page;
int32 last_page;
short v_xres;
short v_yres;
_page_header_ * m_curPageHeader;
off_t m_curPageHeaderOffset;
uint32 _reserved[2];
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _PRINTSESSION_H */
+118
View File
@@ -0,0 +1,118 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: RadioButton.cpp
// Author: Marc Flerackers ([email protected])
// Description: BRadioButton represents a single on/off button. All
// sibling BRadioButton objects comprise a single
// "multiple choice" control.
//------------------------------------------------------------------------------
#ifndef _RADIO_BUTTON_H
#define _RADIO_BUTTON_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Control.h>
#include <Bitmap.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
// BRadioButton class ----------------------------------------------------------
class BRadioButton : public BControl {
public:
BRadioButton(BRect frame,
const char *name,
const char *label,
BMessage *message,
uint32 resizMask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BRadioButton(BMessage *archive);
virtual ~BRadioButton();
static BArchivable *Instantiate(BMessage *archive);
virtual status_t Archive(BMessage *archive, bool deep = true) const;
virtual void Draw(BRect updateRect);
virtual void MouseDown(BPoint point);
virtual void AttachedToWindow();
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void SetValue(int32 value);
virtual void GetPreferredSize(float *width, float *height);
virtual void ResizeToPreferred();
virtual status_t Invoke(BMessage *message = NULL);
virtual void MessageReceived(BMessage *message);
virtual void WindowActivated(bool active);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
virtual void DetachedFromWindow();
virtual void FrameMoved(BPoint newLocation);
virtual void FrameResized(float width, float height);
virtual BHandler *ResolveSpecifier(BMessage *message,
int32 index,
BMessage *specifier,
int32 what,
const char *property);
virtual void MakeFocus(bool focused = true);
virtual void AllAttached();
virtual void AllDetached();
virtual status_t GetSupportedSuites(BMessage *message);
virtual status_t Perform(perform_code d, void *arg);
private:
friend status_t _init_interface_kit_();
virtual void _ReservedRadioButton1();
virtual void _ReservedRadioButton2();
BRadioButton &operator=(const BRadioButton &);
BRect _KnobFrame() const;
static BBitmap *sBitmaps[2][3];
bool fOutlined;
uint32 _reserved[2];
};
//------------------------------------------------------------------------------
#endif // _RADIO_BUTTON_H
/*
* $Log $
*
* $Id $
*
*/
+213
View File
@@ -0,0 +1,213 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2005, Haiku
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Rect.h
// Author: Frans van Nispen ([email protected])
// Description: BRect represents a rectangular area.
//------------------------------------------------------------------------------
#ifndef _RECT_H
#define _RECT_H
#include <SupportDefs.h>
#include <Point.h>
#include <math.h>
class BRect {
public:
float left;
float top;
float right;
float bottom;
BRect();
BRect(const BRect &r);
BRect(float l, float t, float r, float b);
BRect(BPoint lt, BPoint rb);
BRect &operator=(const BRect &r);
void Set(float l, float t, float r, float b);
void PrintToStream() const;
BPoint LeftTop() const;
BPoint RightBottom() const;
BPoint LeftBottom() const;
BPoint RightTop() const;
void SetLeftTop(const BPoint p);
void SetRightBottom(const BPoint p);
void SetLeftBottom(const BPoint p);
void SetRightTop(const BPoint p);
// transformation
void InsetBy(BPoint p);
void InsetBy(float dx, float dy);
void OffsetBy(BPoint p);
void OffsetBy(float dx, float dy);
void OffsetTo(BPoint p);
void OffsetTo(float x, float y);
// expression transformations
BRect& InsetBySelf(BPoint);
BRect& InsetBySelf(float dx, float dy);
BRect InsetByCopy(BPoint);
BRect InsetByCopy(float dx, float dy);
BRect& OffsetBySelf(BPoint);
BRect& OffsetBySelf(float dx, float dy);
BRect OffsetByCopy(BPoint);
BRect OffsetByCopy(float dx, float dy);
BRect& OffsetToSelf(BPoint);
BRect& OffsetToSelf(float dx, float dy);
BRect OffsetToCopy(BPoint);
BRect OffsetToCopy(float dx, float dy);
// comparison
bool operator==(BRect r) const;
bool operator!=(BRect r) const;
// intersection and union
BRect operator&(BRect r) const;
BRect operator|(BRect r) const;
bool Intersects(BRect r) const;
bool IsValid() const;
float Width() const;
int32 IntegerWidth() const;
float Height() const;
int32 IntegerHeight() const;
bool Contains(BPoint p) const;
bool Contains(BRect r) const;
};
// inline definitions ----------------------------------------------------------
inline BPoint
BRect::LeftTop() const
{
return *(const BPoint *)&left;
}
inline BPoint
BRect::RightBottom() const
{
return *(const BPoint *)&right;
}
inline BPoint
BRect::LeftBottom() const
{
return BPoint(left, bottom);
}
inline BPoint
BRect::RightTop() const
{
return BPoint(right, top);
}
inline
BRect::BRect()
{
top = left = 0;
bottom = right = -1;
}
inline
BRect::BRect(float l, float t, float r, float b)
{
left = l;
top = t;
right = r;
bottom = b;
}
inline
BRect::BRect(const BRect &r)
{
left = r.left;
top = r.top;
right = r.right;
bottom = r.bottom;
}
inline
BRect::BRect(BPoint leftTop, BPoint rightBottom)
{
left = leftTop.x;
top = leftTop.y;
right = rightBottom.x;
bottom = rightBottom.y;
}
inline BRect &
BRect::operator=(const BRect& from)
{
left = from.left;
top = from.top;
right = from.right;
bottom = from.bottom;
return *this;
}
inline void
BRect::Set(float l, float t, float r, float b)
{
left = l;
top = t;
right = r;
bottom = b;
}
inline bool
BRect::IsValid() const
{
return left <= right && top <= bottom;
}
inline int32
BRect::IntegerWidth() const
{
return (int32)ceil(right - left);
}
inline float
BRect::Width() const
{
return right - left;
}
inline int32
BRect::IntegerHeight() const
{
return (int32)ceil(bottom - top);
}
inline float
BRect::Height() const
{
return bottom - top;
}
#endif // _RECT_H
+85
View File
@@ -0,0 +1,85 @@
/*******************************************************************************
/
/ 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>
namespace BPrivate {
class ServerLink;
};
/* 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 -----------------------------------------*/
class Support;
private:
friend class BView;
friend class BDirectWindow;
friend class Support;
friend class BPrivate::ServerLink;
void _AddRect(clipping_rect r);
void set_size(long new_size);
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 */
+153
View File
@@ -0,0 +1,153 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: ScrollBar.h
// Author: Marc Flerackers ([email protected])
// DarkWyrm ([email protected])
// Description: Client-side class for scrolling
//
//------------------------------------------------------------------------------
#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
#define SCROLL_BAR_MAXIMUM_KNOB_SIZE 50
#define SCROLL_BAR_MINIMUM_KNOB_SIZE 9
//----------------------------------------------------------------
//----- 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:
class Private;
friend class Private;
friend status_t control_scrollbar(scroll_bar_info *info, BScrollBar *bar); // for use within the preflet
virtual void _ReservedScrollBar1();
virtual void _ReservedScrollBar2();
virtual void _ReservedScrollBar3();
virtual void _ReservedScrollBar4();
BScrollBar &operator=(const BScrollBar &);
bool _DoubleArrows() const;
void _UpdateThumbFrame();
float _ValueFor(BPoint where) const;
int32 _ButtonFor(BPoint where) const;
BRect _ButtonRectFor(int32 button) const;
void _UpdateTargetValue(BPoint where);
void _UpdateArrowButtons();
void _DrawArrowButton(int32 direction,
BRect frame, bool down);
/* void DrawButtons(BRect updateRect);
void DrawArrow(BPoint pos, int32 which, bool pressed = false);
void DrawButton(BRect frame, int32 arrowType, bool pressed = false);
BRect BarFrame() const;
BRect KnobFrame() const;
float ValueToPosition(float val) const;
float PositionToValue(float pos) const;*/
float fMin;
float fMax;
float fSmallStep;
float fLargeStep;
float fValue;
float fProportion;
BView* fTarget;
orientation fOrientation;
char* fTargetName;
Private* fPrivateData;
uint32 _reserved[3];
};
//-------------------------------------------------------------
//-------------------------------------------------------------
#endif // _SCROLL_BAR_H
+92
View File
@@ -0,0 +1,92 @@
/*
** Copyright 2004, OpenBeOS. All Rights Reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#ifndef _SCROLL_VIEW_H
#define _SCROLL_VIEW_H
/** The BScrollView is a convenience class to add a scrolling
* mechanism to the target view.
*/
#include <ScrollBar.h>
class BScrollView : public BView {
public:
BScrollView(const char *name, BView *target,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = 0, bool horizontal = false, bool vertical = false,
border_style border = B_FANCY_BORDER);
BScrollView(BMessage *archive);
virtual ~BScrollView();
static BArchivable *Instantiate(BMessage *archive);
virtual status_t Archive(BMessage *archive, bool deep = true) const;
virtual void Draw(BRect updateRect);
virtual void AttachedToWindow();
BScrollBar *ScrollBar(orientation posture) const;
virtual void SetBorder(border_style border);
border_style Border() const;
virtual status_t SetBorderHighlighted(bool state);
bool IsBorderHighlighted() const;
void SetTarget(BView *target);
BView *Target() const;
virtual void MessageReceived(BMessage *message);
virtual void MouseDown(BPoint point);
virtual void WindowActivated(bool active);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 code, const BMessage *msg);
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void FrameMoved(BPoint position);
virtual void FrameResized(float width, float height);
virtual BHandler *ResolveSpecifier(BMessage *message, 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 methods are following
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 *target, bool h, bool v, border_style);
static float BorderSize(border_style border);
static int32 ModifyFlags(int32 flags, border_style);
BView *fTarget;
BScrollBar *fHorizontalScrollBar;
BScrollBar *fVerticalScrollBar;
border_style fBorder;
uint16 fPreviousWidth;
uint16 fPreviousHeight;
bool fHighlighted;
uint32 _reserved[3];
};
#endif /* _SCROLL_VIEW_H */
@@ -0,0 +1,32 @@
#ifndef _SEPARATOR_ITEM_H
#define _SEPARATOR_ITEM_H
#include <MenuItem.h>
class BMessage;
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:
virtual void _ReservedSeparatorItem1();
virtual void _ReservedSeparatorItem2();
BSeparatorItem &operator=(const BSeparatorItem &);
uint32 _reserved[1];
};
#endif /* _SEPARATOR_ITEM_H */
+98
View File
@@ -0,0 +1,98 @@
/*******************************************************************************
/
/ 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>
namespace BPrivate {
class ServerLink;
};
/*----------------------------------------------------------------*/
/*----- 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 class BShapeIterator;
friend class TPicture;
friend class BView;
friend class BFont;
friend class BPrivate::ServerLink;
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];
};
#endif
+115
View File
@@ -0,0 +1,115 @@
/*
* Copyright 2001-2005, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _SHELF_H
#define _SHELF_H
#include <Handler.h>
#include <List.h>
class BDataIO;
class BView;
class BEntry;
struct entry_ref;
class _rep_data_;
class BShelf : public BHandler {
public:
BShelf(BView* view, bool allowDrags = true, const char* shelfType = NULL);
BShelf(const entry_ref* ref, BView* view, bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BDataIO* stream, BView* view, bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BMessage *data);
virtual ~BShelf();
virtual status_t Archive(BMessage* data, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive);
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 *replicantView) 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:
friend class _TContainerViewFilter_;
virtual void _ReservedShelf2();
virtual void _ReservedShelf3();
virtual void _ReservedShelf4();
virtual void _ReservedShelf5();
virtual void _ReservedShelf6();
virtual void _ReservedShelf7();
virtual void _ReservedShelf8();
BShelf(const BShelf& other);
BShelf& operator=(const BShelf& other);
status_t _Archive(BMessage* data) const;
void _InitData(BEntry* entry, BDataIO* stream,
BView* view, bool allowDrags);
status_t _DeleteReplicant(_rep_data_* replicant);
status_t _RealAddReplicant(BMessage* data,
BPoint* location, uint32 uniqueID);
status_t _GetProperty(BMessage* message, BMessage* reply);
private:
BView* fContainerView;
BDataIO* fStream;
BEntry* fEntry;
BList fReplicants;
_TContainerViewFilter_* fFilter;
uint32 fGenCount;
bool fAllowDragging;
bool fDirty;
bool fDisplayZombies;
bool fAllowZombies;
bool fTypeEnforced;
uint32 _reserved[8];
};
#endif /* _SHELF_H */
+209
View File
@@ -0,0 +1,209 @@
/*
* Copyright 2001-2005, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Marc Flerackers ([email protected])
*/
#ifndef _SLIDER_H
#define _SLIDER_H
#include <BeBuild.h>
#include <Control.h>
enum hash_mark_location {
B_HASH_MARKS_NONE = 0,
B_HASH_MARKS_TOP = 1,
B_HASH_MARKS_LEFT = 1,
B_HASH_MARKS_BOTTOM = 2,
B_HASH_MARKS_RIGHT = 2,
B_HASH_MARKS_BOTH = 3
};
enum thumb_style {
B_BLOCK_THUMB,
B_TRIANGLE_THUMB
};
#define USE_OFF_SCREEN_VIEW 0
class BSlider : public BControl {
public:
BSlider(BRect frame, const char *name, const char *label,
BMessage *message, int32 minValue, int32 maxValue,
thumb_style thumbType = B_BLOCK_THUMB,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_NAVIGABLE | B_WILL_DRAW | B_FRAME_EVENTS);
BSlider(BRect frame, const char *name, const char *label,
BMessage *message, int32 minValue, int32 maxValue,
orientation posture, thumb_style thumbType = B_BLOCK_THUMB,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_NAVIGABLE | B_WILL_DRAW | B_FRAME_EVENTS);
BSlider(BMessage *data);
virtual ~BSlider();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual status_t Perform(perform_code d, void *arg);
virtual void WindowActivated(bool state);
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void DetachedFromWindow();
virtual void MessageReceived(BMessage *msg);
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float w,float h);
virtual void KeyDown(const char * bytes, int32 n);
virtual void MouseDown(BPoint);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved(BPoint pt, uint32 c, const BMessage *m);
virtual void Pulse();
virtual void SetLabel(const char *label);
virtual void SetLimitLabels(const char *minLabel,
const char *maxLabel);
const char* MinLimitLabel() const;
const char* MaxLimitLabel() const;
virtual void SetValue(int32);
virtual int32 ValueForPoint(BPoint) const;
virtual void SetPosition(float);
float Position() const;
virtual void SetEnabled(bool on);
void GetLimits(int32 * minimum, int32 * maximum);
virtual void Draw(BRect);
virtual void DrawSlider();
virtual void DrawBar();
virtual void DrawHashMarks();
virtual void DrawThumb();
virtual void DrawFocusMark();
virtual void DrawText();
virtual char* UpdateText() const;
virtual BRect BarFrame() const;
virtual BRect HashMarksFrame() const;
virtual BRect ThumbFrame() const;
virtual void SetFlags(uint32 flags);
virtual void SetResizingMode(uint32 mode);
virtual void GetPreferredSize( float *width, float *height);
virtual void ResizeToPreferred();
virtual status_t Invoke(BMessage *msg=NULL);
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 void SetSnoozeAmount(int32);
int32 SnoozeAmount() const;
virtual void SetKeyIncrementValue(int32 value);
int32 KeyIncrementValue() const;
virtual void SetHashMarkCount(int32 count);
int32 HashMarkCount() const;
virtual void SetHashMarks(hash_mark_location where);
hash_mark_location HashMarks() const;
virtual void SetStyle(thumb_style s);
thumb_style Style() const;
virtual void SetBarColor(rgb_color);
rgb_color BarColor() const;
virtual void UseFillColor(bool, const rgb_color* c=NULL);
bool FillColor(rgb_color*) const;
BView* OffscreenView() const;
orientation Orientation() const;
virtual void SetOrientation(orientation);
float BarThickness() const;
virtual void SetBarThickness(float thickness);
virtual void SetFont(const BFont *font, uint32 properties = B_FONT_ALL);
#ifdef __HAIKU__
virtual void SetLimits(int32 minimum, int32 maximum); // Was _ReservedSlider4()
#endif
private:
void _DrawBlockThumb();
void _DrawTriangleThumb();
BPoint _Location() const;
void _SetLocation(BPoint p);
float _MinPosition() const;
float _MaxPosition() const;
bool _ConstrainPoint(BPoint point, BPoint compare) const;
#ifndef __HAIKU__
virtual void _ReservedSlider4();
#endif
virtual void _ReservedSlider5();
virtual void _ReservedSlider6();
virtual void _ReservedSlider7();
virtual void _ReservedSlider8();
virtual void _ReservedSlider9();
virtual void _ReservedSlider10();
virtual void _ReservedSlider11();
virtual void _ReservedSlider12();
BSlider& operator=(const BSlider &);
void _InitObject();
private:
BMessage* fModificationMessage;
int32 fSnoozeAmount;
rgb_color fBarColor;
rgb_color fFillColor;
bool fUseFillColor;
char* fMinLimitStr;
char* fMaxLimitStr;
int32 fMinValue;
int32 fMaxValue;
int32 fKeyIncrementValue;
int32 fHashMarkCount;
hash_mark_location fHashMarks;
#if USE_OFF_SCREEN_VIEW
BBitmap* fOffScreenBits;
BView* fOffScreenView;
#endif
thumb_style fStyle;
BPoint fLocation;
BPoint fInitialLocation;
orientation fOrientation;
float fBarThickness;
#if USE_OFF_SCREEN_VIEW
uint32 _reserved[8];
#else
uint32 _reserved[10];
#endif
};
#endif // _SLIDER_H
+141
View File
@@ -0,0 +1,141 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: StatusBar.h
// Author: Marc Flerackers ([email protected])
// Description: BStatusBar displays a "percentage-of-completion" gauge.
//------------------------------------------------------------------------------
#ifndef _STATUS_BAR_H
#define _STATUS_BAR_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <View.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
// BStatusBar class ------------------------------------------------------------
class BStatusBar : public BView
{
public:
BStatusBar(BRect frame, const char *name, const char *label = NULL,
const char *trailingLabel = NULL);
BStatusBar(BMessage *archive);
virtual ~BStatusBar();
static BArchivable *Instantiate(BMessage *archive);
virtual status_t Archive(BMessage *archive, bool deep = true) const;
virtual void AttachedToWindow();
virtual void MessageReceived(BMessage *message);
virtual void Draw(BRect updateRect);
virtual void SetBarColor(rgb_color color);
virtual void SetBarHeight(float height);
virtual void SetText(const char *string);
virtual void SetTrailingText(const char *string);
virtual void SetMaxValue(float max);
void Update(float delta, const char *text = NULL, const char *trailingText = NULL);
virtual void Reset(const char *label = NULL, const char *trailingLabel = NULL);
float CurrentValue() const;
float MaxValue() const;
rgb_color BarColor() const;
float BarHeight() const;
const char *Text() const;
const char *TrailingText() const;
const char *Label() const;
const char *TrailingLabel() const;
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void WindowActivated(bool state);
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
virtual void DetachedFromWindow();
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
virtual BHandler *ResolveSpecifier(BMessage *message, int32 index, BMessage *specifier,
int32 what, 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);
virtual status_t Perform(perform_code d, void *arg);
private:
virtual void _ReservedStatusBar1();
virtual void _ReservedStatusBar2();
virtual void _ReservedStatusBar3();
virtual void _ReservedStatusBar4();
BStatusBar &operator=(const BStatusBar &);
void InitObject(const char *l, const char *aux_l);
void SetTextData(char **pp, const char *str);
void FillBar(BRect r);
void Resize();
void _Draw(BRect updateRect, bool bar_only);
char *fLabel;
char *fTrailingLabel;
char *fText;
char *fTrailingText;
float fMax;
float fCurrent;
float fBarHeight;
float fTrailingWidth;
rgb_color fBarColor;
float fEraseText;
float fEraseTrailingText;
bool fCustomBarHeight;
bool _pad1;
bool _pad2;
bool _pad3;
uint32 _reserved[3];
};
//------------------------------------------------------------------------------
#endif // _STATUS_BAR_H
/*
* $Log $
*
* $Id $
*
*/
+58
View File
@@ -0,0 +1,58 @@
////////////////////////////////////////////////////////////////////////////////
//
// File: StringItem.h
//
// Description:
//
// Copyright 2001, Ulrich Wimboeck
//
////////////////////////////////////////////////////////////////////////////////
#ifndef _STRING_ITEM_H
#define _STRING_ITEM_H
#include <ListItem.h>
#ifdef USE_OPENBEOS_NAMESPACE
namespace OpenBeOS {
#endif
//----- BStringItem class ----------------------------------------
class BStringItem : public BListItem
{
public:
BStringItem(const char *text, uint32 outlineLevel = 0, bool expanded = true);
BStringItem(BMessage *data);
virtual ~BStringItem();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void DrawItem(BView *owner, BRect frame, bool complete = false);
virtual void SetText(const char *text);
const char *Text() const;
virtual void Update(BView *owner, const BFont *font);
virtual status_t Perform(perform_code code, void *arg);
private:
virtual void _ReservedStringItem1();
virtual void _ReservedStringItem2();
BStringItem(const BStringItem &);
BStringItem& operator=(const BStringItem &);
char *fText;
float fBaselineOffset;
uint32 _reserved[2];
};
#ifdef USE_OPENBEOS_NAMESPACE
}
#endif
#endif /* _STRING_ITEM_H */
+107
View File
@@ -0,0 +1,107 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: StringView.h
// Author: Frans van Nispen ([email protected])
// Description: BStringView draw a non-editable text string
//------------------------------------------------------------------------------
#ifndef _STRING_VIEW_H
#define _STRING_VIEW_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <View.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
// BStringView class -----------------------------------------------------------
class BStringView : public BView{
public:
BStringView(BRect bounds, const char* name, const char* text,
uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
BStringView(BMessage* data);
virtual ~BStringView();
static BArchivable *Instantiate(BMessage* data);
virtual status_t Archive(BMessage* data, bool deep = true) const;
void SetText(const char* text);
const char *Text() const;
void SetAlignment(alignment flag);
alignment Alignment() const;
virtual void AttachedToWindow();
virtual void Draw(BRect bounds);
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 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:
virtual void _ReservedStringView1();
virtual void _ReservedStringView2();
virtual void _ReservedStringView3();
BStringView &operator=(const BStringView&);
char* fText;
alignment fAlign;
uint32 _reserved[3];
};
//------------------------------------------------------------------------------
#endif // _STRINGVIEW_H
/*
* $Log $
*
* $Id $
*
*/
+226
View File
@@ -0,0 +1,226 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: TabView.h
// Author: Marc Flerackers ([email protected])
// Description: BTab creates individual "tabs" that can be assigned
// to specific views.
// BTabView provides the framework for containing and
// managing groups of BTab objects.
//------------------------------------------------------------------------------
#ifndef _TAB_VIEW_H
#define _TAB_VIEW_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <View.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
enum tab_position {
B_TAB_FIRST = 999,
B_TAB_FRONT,
B_TAB_ANY
};
// Globals ---------------------------------------------------------------------
// BTab class ------------------------------------------------------------------
class BTab : public BArchivable {
public:
BTab(BView * tabView = NULL);
virtual ~BTab();
BTab(BMessage *archive);
static BArchivable *Instantiate(BMessage *archive);
virtual status_t Archive(BMessage *archive, bool deep = true) const;
virtual status_t Perform(uint32 d, void *arg);
const char *Label() const;
virtual void SetLabel(const char *label);
bool IsSelected() const;
virtual void Select(BView *owner);
virtual void Deselect();
virtual void SetEnabled(bool enabled);
bool IsEnabled() const;
void MakeFocus(bool inFocus = true);
bool IsFocus() const;
// sets/gets the view to be displayed for this tab
virtual void SetView(BView *view);
BView *View() const;
virtual void DrawFocusMark(BView *owner, BRect frame);
virtual void DrawLabel(BView *owner, BRect frame);
virtual void DrawTab(BView *owner, BRect frame, tab_position position,
bool full = true);
private:
virtual void _ReservedTab1();
virtual void _ReservedTab2();
virtual void _ReservedTab3();
virtual void _ReservedTab4();
virtual void _ReservedTab5();
virtual void _ReservedTab6();
virtual void _ReservedTab7();
virtual void _ReservedTab8();
virtual void _ReservedTab9();
virtual void _ReservedTab10();
virtual void _ReservedTab11();
virtual void _ReservedTab12();
BTab &operator=(const BTab &);
bool fEnabled;
bool fSelected;
bool fFocus;
BView *fView;
uint32 _reserved[12];
};
//------------------------------------------------------------------------------
// BTabView class --------------------------------------------------------------
class BTabView : public BView
{
public:
BTabView(BRect frame, const char *name,
button_width width = B_WIDTH_AS_USUAL,
uint32 resizingMode = B_FOLLOW_ALL,
uint32 flags = B_FULL_UPDATE_ON_RESIZE |
B_WILL_DRAW | B_NAVIGABLE_JUMP |
B_FRAME_EVENTS | B_NAVIGABLE);
~BTabView();
BTabView(BMessage *archive);
static BArchivable *Instantiate(BMessage *archive);
virtual status_t Archive(BMessage*, bool deep=true) const;
virtual status_t Perform(perform_code d, void *arg);
virtual void WindowActivated(bool active);
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void DetachedFromWindow();
virtual void MessageReceived(BMessage *message);
virtual void FrameMoved(BPoint newLocation);
virtual void FrameResized(float width,float height);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit,
const BMessage *message);
virtual void Pulse();
virtual void Select(int32 tab);
int32 Selection() const;
virtual void MakeFocus(bool focused = true);
virtual void SetFocusTab(int32 tab, bool focused);
int32 FocusTab() const;
virtual void Draw(BRect updateRect);
virtual BRect DrawTabs();
virtual void DrawBox(BRect selTabRect);
virtual BRect TabFrame(int32 tab_index) const;
virtual void SetFlags(uint32 flags);
virtual void SetResizingMode(uint32 mode);
virtual void GetPreferredSize(float *width, float *height);
virtual void ResizeToPreferred();
virtual BHandler *ResolveSpecifier(BMessage *message, int32 index,
BMessage *specifier, int32 what, const char *property);
virtual status_t GetSupportedSuites(BMessage *message);
virtual void AddTab(BView *target, BTab *tab = NULL);
#if !_PR3_COMPATIBLE_
virtual BTab *RemoveTab(int32 tabIndex);
#else
virtual BTab *RemoveTab(int32 tabIndex) const;
#endif
virtual BTab *TabAt ( int32 tab_index ) const;
virtual void SetTabWidth(button_width width);
button_width TabWidth() const;
virtual void SetTabHeight(float height);
float TabHeight() const;
BView *ContainerView() const;
int32 CountTabs() const;
BView *ViewForTab(int32 tabIndex) const;
private:
void _InitObject();
virtual void _ReservedTabView1();
virtual void _ReservedTabView2();
virtual void _ReservedTabView3();
virtual void _ReservedTabView4();
virtual void _ReservedTabView5();
virtual void _ReservedTabView6();
virtual void _ReservedTabView7();
virtual void _ReservedTabView8();
virtual void _ReservedTabView9();
virtual void _ReservedTabView10();
virtual void _ReservedTabView11();
virtual void _ReservedTabView12();
BTabView(const BTabView &);
BTabView &operator=(const BTabView &);
BList *fTabList;
BView *fContainerView;
button_width fTabWidthSetting;
float fTabWidth;
float fTabHeight;
int32 fSelection;
int32 fInitialSelection;
int32 fFocus;
uint32 _reserved[12];
};
//------------------------------------------------------------------------------
#endif // _TAB_VIEW_H
/*
* $Log $
*
* $Id $
*
*/
+153
View File
@@ -0,0 +1,153 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: TextControl.cpp
// Author: Frans van Nispen ([email protected])
// Description: BTextControl displays text that can act like a control.
//------------------------------------------------------------------------------
#ifndef _TEXT_CONTROL_H
#define _TEXT_CONTROL_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Control.h>
#include <TextView.h> /* For convenience */
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class _BTextInput_;
// BTextControl class ----------------------------------------------------------
class BTextControl : public BControl {
public:
BTextControl(BRect frame,
const char *name,
const char *label,
const char *initial_text,
BMessage *message,
uint32 rmask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
virtual ~BTextControl();
BTextControl(BMessage *data);
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void SetText(const char *text);
const char *Text() const;
virtual void SetValue(int32 value);
virtual status_t Invoke(BMessage *msg = NULL);
BTextView *TextView() const;
virtual void SetModificationMessage(BMessage *message);
BMessage *ModificationMessage() const;
virtual void SetAlignment(alignment label, alignment text);
void GetAlignment(alignment *label, alignment *text) const;
virtual void SetDivider(float dividing_line);
float Divider() const;
virtual void Draw(BRect updateRect);
virtual void MouseDown(BPoint where);
virtual void AttachedToWindow();
virtual void MakeFocus(bool focusState = true);
virtual void SetEnabled(bool state);
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
virtual void WindowActivated(bool active);
virtual void GetPreferredSize(float *width, float *height);
virtual void ResizeToPreferred();
virtual void MessageReceived(BMessage *msg);
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
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 status_t GetSupportedSuites(BMessage *data);
virtual void SetFlags(uint32 flags);
/*----- Private or reserved -----------------------------------------*/
virtual status_t Perform(perform_code d, void *arg);
private:
friend class _BTextInput_;
virtual void _ReservedTextControl1();
virtual void _ReservedTextControl2();
virtual void _ReservedTextControl3();
virtual void _ReservedTextControl4();
BTextControl &operator=(const BTextControl &);
void CommitValue();
void InitData(const char *label,
const char *initial_text,
BMessage *data = NULL);
_BTextInput_ *fText;
char *fLabel;
BMessage *fModificationMessage;
alignment fLabelAlign;
float fDivider;
uint16 fPrevWidth;
uint16 fPrevHeight;
uint32 _reserved[3]; /* was 4 */
#if !_PR3_COMPATIBLE_
uint32 _more_reserved[4];
#endif
bool fClean;
bool fSkipSetFlags;
bool fUnusedBool1;
bool fUnusedBool2;
};
//------------------------------------------------------------------------------
#endif // _TEXT_CONTROL_H
/*
* $Log $
*
* $Id $
*
*/
+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 RecalculateLineBreaks(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(bool doredraw=true);
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 */
@@ -0,0 +1,125 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: UnicodeBlockObjects.h
// Author: Erik Jaesler ([email protected])
// Description: Predefined unicode_block objects
//------------------------------------------------------------------------------
#ifndef _UNICODEBLOCKOBJECTS_H
#define _UNICODEBLOCKOBJECTS_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <Font.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
// Unicode block list with their unicode encoding range
const unicode_block B_BASIC_LATIN_BLOCK( /* 0000 - 007F */ 0x0000000000000000LL, 0x0000000000000001LL);
const unicode_block B_LATIN1_SUPPLEMENT_BLOCK( /* 0080 - 00FF */ 0x0000000000000000LL, 0x0000000000000002LL);
const unicode_block B_LATIN_EXTENDED_A_BLOCK( /* 0100 - 017F */ 0x0000000000000000LL, 0x0000000000000004LL);
const unicode_block B_LATIN_EXTENDED_B_BLOCK( /* 0180 - 024F */ 0x0000000000000000LL, 0x0000000000000008LL);
const unicode_block B_IPA_EXTENSIONS_BLOCK( /* 0250 - 02AF */ 0x0000000000000000LL, 0x0000000000000010LL);
const unicode_block B_SPACING_MODIFIER_LETTERS_BLOCK( /* 02B0 - 02FF */ 0x0000000000000000LL, 0x0000000000000020LL);
const unicode_block B_COMBINING_DIACRITICAL_MARKS_BLOCK( /* 0300 - 036F */ 0x0000000000000000LL, 0x0000000000000040LL);
const unicode_block B_BASIC_GREEK_BLOCK( /* 0370 - 03CF */ 0x0000000000000000LL, 0x0000000000000080LL);
const unicode_block B_GREEK_SYMBOLS_AND_COPTIC_BLOCK( /* 03D0 - 03FF */ 0x0000000000000000LL, 0x0000000000000100LL);
const unicode_block B_CYRILLIC_BLOCK( /* 0400 - 04FF */ 0x0000000000000000LL, 0x0000000000000200LL);
const unicode_block B_ARMENIAN_BLOCK( /* 0530 - 058F */ 0x0000000000000000LL, 0x0000000000000400LL);
const unicode_block B_BASIC_HEBREW_BLOCK( /* 0590 - 05CF */ 0x0000000000000000LL, 0x0000000000000800LL);
const unicode_block B_HEBREW_EXTENDED_BLOCK( /* 05D0 - 05FF */ 0x0000000000000000LL, 0x0000000000001000LL);
const unicode_block B_BASIC_ARABIC_BLOCK( /* 0600 - 0670 */ 0x0000000000000000LL, 0x0000000000002000LL);
const unicode_block B_ARABIC_EXTENDED_BLOCK( /* 0671 - 06FF */ 0x0000000000000000LL, 0x0000000000004000LL);
const unicode_block B_DEVANAGARI_BLOCK( /* 0900 - 097F */ 0x0000000000000000LL, 0x0000000000008000LL);
const unicode_block B_BENGALI_BLOCK( /* 0980 - 09FF */ 0x0000000000000000LL, 0x0000000000010000LL);
const unicode_block B_GURMUKHI_BLOCK( /* 0A00 - 0A7F */ 0x0000000000000000LL, 0x0000000000020000LL);
const unicode_block B_GUJARATI_BLOCK( /* 0A80 - 0AFF */ 0x0000000000000000LL, 0x0000000000040000LL);
const unicode_block B_ORIYA_BLOCK( /* 0B00 - 0B7F */ 0x0000000000000000LL, 0x0000000000080000LL);
const unicode_block B_TAMIL_BLOCK( /* 0B80 - 0BFF */ 0x0000000000000000LL, 0x0000000000100000LL);
const unicode_block B_TELUGU_BLOCK( /* 0C00 - 0C7F */ 0x0000000000000000LL, 0x0000000000200000LL);
const unicode_block B_KANNADA_BLOCK( /* 0C80 - 0CFF */ 0x0000000000000000LL, 0x0000000000400000LL);
const unicode_block B_MALAYALAM_BLOCK( /* 0D00 - 0D7F */ 0x0000000000000000LL, 0x0000000000800000LL);
const unicode_block B_THAI_BLOCK( /* 0E00 - 0E7F */ 0x0000000000000000LL, 0x0000000001000000LL);
const unicode_block B_LAO_BLOCK( /* 0E80 - 0EFF */ 0x0000000000000000LL, 0x0000000002000000LL);
const unicode_block B_BASIC_GEORGIAN_BLOCK( /* 10A0 - 10CF */ 0x0000000000000000LL, 0x0000000004000000LL);
const unicode_block B_GEORGIAN_EXTENDED_BLOCK( /* 10D0 - 10FF */ 0x0000000000000000LL, 0x0000000008000000LL);
const unicode_block B_HANGUL_JAMO_BLOCK( /* 1100 - 11FF */ 0x0000000000000000LL, 0x0000000010000000LL);
const unicode_block B_LATIN_EXTENDED_ADDITIONAL_BLOCK( /* 1E00 - 1EFF */ 0x0000000000000000LL, 0x0000000020000000LL);
const unicode_block B_GREEK_EXTENDED_BLOCK( /* 1F00 - 1FFF */ 0x0000000000000000LL, 0x0000000040000000LL);
const unicode_block B_GENERAL_PUNCTUATION_BLOCK( /* 2000 - 206F */ 0x0000000000000000LL, 0x0000000080000000LL);
const unicode_block B_SUPERSCRIPTS_AND_SUBSCRIPTS_BLOCK( /* 2070 - 209F */ 0x0000000000000000LL, 0x0000000100000000LL);
const unicode_block B_CURRENCY_SYMBOLS_BLOCK( /* 20A0 - 20CF */ 0x0000000000000000LL, 0x0000000200000000LL);
const unicode_block B_COMBINING_MARKS_FOR_SYMBOLS_BLOCK( /* 20D0 - 20FF */ 0x0000000000000000LL, 0x0000000400000000LL);
const unicode_block B_LETTERLIKE_SYMBOLS_BLOCK( /* 2100 - 214F */ 0x0000000000000000LL, 0x0000000800000000LL);
const unicode_block B_NUMBER_FORMS_BLOCK( /* 2150 - 218F */ 0x0000000000000000LL, 0x0000001000000000LL);
const unicode_block B_ARROWS_BLOCK( /* 2190 - 21FF */ 0x0000000000000000LL, 0x0000002000000000LL);
const unicode_block B_MATHEMATICAL_OPERATORS_BLOCK( /* 2200 - 22FF */ 0x0000000000000000LL, 0x0000004000000000LL);
const unicode_block B_MISCELLANEOUS_TECHNICAL_BLOCK( /* 2300 - 23FF */ 0x0000000000000000LL, 0x0000008000000000LL);
const unicode_block B_CONTROL_PICTURES_BLOCK( /* 2400 - 243F */ 0x0000000000000000LL, 0x0000010000000000LL);
const unicode_block B_OPTICAL_CHARACTER_RECOGNITION_BLOCK( /* 2440 - 245F */ 0x0000000000000000LL, 0x0000020000000000LL);
const unicode_block B_ENCLOSED_ALPHANUMERICS_BLOCK( /* 2460 - 24FF */ 0x0000000000000000LL, 0x0000040000000000LL);
const unicode_block B_BOX_DRAWING_BLOCK( /* 2500 - 257F */ 0x0000000000000000LL, 0x0000080000000000LL);
const unicode_block B_BLOCK_ELEMENTS_BLOCK( /* 2580 - 259F */ 0x0000000000000000LL, 0x0000100000000000LL);
const unicode_block B_GEOMETRIC_SHAPES_BLOCK( /* 25A0 - 25FF */ 0x0000000000000000LL, 0x0000200000000000LL);
const unicode_block B_MISCELLANEOUS_SYMBOLS_BLOCK( /* 2600 - 26FF */ 0x0000000000000000LL, 0x0000400000000000LL);
const unicode_block B_DINGBATS_BLOCK( /* 2700 - 27BF */ 0x0000000000000000LL, 0x0000800000000000LL);
const unicode_block B_CJK_SYMBOLS_AND_PUNCTUATION_BLOCK( /* 3000 - 303F */ 0x0000000000000000LL, 0x0001000000000000LL);
const unicode_block B_HIRAGANA_BLOCK( /* 3040 - 309F */ 0x0000000000000000LL, 0x0002000000000000LL);
const unicode_block B_KATAKANA_BLOCK( /* 30A0 - 30FF */ 0x0000000000000000LL, 0x0004000000000000LL);
const unicode_block B_BOPOMOFO_BLOCK( /* 3100 - 312F */ 0x0000000000000000LL, 0x0008000000000000LL);
const unicode_block B_HANGUL_COMPATIBILITY_JAMO_BLOCK( /* 3130 - 318F */ 0x0000000000000000LL, 0x0010000000000000LL);
const unicode_block B_CJK_MISCELLANEOUS_BLOCK( /* 3190 - 319F */ 0x0000000000000000LL, 0x0020000000000000LL);
const unicode_block B_ENCLOSED_CJK_LETTERS_AND_MONTHS_BLOCK(/* 3200 - 32FF */ 0x0000000000000000LL, 0x0040000000000000LL);
const unicode_block B_CJK_COMPATIBILITY_BLOCK( /* 3300 - 33FF */ 0x0000000000000000LL, 0x0080000000000000LL);
const unicode_block B_HANGUL_BLOCK( /* AC00 - D7AF */ 0x0000000000000000LL, 0x0100000000000000LL);
const unicode_block B_HIGH_SURROGATES_BLOCK( /* D800 - DBFF */ 0x0000000000000000LL, 0x0200000000000000LL);
const unicode_block B_LOW_SURROGATES_BLOCK( /* DC00 - DFFF */ 0x0000000000000000LL, 0x0400000000000000LL);
const unicode_block B_CJK_UNIFIED_IDEOGRAPHS_BLOCK( /* 4E00 - 9FFF */ 0x0000000000000000LL, 0x0800000000000000LL);
const unicode_block B_PRIVATE_USE_AREA_BLOCK( /* E000 - F8FF */ 0x0000000000000000LL, 0x1000000000000000LL);
const unicode_block B_CJK_COMPATIBILITY_IDEOGRAPHS_BLOCK( /* F900 - FAFF */ 0x0000000000000000LL, 0x2000000000000000LL);
const unicode_block B_ALPHABETIC_PRESENTATION_FORMS_BLOCK( /* FB00 - FB4F */ 0x0000000000000000LL, 0x4000000000000000LL);
const unicode_block B_ARABIC_PRESENTATION_FORMS_A_BLOCK( /* FB50 - FDFF */ 0x0000000000000000LL, 0x8000000000000000LL);
const unicode_block B_COMBINING_HALF_MARKS_BLOCK( /* FE20 - FE2F */ 0x0000000000000001LL, 0x0000000000000000LL);
const unicode_block B_CJK_COMPATIBILITY_FORMS_BLOCK( /* FE30 - FE4F */ 0x0000000000000002LL, 0x0000000000000000LL);
const unicode_block B_SMALL_FORM_VARIANTS_BLOCK( /* FE50 - FE6F */ 0x0000000000000004LL, 0x0000000000000000LL);
const unicode_block B_ARABIC_PRESENTATION_FORMS_B_BLOCK( /* FE70 - FEFE */ 0x0000000000000008LL, 0x0000000000000000LL);
const unicode_block B_HALFWIDTH_AND_FULLWIDTH_FORMS_BLOCK( /* FF00 - FFEF */ 0x0000000000000010LL, 0x0000000000000000LL);
const unicode_block B_SPECIALS_BLOCK( /* FEFF and FFF0 - FFFF */ 0x0000000000000020LL, 0x0000000000000000LL);
const unicode_block B_TIBETAN_BLOCK( /* 0F00 - 0FBF */ 0x0000000000000040LL, 0x0000000000000000LL);
#endif // _UNICODEBLOCKOBJECTS_H
/*
* $Log $
*
* $Id $
*
*/
+668
View File
@@ -0,0 +1,668 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2005, Haiku
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: View.h
// Author: Erik Jaesler ([email protected])
// Description: BView is the base class for all views (clipped regions
// within a window).
//------------------------------------------------------------------------------
#ifndef _VIEW_H
#define _VIEW_H
#include <BeBuild.h>
#include <Font.h>
#include <Handler.h>
#include <InterfaceDefs.h>
#include <Rect.h>
// view definitions ------------------------------------------------------------
enum {
B_PRIMARY_MOUSE_BUTTON = 0x01,
B_SECONDARY_MOUSE_BUTTON = 0x02,
B_TERTIARY_MOUSE_BUTTON = 0x04
};
enum {
B_ENTERED_VIEW = 0,
B_INSIDE_VIEW,
B_EXITED_VIEW,
B_OUTSIDE_VIEW
};
enum {
B_POINTER_EVENTS = 0x00000001,
B_KEYBOARD_EVENTS = 0x00000002
};
enum {
B_LOCK_WINDOW_FOCUS = 0x00000001,
B_SUSPEND_VIEW_FOCUS = 0x00000002,
B_NO_POINTER_HISTORY = 0x00000004
};
enum {
B_TRACK_WHOLE_RECT,
B_TRACK_RECT_CORNER
};
enum {
B_FONT_FAMILY_AND_STYLE = 0x00000001,
B_FONT_SIZE = 0x00000002,
B_FONT_SHEAR = 0x00000004,
B_FONT_ROTATION = 0x00000008,
B_FONT_SPACING = 0x00000010,
B_FONT_ENCODING = 0x00000020,
B_FONT_FACE = 0x00000040,
B_FONT_FLAGS = 0x00000080,
B_FONT_ALL = 0x000000FF
};
const uint32 B_FULL_UPDATE_ON_RESIZE = 0x80000000UL; /* 31 */
const uint32 _B_RESERVED1_ = 0x40000000UL; /* 30 */
const uint32 B_WILL_DRAW = 0x20000000UL; /* 29 */
const uint32 B_PULSE_NEEDED = 0x10000000UL; /* 28 */
const uint32 B_NAVIGABLE_JUMP = 0x08000000UL; /* 27 */
const uint32 B_FRAME_EVENTS = 0x04000000UL; /* 26 */
const uint32 B_NAVIGABLE = 0x02000000UL; /* 25 */
const uint32 B_SUBPIXEL_PRECISE = 0x01000000UL; /* 24 */
const uint32 B_DRAW_ON_CHILDREN = 0x00800000UL; /* 23 */
const uint32 B_INPUT_METHOD_AWARE = 0x00400000UL; /* 23 */
const uint32 _B_RESERVED7_ = 0x00200000UL; /* 22 */
/*
#define _RESIZE_MASK_ ~(B_FULL_UPDATE_ON_RESIZE|_B_RESERVED1_|B_WILL_DRAW|\
B_PULSE_NEEDED|B_NAVIGABLE_JUMP|B_FRAME_EVENTS|B_NAVIGABLE|\
B_SUBPIXEL_PRECISE|B_DRAW_ON_CHILDREN|B_INPUT_METHOD_AWARE|_B_RESERVED7_)
*/
#define _RESIZE_MASK_ ~(B_FULL_UPDATE_ON_RESIZE|_B_RESERVED1_|B_WILL_DRAW|B_PULSE_NEEDED|B_NAVIGABLE_JUMP|B_FRAME_EVENTS|B_NAVIGABLE|B_SUBPIXEL_PRECISE|B_DRAW_ON_CHILDREN|B_INPUT_METHOD_AWARE|_B_RESERVED7_)
const uint32 _VIEW_TOP_ = 1UL;
const uint32 _VIEW_LEFT_ = 2UL;
const uint32 _VIEW_BOTTOM_ = 3UL;
const uint32 _VIEW_RIGHT_ = 4UL;
const uint32 _VIEW_CENTER_ = 5UL;
inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4)
{ return ((r1 << 12) | (r2 << 8) | (r3 << 4) | r4); }
#define B_FOLLOW_NONE 0
#define B_FOLLOW_ALL_SIDES _rule_(_VIEW_TOP_, _VIEW_LEFT_, _VIEW_BOTTOM_, _VIEW_RIGHT_)
#define B_FOLLOW_ALL B_FOLLOW_ALL_SIDES
#define B_FOLLOW_LEFT _rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_)
#define B_FOLLOW_RIGHT _rule_(0, _VIEW_RIGHT_, 0, _VIEW_RIGHT_)
#define B_FOLLOW_LEFT_RIGHT _rule_(0, _VIEW_LEFT_, 0, _VIEW_RIGHT_)
#define B_FOLLOW_H_CENTER _rule_(0, _VIEW_CENTER_, 0, _VIEW_CENTER_)
#define B_FOLLOW_TOP _rule_(_VIEW_TOP_, 0, _VIEW_TOP_, 0)
#define B_FOLLOW_BOTTOM _rule_(_VIEW_BOTTOM_, 0, _VIEW_BOTTOM_, 0)
#define B_FOLLOW_TOP_BOTTOM _rule_(_VIEW_TOP_, 0, _VIEW_BOTTOM_, 0)
#define B_FOLLOW_V_CENTER _rule_(_VIEW_CENTER_, 0, _VIEW_CENTER_, 0)
class BBitmap;
class BCursor;
class BMessage;
class BPicture;
class BPolygon;
class BRegion;
class BScrollBar;
class BScrollView;
class BShape;
class BShelf;
class BString;
class BWindow;
struct _array_data_;
struct _array_hdr_;
struct overlay_restrictions;
namespace BPrivate {
class ViewState;
};
class BView : public BHandler {
public:
BView(BRect frame, const char* name,
uint32 resizeMask, uint32 flags);
virtual ~BView();
BView(BMessage* data);
static BArchivable* Instantiate(BMessage* data);
virtual status_t Archive(BMessage* data, bool deep = true) const;
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void DetachedFromWindow();
virtual void AllDetached();
virtual void MessageReceived(BMessage* msg);
void AddChild(BView* child, BView* before = NULL);
bool RemoveChild(BView* child);
int32 CountChildren() const;
BView* ChildAt(int32 index) const;
BView* NextSibling() const;
BView* PreviousSibling() const;
bool RemoveSelf();
BWindow *Window() const;
virtual void Draw(BRect updateRect);
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where,
uint32 code,
const BMessage* a_message);
virtual void WindowActivated(bool state);
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void KeyUp(const char* bytes, int32 numBytes);
virtual void Pulse();
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float new_width, float new_height);
virtual void TargetedByScrollView(BScrollView* scroll_view);
void BeginRectTracking(BRect startRect,
uint32 style = B_TRACK_WHOLE_RECT);
void EndRectTracking();
void GetMouse(BPoint* location,
uint32* buttons,
bool checkMessageQueue = true);
void DragMessage(BMessage* aMessage,
BRect dragRect,
BHandler* reply_to = NULL);
void DragMessage(BMessage* aMessage,
BBitmap* anImage,
BPoint offset,
BHandler* reply_to = NULL);
void DragMessage(BMessage* aMessage,
BBitmap* anImage,
drawing_mode dragMode,
BPoint offset,
BHandler* reply_to = NULL);
BView* FindView(const char* name) const;
BView* Parent() const;
BRect Bounds() const;
BRect Frame() const;
void ConvertToScreen(BPoint* pt) const;
BPoint ConvertToScreen(BPoint pt) const;
void ConvertFromScreen(BPoint* pt) const;
BPoint ConvertFromScreen(BPoint pt) const;
void ConvertToScreen(BRect* r) const;
BRect ConvertToScreen(BRect r) const;
void ConvertFromScreen(BRect* r) const;
BRect ConvertFromScreen(BRect r) const;
void ConvertToParent(BPoint* pt) const;
BPoint ConvertToParent(BPoint pt) const;
void ConvertFromParent(BPoint* pt) const;
BPoint ConvertFromParent(BPoint pt) const;
void ConvertToParent(BRect* r) const;
BRect ConvertToParent(BRect r) const;
void ConvertFromParent(BRect* r) const;
BRect ConvertFromParent(BRect r) const;
BPoint LeftTop() const;
void GetClippingRegion(BRegion* region) const;
virtual void ConstrainClippingRegion(BRegion* region);
void ClipToPicture(BPicture* picture,
BPoint where = B_ORIGIN,
bool sync = true);
void ClipToInversePicture(BPicture* picture,
BPoint where = B_ORIGIN,
bool sync = true);
virtual void SetDrawingMode(drawing_mode mode);
drawing_mode DrawingMode() const;
void SetBlendingMode(source_alpha srcAlpha,
alpha_function alphaFunc);
void GetBlendingMode(source_alpha* srcAlpha,
alpha_function* alphaFunc) const;
virtual void SetPenSize(float size);
float PenSize() const;
void SetViewCursor(const BCursor* cursor, bool sync=true);
virtual void SetViewColor(rgb_color c);
void SetViewColor(uchar r, uchar g, uchar b, uchar a = 255);
rgb_color ViewColor() const;
void SetViewBitmap(const BBitmap* bitmap,
BRect srcRect, BRect dstRect,
uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT,
uint32 options = B_TILE_BITMAP);
void SetViewBitmap(const BBitmap* bitmap,
uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT,
uint32 options = B_TILE_BITMAP);
void ClearViewBitmap();
status_t SetViewOverlay(const BBitmap* overlay,
BRect srcRect, BRect dstRect,
rgb_color* colorKey,
uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT,
uint32 options = 0);
status_t SetViewOverlay(const BBitmap* overlay, rgb_color* colorKey,
uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT,
uint32 options = 0);
void ClearViewOverlay();
virtual void SetHighColor(rgb_color a_color);
void SetHighColor(uchar r, uchar g, uchar b, uchar a = 255);
rgb_color HighColor() const;
virtual void SetLowColor(rgb_color a_color);
void SetLowColor(uchar r, uchar g, uchar b, uchar a = 255);
rgb_color LowColor() const;
void SetLineMode(cap_mode lineCap,
join_mode lineJoin,
float miterLimit = B_DEFAULT_MITER_LIMIT);
join_mode LineJoinMode() const;
cap_mode LineCapMode() const;
float LineMiterLimit() const;
void SetOrigin(BPoint pt);
void SetOrigin(float x, float y);
BPoint Origin() const;
void PushState();
void PopState();
void MovePenTo(BPoint pt);
void MovePenTo(float x, float y);
void MovePenBy(float x, float y);
BPoint PenLocation() const;
void StrokeLine(BPoint toPt,
pattern p = B_SOLID_HIGH);
void StrokeLine(BPoint pt0,
BPoint pt1,
pattern p = B_SOLID_HIGH);
void BeginLineArray(int32 count);
void AddLine(BPoint pt0, BPoint pt1, rgb_color col);
void EndLineArray();
void StrokePolygon(const BPolygon* aPolygon,
bool closed = true,
pattern p = B_SOLID_HIGH);
void StrokePolygon(const BPoint* ptArray,
int32 numPts,
bool closed = true,
pattern p = B_SOLID_HIGH);
void StrokePolygon(const BPoint* ptArray,
int32 numPts,
BRect bounds,
bool closed = true,
pattern p = B_SOLID_HIGH);
void FillPolygon(const BPolygon* aPolygon,
pattern p = B_SOLID_HIGH);
void FillPolygon(const BPoint* ptArray,
int32 numPts,
pattern p = B_SOLID_HIGH);
void FillPolygon(const BPoint* ptArray,
int32 numPts,
BRect bounds,
pattern p = B_SOLID_HIGH);
void StrokeTriangle(BPoint pt1,
BPoint pt2,
BPoint pt3,
BRect bounds,
pattern p = B_SOLID_HIGH);
void StrokeTriangle(BPoint pt1,
BPoint pt2,
BPoint pt3,
pattern p = B_SOLID_HIGH);
void FillTriangle(BPoint pt1,
BPoint pt2,
BPoint pt3,
pattern p = B_SOLID_HIGH);
void FillTriangle(BPoint pt1,
BPoint pt2,
BPoint pt3,
BRect bounds,
pattern p = B_SOLID_HIGH);
void StrokeRect(BRect r, pattern p = B_SOLID_HIGH);
void FillRect(BRect r, pattern p = B_SOLID_HIGH);
void FillRegion(BRegion* a_region, pattern p= B_SOLID_HIGH);
void InvertRect(BRect r);
void StrokeRoundRect(BRect r,
float xRadius,
float yRadius,
pattern p = B_SOLID_HIGH);
void FillRoundRect(BRect r,
float xRadius,
float yRadius,
pattern p = B_SOLID_HIGH);
void StrokeEllipse(BPoint center,
float xRadius,
float yRadius,
pattern p = B_SOLID_HIGH);
void StrokeEllipse(BRect r, pattern p = B_SOLID_HIGH);
void FillEllipse(BPoint center,
float xRadius,
float yRadius,
pattern p = B_SOLID_HIGH);
void FillEllipse(BRect r, pattern p = B_SOLID_HIGH);
void StrokeArc(BPoint center,
float xRadius,
float yRadius,
float start_angle,
float arc_angle,
pattern p = B_SOLID_HIGH);
void StrokeArc(BRect r,
float start_angle,
float arc_angle,
pattern p = B_SOLID_HIGH);
void FillArc(BPoint center,
float xRadius,
float yRadius,
float start_angle,
float arc_angle,
pattern p = B_SOLID_HIGH);
void FillArc(BRect r,
float start_angle,
float arc_angle,
pattern p = B_SOLID_HIGH);
void StrokeBezier(BPoint* controlPoints,
pattern p = B_SOLID_HIGH);
void FillBezier(BPoint* controlPoints,
pattern p = B_SOLID_HIGH);
void StrokeShape(BShape* shape,
pattern p = B_SOLID_HIGH);
void FillShape(BShape* shape,
pattern p = B_SOLID_HIGH);
void CopyBits(BRect src, BRect dst);
void DrawBitmapAsync(const BBitmap* aBitmap,
BRect srcRect,
BRect dstRect);
void DrawBitmapAsync(const BBitmap* aBitmap);
void DrawBitmapAsync(const BBitmap* aBitmap, BPoint where);
void DrawBitmapAsync(const BBitmap* aBitmap, BRect dstRect);
void DrawBitmap(const BBitmap* aBitmap,
BRect srcRect,
BRect dstRect);
void DrawBitmap(const BBitmap* aBitmap);
void DrawBitmap(const BBitmap* aBitmap, BPoint where);
void DrawBitmap(const BBitmap* aBitmap, BRect dstRect);
void DrawChar(char aChar);
void DrawChar(char aChar, BPoint location);
void DrawString(const char* aString,
escapement_delta* delta = NULL);
void DrawString(const char* aString, BPoint location,
escapement_delta* delta = NULL);
void DrawString(const char* aString, int32 length,
escapement_delta* delta = NULL);
void DrawString(const char* aString,
int32 length,
BPoint location,
escapement_delta* delta = 0L);
virtual void SetFont(const BFont* font, uint32 mask = B_FONT_ALL);
#if !_PR3_COMPATIBLE_
void GetFont(BFont* font) const;
#else
void GetFont(BFont* font);
#endif
void TruncateString(BString* in_out,
uint32 mode,
float width) const;
float StringWidth(const char* string) const;
float StringWidth(const char* string, int32 length) const;
void GetStringWidths(char* stringArray[],
int32 lengthArray[],
int32 numStrings,
float widthArray[]) const;
void SetFontSize(float size);
void ForceFontAliasing(bool enable);
void GetFontHeight(font_height* height) const;
void Invalidate(BRect invalRect);
void Invalidate(const BRegion* invalRegion);
void Invalidate();
void SetDiskMode(char* filename, long offset);
void BeginPicture(BPicture* a_picture);
void AppendToPicture(BPicture* a_picture);
BPicture* EndPicture();
void DrawPicture(const BPicture* a_picture);
void DrawPicture(const BPicture* a_picture, BPoint where);
void DrawPicture(const char* filename, long offset, BPoint where);
void DrawPictureAsync(const BPicture* a_picture);
void DrawPictureAsync(const BPicture* a_picture, BPoint where);
void DrawPictureAsync(const char* filename, long offset,
BPoint where);
status_t SetEventMask(uint32 mask, uint32 options=0);
uint32 EventMask();
status_t SetMouseEventMask(uint32 mask, uint32 options=0);
virtual void SetFlags(uint32 flags);
uint32 Flags() const;
virtual void SetResizingMode(uint32 mode);
uint32 ResizingMode() const;
void MoveBy(float dh, float dv);
void MoveTo(BPoint where);
void MoveTo(float x, float y);
void ResizeBy(float dh, float dv);
void ResizeTo(float width, float height);
void ScrollBy(float dh, float dv);
void ScrollTo(float x, float y);
virtual void ScrollTo(BPoint where);
virtual void MakeFocus(bool focusState = true);
bool IsFocus() const;
virtual void Show();
virtual void Hide();
bool IsHidden() const;
bool IsHidden(const BView* looking_from) const;
void Flush() const;
void Sync() const;
virtual void GetPreferredSize(float* width, float* height);
virtual void ResizeToPreferred();
BScrollBar* ScrollBar(orientation posture) const;
virtual BHandler* ResolveSpecifier(BMessage* msg,
int32 index,
BMessage* specifier,
int32 form,
const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
bool IsPrinting() const;
void SetScale(float scale) const;
// Private or reserved ---------------------------------------------------------
virtual status_t Perform(perform_code d, void* arg);
virtual void DrawAfterChildren(BRect r);
// added by OBOS - DO NOT use this when programming BeOS R5!!!
float Scale() const;
private:
friend class BScrollBar;
friend class BWindow;
friend class BBitmap;
friend class BPrintJob;
friend class BShelf;
friend class BTabView;
virtual void _ReservedView2();
virtual void _ReservedView3();
virtual void _ReservedView4();
virtual void _ReservedView5();
virtual void _ReservedView6();
virtual void _ReservedView7();
virtual void _ReservedView8();
#if !_PR3_COMPATIBLE_
virtual void _ReservedView9();
virtual void _ReservedView10();
virtual void _ReservedView11();
virtual void _ReservedView12();
virtual void _ReservedView13();
virtual void _ReservedView14();
virtual void _ReservedView15();
virtual void _ReservedView16();
#endif
BView(const BView&);
BView& operator=(const BView&);
void InitData(BRect f, const char* name, uint32 rs, uint32 fl);
status_t ArchiveChildren(BMessage* data, bool deep) const;
status_t UnarchiveChildren(BMessage* data, BWindow* w = NULL);
status_t setViewImage(const BBitmap* bitmap,BRect srcRect, BRect dstRect,
uint32 followFlags, uint32 options);
void BeginPicture_pr(BPicture* a_picture, BRect r);
void SetPattern(pattern pat);
void DoBezier(int32 gr, BPoint* controlPoints, pattern p);
void DoShape(int32 gr, BShape* shape, pattern p);
void DoPictureClip(BPicture* picture, BPoint where, bool invert,
bool sync);
bool do_owner_check() const;
void _SetOwner(BWindow* newOwner);
void check_lock() const;
void check_lock_no_pick() const;
void movesize(uint32 code, int32 h, int32 v);
void handle_tick();
char *test_area(int32 length);
void removeCommArray();
_array_hdr_ *new_comm_array(int32 cnt);
void SetScroller(BScrollBar* sb);
void UnsetScroller(BScrollBar* sb);
void RealScrollTo(BPoint);
void fetch_font();
uchar font_encoding() const;
BShelf* shelf() const;
void set_shelf(BShelf* shelf);
void _Activate(bool state);
void _Pulse();
void _UpdateStateForRemove();
void _UpdatePattern(::pattern pattern);
void deleteView( BView* aView);
bool do_owner_check_no_pick() const;
bool attachView( BView *aView );
bool _AddChildToList(BView* child, BView* before = NULL);
bool _RemoveChildFromList(BView* child);
void callAttachHooks( BView *aView );
void callDetachHooks( BView *aView );
// Debugging methods
void PrintToStream();
void PrintTree();
int32 server_token;
uint32 fFlags;
BPoint fParentOffset;
BWindow* fOwner;
BView* fParent;
BView* fNextSibling;
BView* fPreviousSibling;
BView* fFirstChild;
int16 fShowLevel;
bool top_level_view; // used
bool fNoISInteraction;
BPicture* cpicture; // used
_array_data_* comm; // used
BScrollBar* fVerScroller; // used
BScrollBar* fHorScroller; // used
bool f_is_printing;
bool _unused_bool0; // was: attached;
bool _unused_bool1;
bool _unused_bool2;
BPrivate::ViewState* fPermanentState; // not used
BPrivate::ViewState* fState;
BRect fBounds;
BShelf* fShelf;
void* pr_state; // not used
uint32 fEventMask;
uint32 fEventOptions;
uint32 _reserved[4];
#if !_PR3_COMPATIBLE_
uint32 _more_reserved[3];
#endif
};
// inline definitions ----------------------------------------------------------
inline void
BView::ScrollTo(float x, float y)
{
ScrollTo(BPoint(x, y));
}
inline void
BView::SetViewColor(uchar r, uchar g, uchar b, uchar a)
{
rgb_color color;
color.red = r; color.green = g;
color.blue = b; color.alpha = a;
SetViewColor(color);
}
inline void
BView::SetHighColor(uchar r, uchar g, uchar b, uchar a)
{
rgb_color color;
color.red = r; color.green = g;
color.blue = b; color.alpha = a;
SetHighColor(color);
}
inline void
BView::SetLowColor(uchar r, uchar g, uchar b, uchar a)
{
rgb_color color;
color.red = r; color.green = g;
color.blue = b; color.alpha = a;
SetLowColor(color);
}
#endif // _VIEW_H
+429
View File
@@ -0,0 +1,429 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2005, Haiku
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Window.h
// Author: Adrian Oanca ([email protected])
// Description: BWindow is the base class for all windows (graphic areas
// displayed on-screen).
//------------------------------------------------------------------------------
#ifndef _WINDOW_H
#define _WINDOW_H
#include <BeBuild.h>
#include <InterfaceDefs.h>
#include <List.h>
#include <Looper.h>
#include <Rect.h>
#include <StorageDefs.h>
#include <View.h>
namespace BPrivate {
class PortLink;
};
// window definitions ----------------------------------------------------------
enum window_type {
B_UNTYPED_WINDOW = 0,
B_TITLED_WINDOW = 1,
B_MODAL_WINDOW = 3,
B_DOCUMENT_WINDOW = 11,
B_BORDERED_WINDOW = 20,
B_FLOATING_WINDOW = 21
};
//----------------------------------------------------------------
enum window_look {
B_BORDERED_WINDOW_LOOK = 20,
B_NO_BORDER_WINDOW_LOOK = 19,
B_TITLED_WINDOW_LOOK = 1,
B_DOCUMENT_WINDOW_LOOK = 11,
B_MODAL_WINDOW_LOOK = 3,
B_FLOATING_WINDOW_LOOK = 7
};
//----------------------------------------------------------------
enum window_feel {
B_NORMAL_WINDOW_FEEL = 0,
B_MODAL_SUBSET_WINDOW_FEEL = 2,
B_MODAL_APP_WINDOW_FEEL = 1,
B_MODAL_ALL_WINDOW_FEEL = 3,
B_FLOATING_SUBSET_WINDOW_FEEL = 5,
B_FLOATING_APP_WINDOW_FEEL = 4,
B_FLOATING_ALL_WINDOW_FEEL = 6
};
//----------------------------------------------------------------
enum window_alignment {
B_BYTE_ALIGNMENT = 0,
B_PIXEL_ALIGNMENT = 1
};
//----------------------------------------------------------------
enum {
B_NOT_MOVABLE = 0x00000001,
B_NOT_CLOSABLE = 0x00000020,
B_NOT_ZOOMABLE = 0x00000040,
B_NOT_MINIMIZABLE = 0x00004000,
B_NOT_RESIZABLE = 0x00000002,
B_NOT_H_RESIZABLE = 0x00000004,
B_NOT_V_RESIZABLE = 0x00000008,
B_AVOID_FRONT = 0x00000080,
B_AVOID_FOCUS = 0x00002000,
B_WILL_ACCEPT_FIRST_CLICK = 0x00000010,
B_OUTLINE_RESIZE = 0x00001000,
B_NO_WORKSPACE_ACTIVATION = 0x00000100,
B_NOT_ANCHORED_ON_ACTIVATE = 0x00020000,
B_ASYNCHRONOUS_CONTROLS = 0x00080000,
B_QUIT_ON_WINDOW_CLOSE = 0x00100000
};
#define B_CURRENT_WORKSPACE 0
#define B_ALL_WORKSPACES 0xffffffff
//----------------------------------------------------------------
class BButton;
class BMenuBar;
class BMenuItem;
class BMessage;
class BMessageRunner;
class BMessenger;
class BView;
struct message;
struct _cmd_key_;
class ViewAttr;
// BWindow class ---------------------------------------------------------------
class BWindow : public BLooper {
public:
BWindow(BRect frame, const char* title,
window_type type, uint32 flags,
uint32 workspace = B_CURRENT_WORKSPACE);
BWindow(BRect frame, const char* title,
window_look look, window_feel feel,
uint32 flags,
uint32 workspace = B_CURRENT_WORKSPACE);
virtual ~BWindow();
BWindow(BMessage* data);
static BArchivable *Instantiate(BMessage* data);
virtual status_t Archive(BMessage* data, bool deep = true) const;
virtual void Quit();
void Close() { Quit(); }
void AddChild(BView* child, BView* before = NULL);
bool RemoveChild(BView* child);
int32 CountChildren() const;
BView *ChildAt(int32 index) const;
virtual void DispatchMessage(BMessage* message, BHandler* handler);
virtual void MessageReceived(BMessage* message);
virtual void FrameMoved(BPoint new_position);
virtual void WorkspacesChanged(uint32 old_ws, uint32 new_ws);
virtual void WorkspaceActivated(int32 ws, bool state);
virtual void FrameResized(float new_width, float new_height);
virtual void Minimize(bool minimize);
virtual void Zoom(BPoint origin, float width, float height);
void Zoom();
void SetZoomLimits(float maxWidth, float maxHeight);
virtual void ScreenChanged(BRect screen_size, color_space depth);
void SetPulseRate(bigtime_t rate);
bigtime_t PulseRate() const;
void AddShortcut(uint32 key, uint32 modifiers,
BMessage *msg);
void AddShortcut(uint32 key, uint32 modifiers,
BMessage *msg, BHandler *target);
void RemoveShortcut(uint32 key, uint32 modifiers);
void SetDefaultButton(BButton* button);
BButton *DefaultButton() const;
virtual void MenusBeginning();
virtual void MenusEnded();
bool NeedsUpdate() const;
void UpdateIfNeeded();
BView *FindView(const char *viewName) const;
BView *FindView(BPoint) const;
BView *CurrentFocus() const;
void Activate(bool = true);
virtual void WindowActivated(bool state);
void ConvertToScreen(BPoint* pt) const;
BPoint ConvertToScreen(BPoint pt) const;
void ConvertFromScreen(BPoint* pt) const;
BPoint ConvertFromScreen(BPoint pt) const;
void ConvertToScreen(BRect* rect) const;
BRect ConvertToScreen(BRect rect) const;
void ConvertFromScreen(BRect* rect) const;
BRect ConvertFromScreen(BRect rect) const;
void MoveBy(float dx, float dy);
void MoveTo(BPoint);
void MoveTo(float x, float y);
void ResizeBy(float dx, float dy);
void ResizeTo(float width, float height);
virtual void Show();
virtual void Hide();
bool IsHidden() const;
bool IsMinimized() const;
void Flush() const;
void Sync() const;
status_t SendBehind(const BWindow* window);
void DisableUpdates();
void EnableUpdates();
void BeginViewTransaction(); // referred as OpenViewTransaction() in BeBook
void EndViewTransaction(); // referred as CommitViewTransaction() in BeBook
BRect Bounds() const;
BRect Frame() const;
const char *Title() const;
void SetTitle(const char* title);
bool IsFront() const;
bool IsActive() const;
void SetKeyMenuBar(BMenuBar* bar);
BMenuBar *KeyMenuBar() const;
void SetSizeLimits(float minWidth, float maxWidth,
float minHeight, float maxHeight);
void GetSizeLimits(float *minWidth, float *maxWidth,
float *minHeight, float *maxHeight);
uint32 Workspaces() const;
void SetWorkspaces(uint32);
BView *LastMouseMovedView() const;
virtual BHandler *ResolveSpecifier(BMessage* msg, int32 index,
BMessage* specifier, int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
status_t AddToSubset(BWindow* window);
status_t RemoveFromSubset(BWindow* window);
virtual status_t Perform(perform_code d, void* arg);
status_t SetType(window_type type);
window_type Type() const;
status_t SetLook(window_look look);
window_look Look() const;
status_t SetFeel(window_feel feel);
window_feel Feel() const;
status_t SetFlags(uint32);
uint32 Flags() const;
bool IsModal() const;
bool IsFloating() const;
status_t SetWindowAlignment(window_alignment mode, int32 h,
int32 hOffset = 0, int32 width = 0, int32 widthOffset = 0,
int32 v = 0, int32 vOffset = 0, int32 height = 0,
int32 heightOffset = 0);
status_t GetWindowAlignment(window_alignment* mode = NULL,
int32* h = NULL, int32* hOffset = NULL,
int32* width = NULL, int32* widthOffset = NULL,
int32* v = NULL, int32* vOffset = NULL,
int32* height = NULL, int32* heightOffset = NULL) const;
virtual bool QuitRequested();
virtual thread_id Run();
// Private or reserved ---------------------------------------------------------
private:
typedef BLooper inherited;
friend class BApplication;
friend class BBitmap;
friend class BScrollBar;
friend class BView;
friend class BMenuItem;
friend class BWindowScreen;
friend class BDirectWindow;
friend class BFilePanel;
friend class BHandler;
friend class _BEventMask;
friend void _set_menu_sem_(BWindow* w, sem_id sem);
friend status_t _safe_get_server_token_(const BLooper* , int32* );
virtual void _ReservedWindow1();
virtual void _ReservedWindow2();
virtual void _ReservedWindow3();
virtual void _ReservedWindow4();
virtual void _ReservedWindow5();
virtual void _ReservedWindow6();
virtual void _ReservedWindow7();
virtual void _ReservedWindow8();
BWindow();
BWindow(BWindow&);
BWindow &operator=(BWindow&);
BWindow(BRect frame, int32 bitmapToken);
void InitData(BRect frame, const char* title,
window_look look, window_feel feel,
uint32 flags, uint32 workspace,
int32 bitmapToken = -1);
status_t ArchiveChildren(BMessage* data, bool deep) const;
status_t UnarchiveChildren(BMessage* data);
void BitmapClose(); // to be implemented
virtual void task_looper(); // thread function - it's here where app_server messages are received
/* void start_drag( BMessage* msg,
int32 token,
BPoint offset,
BRect track_rect,
BHandler* reply_to);
void start_drag( BMessage* msg,
int32 token,
BPoint offset,
int32 bitmap_token,
drawing_mode dragMode,
BHandler* reply_to);
*/
void prepareView(BView* aView); // changed from view_builder(BView* a_view);
void attachView(BView* aView); // changed from attach_builder(BView* a_view);
void detachView(BView* aView); // changed from detach_builder(BView* a_view);
//int32 get_server_token() const;
BMessage *extract_drop(BMessage* an_event, BHandler* *target);
//void movesize(uint32 opcode, float h, float v);
//int32 MessagesWaiting();
void handle_activate(BMessage* an_event);
//void do_view_frame(BMessage* an_event);
//void do_value_change(BMessage* an_event, BHandler* handler);
//void do_mouse_down(BMessage* an_event, BView* target);
//void do_mouse_moved(BMessage* an_event, BView* target);
//void do_key_down(BMessage* an_event, BHandler* handler);
//void do_key_up(BMessage* an_event, BHandler* handler);
void do_menu_event(BMessage* an_event);
//void do_draw_views();
virtual BMessage *ConvertToMessage(void* raw, int32 code);
//_cmd_key_ *allocShortcut(uint32 key, uint32 modifiers);
//_cmd_key_ *FindShortcut(uint32 key, uint32 modifiers);
void AddShortcut(uint32 key, // !!! - and menu shortcuts to list when a menu is added
uint32 modifiers,
BMenuItem* item);
//void post_message(BMessage* message);
//void SetLocalTitle(const char* new_title);
//void enable_pulsing(bool enable);
BHandler *determine_target(BMessage* msg, BHandler* target, bool pref);
//void kb_navigate();
//void navigate_to_next(int32 direction, bool group = false);
//void set_focus(BView* focus, bool notify_input_server); // what does notify_input_server mean??? why???
bool InUpdate();
void DequeueAll();
//bool find_token_and_handler(BMessage* msg, int32* token, BHandler* *handler);
window_type composeType(window_look look, // changed from: compose_type(...)
window_feel feel) const;
void decomposeType(window_type type, // changed from: decompose_type(...)
window_look* look,
window_feel* feel) const;
void SetIsFilePanel(bool yes);
bool IsFilePanel() const;
void BuildTopView();
void setFocus(BView *focusView, bool notifyIputServer = false);
// message: B_MOUSE_UP, B_MOUSE_DOWN, B_MOUSE_MOVED
void sendMessageUsingEventMask(int32 message, BPoint where);
BView* sendMessageUsingEventMask2(BView* aView, int32 message, BPoint where);
int32 findShortcut(uint32 key, uint32 modifiers);
bool findHandler(BView* start, BHandler* handler);
BView* findView(BView* aView, const char* viewName) const;
BView* findView(BView* aView, BPoint point) const;
BView* findView(BView* aView, int32 token);
BView* findLastChild(BView *parent);
BView* _FindNextNavigable(BView *focus, uint32 flags);
BView* _FindPreviousNavigable(BView *focus, uint32 flags);
bool _HandleKeyDown(char key, uint32 modifiers);
void _KeyboardNavigation();
void handleActivation(bool active);
void drawAllViews(BView* view);
void DoUpdate(BView* view, BRect& area);
// Debug
void PrintToStream() const;
// 3 deprecated calls
//void AddFloater(BWindow* a_floating_window);
//void RemoveFloater(BWindow* a_floating_window);
//window_type WindowType() const;
private:
char *fTitle;
int32 server_token; // not yet used
bool fInTransaction;
bool fActive;
short fShowLevel;
uint32 fFlags;
uint32 _unused0[2];
BView *top_view;
BView *fFocus;
BView *fLastMouseMovedView;
uint32 _unused1;
BMenuBar *fKeyMenuBar;
BButton *fDefaultButton;
BList accelList;
int32 fTopViewToken;
bool fPulseEnabled;
bool fViewsNeedPulse; // not yet used
bool fIsFilePanel;
bool fMaskActivated;
bigtime_t fPulseRate;
bool fWaitingForMenu;
bool fMinimized;
sem_id fMenuSem;
float fMaxZoomHeight;
float fMaxZoomWidth;
float fMinHeight;
float fMinWidth;
float fMaxHeight;
float fMaxWidth;
BRect fFrame;
window_look fLook;
ViewAttr *fCurDrawViewState; // not yet used
window_feel fFeel;
int32 fLastViewToken;
BPrivate::PortLink *fLink;
BMessageRunner *fPulseRunner;
BRect fCurrentFrame; // not yet used
uint32 _reserved[2]; // was 8
#if !_PR3_COMPATIBLE_
uint32 _more_reserved[4];
#endif
};
#endif // _WINDOW_H