It is accomplished ...
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -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 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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 $
|
||||
*
|
||||
*/
|
||||
@@ -0,0 +1,119 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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);
|
||||
status_t Execute ();
|
||||
|
||||
float fCachedWidth;
|
||||
bool fDrawAsDefault;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _BUTTON_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
@@ -0,0 +1,111 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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();
|
||||
|
||||
BCheckBox &operator=(const BCheckBox &);
|
||||
|
||||
bool fOutlined;
|
||||
uint32 _reserved[2];
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _CHECK_BOX_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
@@ -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 $
|
||||
*
|
||||
*/
|
||||
@@ -0,0 +1,311 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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;
|
||||
|
||||
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;
|
||||
} 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 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,366 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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"
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
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 left;
|
||||
uint32 right;
|
||||
uint32 middle;
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
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_MENU_BACKGROUND_COLOR = 2,
|
||||
B_MENU_SELECTION_BACKGROUND_COLOR = 6,
|
||||
B_MENU_ITEM_TEXT_COLOR = 7,
|
||||
B_MENU_SELECTED_ITEM_TEXT_COLOR = 8,
|
||||
B_WINDOW_TAB_COLOR = 3,
|
||||
B_KEYBOARD_NAVIGATION_COLOR = 4,
|
||||
B_DESKTOP_COLOR = 5
|
||||
};
|
||||
|
||||
_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
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// File: ListItem.h
|
||||
//
|
||||
// Description: BListView represents a one-dimensional list view.
|
||||
//
|
||||
// Copyright 2001, Ulrich Wimboeck
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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 ;
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- BListItem class ------------------------------------------*/
|
||||
|
||||
/**
|
||||
* A BListItem represents a single item in a BListView (or
|
||||
* BOutlineListView). The BListItem object provides drawing
|
||||
* instructions that can draw the item (through DrawItem()), and
|
||||
* keeps track of the item's state. To use a BListItem, you must
|
||||
* add it to a BListView through BListView::AddItem()
|
||||
* (BOutlineListView provides additional item-adding functions).
|
||||
* The BListView object provides the drawing context for the
|
||||
* BListItem's DrawItem() function.
|
||||
*
|
||||
* BListItem is abstract; each subclass must implement DrawItem().
|
||||
* BStringItem—the only BListItem subclass provided by
|
||||
* Be—implements the function to draw the item as a line of text.
|
||||
*/
|
||||
|
||||
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 ;
|
||||
|
||||
BListItem(const BListItem&) ;
|
||||
|
||||
BListItem& operator=(const BListItem&) ;
|
||||
|
||||
float fWidth ;
|
||||
float fHeight ;
|
||||
uint32 fLevel ;
|
||||
bool fSelected ;
|
||||
bool fEnabled ;
|
||||
|
||||
bool fExpanded ;
|
||||
bool fHasSubItems ;
|
||||
bool fVisible ;
|
||||
} ;
|
||||
|
||||
// in the interface kit the BStringItem class is declared within ListItem.h
|
||||
#ifndef USE_OPENBEOS_NAMESPACE
|
||||
#include "StringItem.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LIST_ITEM_H */
|
||||
@@ -0,0 +1,213 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// File: ListView.h
|
||||
//
|
||||
// Description: BListView represents a one-dimensional list view.
|
||||
//
|
||||
// Copyright 2001, Ulrich Wimboeck
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _LIST_VIEW_H
|
||||
#define _LIST_VIEW_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <List.h>
|
||||
#include <ListItem.h>
|
||||
#include <Invoker.h>
|
||||
#include <View.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 ------------------------------------------*/
|
||||
|
||||
/**
|
||||
* A BListView displays a list of items the user can select and
|
||||
* invoke. Each item is a kind of BListItem object. The BListView
|
||||
* manages the layout of the list and the interaction with the user;
|
||||
* it leaves the display of each item to the BListItem objects.
|
||||
* A BListItem is not a view and draws only when called upon by
|
||||
* the BListView.
|
||||
*/
|
||||
|
||||
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 d, void* arg) ;
|
||||
|
||||
virtual void WindowActivated(bool state) ;
|
||||
virtual void MouseUp(BPoint pt) ;
|
||||
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage* msg) ;
|
||||
virtual void DetachedFromWindow() ;
|
||||
virtual bool InitiateDrag(BPoint pt, 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 ; // try to remove friend classes
|
||||
|
||||
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 ;
|
||||
} ;
|
||||
|
||||
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 */
|
||||
@@ -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 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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 */
|
||||
@@ -0,0 +1,115 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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 &);
|
||||
static BBitmap *sBitmaps[2][3];
|
||||
|
||||
bool fOutlined;
|
||||
uint32 _reserved[2];
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _RADIO_BUTTON_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
@@ -0,0 +1,223 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: Rect.h
|
||||
// Author: Frans van Nispen ([email protected])
|
||||
// Description: BRect represents a rectangular area.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _RECT_H
|
||||
#define _RECT_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
#include <math.h>
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <SupportDefs.h>
|
||||
#include <Point.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
|
||||
// BRect class -----------------------------------------------------------------
|
||||
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
|
||||
{
|
||||
if (left <= right && top <= bottom)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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 $
|
||||
*
|
||||
*/
|
||||
@@ -0,0 +1,55 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 ~MyStringItem() ;
|
||||
|
||||
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 d, void* arg);
|
||||
|
||||
private:
|
||||
|
||||
BStringItem(const BStringItem &) ;
|
||||
BStringItem& operator=(const BStringItem &) ;
|
||||
|
||||
char* fText;
|
||||
float fBaselineOffset ;
|
||||
} ;
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _STRING_ITEM_H */
|
||||
@@ -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 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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.h
|
||||
// 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 <InterfaceDefs.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&);
|
||||
|
||||
// this one is not defined, so I guess I am on my own here
|
||||
_BTextInput_* fText;
|
||||
|
||||
char* fUnusedCharP; //fLabel; // this is in BControl
|
||||
BMessage* fModificationMessage;
|
||||
alignment fLabelAlign;
|
||||
float fDivider;
|
||||
// uint16 fPrevWidth;
|
||||
// uint16 fPrevHeight;
|
||||
uint32 _reserved[4];
|
||||
#if !_PR3_COMPATIBLE_
|
||||
uint32 _more_reserved[4];
|
||||
#endif
|
||||
|
||||
// bool fClean;
|
||||
bool fSkipSetFlags; // will use this for SHIFT-TAB
|
||||
bool fUnusedBool1;
|
||||
bool fUnusedBool2;
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _TEXTCONTROL_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,667 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: 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
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <Font.h>
|
||||
#include <Handler.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Rect.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
|
||||
// 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_)
|
||||
|
||||
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 _view_attr_;
|
||||
struct _array_data_;
|
||||
struct _array_hdr_;
|
||||
struct overlay_restrictions;
|
||||
|
||||
// BView class -----------------------------------------------------------------
|
||||
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);
|
||||
|
||||
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 remove_from_list(BView* a_view);
|
||||
bool remove_self();
|
||||
bool do_owner_check() const;
|
||||
void set_owner(BWindow* the_owner);
|
||||
void do_activate(int32 state);
|
||||
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 remove_comm_array();
|
||||
_array_hdr_ *new_comm_array(int32 cnt);
|
||||
BView *RealParent() const;
|
||||
void SetScroller(BScrollBar* sb);
|
||||
void UnsetScroller(BScrollBar* sb);
|
||||
void RealScrollTo(BPoint);
|
||||
void init_cache();
|
||||
void set_cached_state();
|
||||
void update_cached_state();
|
||||
void set_font_state(const BFont* font, uint32 mask);
|
||||
void fetch_font();
|
||||
uchar font_encoding() const;
|
||||
BShelf* shelf() const;
|
||||
void set_shelf(BShelf* );
|
||||
|
||||
int32 server_token;
|
||||
uint32 f_type;
|
||||
float origin_h;
|
||||
float origin_v;
|
||||
BWindow* owner;
|
||||
BView* parent;
|
||||
BView* next_sibling;
|
||||
BView* prev_sibling;
|
||||
BView* first_child;
|
||||
|
||||
int16 fShowLevel;
|
||||
bool top_level_view;
|
||||
bool fNoISInteraction;
|
||||
BPicture* cpicture;
|
||||
_array_data_* comm;
|
||||
|
||||
BScrollBar* fVerScroller;
|
||||
BScrollBar* fHorScroller;
|
||||
bool f_is_printing;
|
||||
bool attached;
|
||||
bool _unused_bool1;
|
||||
bool _unused_bool2;
|
||||
_view_attr_* fPermanentState;
|
||||
_view_attr_* fState;
|
||||
BRect fCachedBounds;
|
||||
BShelf* fShelf;
|
||||
void* pr_state;
|
||||
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 a_color;
|
||||
a_color.red = r; a_color.green = g;
|
||||
a_color.blue = b; a_color.alpha = a;
|
||||
SetViewColor(a_color);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
inline void BView::SetHighColor(uchar r, uchar g, uchar b, uchar a)
|
||||
{
|
||||
rgb_color a_color;
|
||||
a_color.red = r; a_color.green = g;
|
||||
a_color.blue = b; a_color.alpha = a;
|
||||
SetHighColor(a_color);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
inline void BView::SetLowColor(uchar r, uchar g, uchar b, uchar a)
|
||||
{
|
||||
rgb_color a_color;
|
||||
a_color.red = r; a_color.green = g;
|
||||
a_color.blue = b; a_color.alpha = a;
|
||||
SetLowColor(a_color);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _VIEW_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,456 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: Window.h
|
||||
// Author: Erik Jaesler ([email protected])
|
||||
// Description: BWindow is the base class for all windows (graphic areas
|
||||
// displayed on-screen).
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _WINDOW_H
|
||||
#define _WINDOW_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <List.h>
|
||||
#include <Looper.h>
|
||||
#include <Rect.h>
|
||||
#include <StorageDefs.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
|
||||
// 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 _BSession_;
|
||||
class BButton;
|
||||
class BMenuBar;
|
||||
class BMenuItem;
|
||||
class BMessage;
|
||||
class BMessageRunner;
|
||||
class BMessenger;
|
||||
class BView;
|
||||
|
||||
struct message;
|
||||
struct _cmd_key_;
|
||||
struct _view_attr_;
|
||||
|
||||
// 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(); // Synonym of 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 rec_position,
|
||||
float rec_width,
|
||||
float rec_height);
|
||||
void Zoom();
|
||||
void SetZoomLimits(float max_h, float max_v);
|
||||
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* view_name) 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();
|
||||
void EndViewTransaction();
|
||||
|
||||
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 min_h,
|
||||
float max_h,
|
||||
float min_v,
|
||||
float max_v);
|
||||
void GetSizeLimits( float* min_h,
|
||||
float* max_h,
|
||||
float* min_v,
|
||||
float* max_v);
|
||||
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 _CEventPort_;
|
||||
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, color_space depth,
|
||||
uint32 bitmapFlags, int32 rowBytes);
|
||||
void InitData(BRect frame,
|
||||
const char* title,
|
||||
window_look look,
|
||||
window_feel feel,
|
||||
uint32 flags,
|
||||
uint32 workspace);
|
||||
status_t ArchiveChildren(BMessage* data, bool deep) const;
|
||||
status_t UnarchiveChildren(BMessage* data);
|
||||
void BitmapClose();
|
||||
virtual void task_looper();
|
||||
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 view_builder(BView* a_view);
|
||||
void attach_builder(BView* a_view);
|
||||
void 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);
|
||||
|
||||
BMessage* ReadMessageFromPort(bigtime_t tout = B_INFINITE_TIMEOUT);
|
||||
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,
|
||||
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);
|
||||
bool InUpdate();
|
||||
void DequeueAll();
|
||||
bool find_token_and_handler(BMessage* msg,
|
||||
int32* token,
|
||||
BHandler* *handler);
|
||||
window_type compose_type(window_look look,
|
||||
window_feel feel) const;
|
||||
void decompose_type(window_type type,
|
||||
window_look* look,
|
||||
window_feel* feel) const;
|
||||
|
||||
void SetIsFilePanel(bool panel);
|
||||
bool IsFilePanel() const;
|
||||
|
||||
// 3 deprecated calls
|
||||
void AddFloater(BWindow* a_floating_window);
|
||||
void RemoveFloater(BWindow* a_floating_window);
|
||||
window_type WindowType() const;
|
||||
|
||||
char *fTitle;
|
||||
int32 server_token;
|
||||
char fInUpdate;
|
||||
char f_active;
|
||||
short fShowLevel;
|
||||
uint32 fFlags;
|
||||
|
||||
port_id send_port;
|
||||
port_id receive_port;
|
||||
|
||||
BView *top_view;
|
||||
BView *fFocus;
|
||||
BView *fLastMouseMovedView;
|
||||
_BSession_ *a_session;
|
||||
BMenuBar *fKeyMenuBar;
|
||||
BButton *fDefaultButton;
|
||||
BList accelList;
|
||||
int32 top_view_token;
|
||||
bool pulse_enabled;
|
||||
bool fViewsNeedPulse;
|
||||
bool fIsFilePanel;
|
||||
bool fUnused1;
|
||||
bigtime_t pulse_rate;
|
||||
bool fWaitingForMenu;
|
||||
bool fOffscreen;
|
||||
sem_id fMenuSem;
|
||||
float fMaxZoomH;
|
||||
float fMaxZoomV;
|
||||
float fMinWindH;
|
||||
float fMinWindV;
|
||||
float fMaxWindH;
|
||||
float fMaxWindV;
|
||||
BRect fFrame;
|
||||
window_look fLook;
|
||||
_view_attr_ *fCurDrawViewState;
|
||||
window_feel fFeel;
|
||||
int32 fLastViewToken;
|
||||
_CEventPort_* fEventPort;
|
||||
BMessageRunner *fPulseRunner;
|
||||
BRect fCurrentFrame;
|
||||
|
||||
uint32 _reserved[2]; // was 8
|
||||
#if !_PR3_COMPATIBLE_
|
||||
uint32 _more_reserved[4];
|
||||
#endif
|
||||
};
|
||||
|
||||
// inline definitions ----------------------------------------------------------
|
||||
inline void BWindow::Close()
|
||||
{
|
||||
Quit();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _WINDOW_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user