Finished unifying the Interface Kit headers:

* Fixed copyrights (puncuation and capitalization, removed authors from
  headers)
* Updated indentation style
* Unified pointer/reference style
* Re-ordered some methods for better grouping where it could be done
  (abd adopted source accordingly)
* Small coding style fixes here and there

No functional change intended.

+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32745 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-08-27 11:12:41 +00:00
parent 8bca36b1cd
commit 89208c77f1
77 changed files with 2373 additions and 2203 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _ABSTRACT_LAYOUT_ITEM_H

View File

@ -1,9 +1,6 @@
/*
* Copyright 2001-2006, Haiku.
* Copyright 2001-2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Erik Jaesler (erik@cgsoftware.com)
*/
#ifndef _ALERT_H
#define _ALERT_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _ALIGNMENT_H

View File

@ -1,9 +1,6 @@
/*
* Copyright 2001-2007, Haiku.
* Copyright 2001-2007, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold (bonefish@users.sf.net)
*/
#ifndef _BITMAP_H
#define _BITMAP_H

View File

@ -1,10 +1,6 @@
/*
* Copyright 2001-2009 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Authors:
* Marc Flerackers <mflerackers@androme.be>
* Stephan Aßmus <superstippi@gmx.de>
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _BUTTON_H
#define _BUTTON_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CARD_LAYOUT_H

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2008-2009 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2008-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CHANNEL_CONTROL_H
#define _CHANNEL_CONTROL_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CHANNEL_SLIDER_H
#define _CHANNEL_SLIDER_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2001-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CHECK_BOX_H
#define _CHECK_BOX_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Distributed under the terms of the MIT License.
*/
#ifndef _CONTROL_H
#define _CONTROL_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2009, Stephan Aßmus <superstippi@gmx.de>
* Copyright 2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CONTROL_LOOK_H
@ -16,6 +16,10 @@ class BGradientLinear;
class BView;
// WARNING! This is experimental API and may change! Be prepared to
// recompile your software in a next version of haiku.
namespace BPrivate {

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT license.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _DESKBAR_H
#define _DESKBAR_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT license.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _DRAGGER_H
#define _DRAGGER_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2005-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT license.
* Copyright 2005-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _FONT_H_
#define _FONT_H_

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRADIENT_H
#define _GRADIENT_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRADIENT_CONIC_H
#define _GRADIENT_CONIC_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRADIENT_DIAMOND_H
#define _GRADIENT_DIAMOND_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRADIENT_LINEAR_H
#define _GRADIENT_LINEAR_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRADIENT_RADIAL_H
#define _GRADIENT_RADIAL_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRADIENT_RADIAL_FOCUS_H
#define _GRADIENT_RADIAL_FOCUS_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008, Haiku Inc. All Rights Reserved.
* Copyright 2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRAPHICS_DEFS_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRID_LAYOUT_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRID_LAYOUT_BUILDER_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRID_VIEW_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GROUP_LAYOUT_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GROUP_LAYOUT_BUILDER_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GROUP_VIEW_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2008, Haiku, Inc.
* Distributed under the terms of the MIT license.
* Copyright 2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
*/
#ifndef _INPUT_H

View File

@ -1,9 +1,6 @@
/*
* Copyright (c) 2001-2008, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
* Erik Jaesler (erik@cgsoftware.com)
* Copyright 2001-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _INTERFACE_DEFS_H
#define _INTERFACE_DEFS_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _LAYOUT_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2009, Haiku Inc.
* Copyright 2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _LAYOUT_BUILDER_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _LAYOUT_CONTEXT_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _LAYOUT_ITEM_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _LAYOUT_UTILS_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Distributed under the terms of the MIT License.
*/
#ifndef _LIST_ITEM_H
#define _LIST_ITEM_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2002-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Distributed under the terms of the MIT License.
*/
#ifndef _LIST_VIEW_H
#define _LIST_VIEW_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2007-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2007-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MENU_H
#define _MENU_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2003-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2003-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MENU_BAR_H
#define _MENU_BAR_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MENU_FIELD_H
#define _MENU_FIELD_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2007, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MENU_ITEM_H
@ -16,92 +16,96 @@ class BWindow;
class BMenuItem : public BArchivable, public BInvoker {
public:
BMenuItem(const char* label, BMessage* message,
char shortcut = 0, uint32 modifiers = 0);
BMenuItem(BMenu* menu, BMessage* message = NULL);
BMenuItem(BMessage* data);
virtual ~BMenuItem();
public:
BMenuItem(const char* label, BMessage* message,
char shortcut = 0, uint32 modifiers = 0);
BMenuItem(BMenu* menu,
BMessage* message = NULL);
BMenuItem(BMessage* data);
virtual ~BMenuItem();
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void SetLabel(const char* name);
virtual void SetEnabled(bool enabled);
virtual void SetMarked(bool marked);
virtual void SetTrigger(char trigger);
virtual void SetShortcut(char shortcut, uint32 modifiers);
virtual void SetLabel(const char* name);
virtual void SetEnabled(bool enabled);
virtual void SetMarked(bool marked);
virtual void SetTrigger(char trigger);
virtual void SetShortcut(char shortcut, uint32 modifiers);
const char* Label() const;
bool IsEnabled() const;
bool IsMarked() const;
char Trigger() const;
char Shortcut(uint32* _modifiers = NULL) const;
const char* Label() const;
bool IsEnabled() const;
bool IsMarked() const;
char Trigger() const;
char Shortcut(uint32* _modifiers = NULL) const;
BMenu* Submenu() const;
BMenu* Menu() const;
BRect Frame() const;
BMenu* Submenu() const;
BMenu* Menu() const;
BRect Frame() const;
protected:
virtual void GetContentSize(float* _width, float* _height);
virtual void TruncateLabel(float maxWidth, char* newLabel);
virtual void DrawContent();
virtual void Draw();
virtual void Highlight(bool enabled);
bool IsSelected() const;
BPoint ContentLocation() const;
protected:
virtual void GetContentSize(float* _width, float* _height);
virtual void TruncateLabel(float maxWidth, char* newLabel);
virtual void DrawContent();
virtual void Draw();
virtual void Highlight(bool enabled);
bool IsSelected() const;
BPoint ContentLocation() const;
private:
friend class BMenu;
friend class BPopUpMenu;
friend class BMenuBar;
private:
friend class BMenu;
friend class BPopUpMenu;
friend class BMenuBar;
virtual void _ReservedMenuItem1();
virtual void _ReservedMenuItem2();
virtual void _ReservedMenuItem3();
virtual void _ReservedMenuItem4();
virtual void _ReservedMenuItem1();
virtual void _ReservedMenuItem2();
virtual void _ReservedMenuItem3();
virtual void _ReservedMenuItem4();
void Install(BWindow* window);
void Uninstall();
void SetSuper(BMenu* superMenu);
void Select(bool select);
void SetAutomaticTrigger(int32 index, uint32 trigger);
void Install(BWindow* window);
void Uninstall();
void SetSuper(BMenu* superMenu);
void Select(bool select);
void SetAutomaticTrigger(int32 index,
uint32 trigger);
protected:
virtual status_t Invoke(BMessage *msg = NULL);
protected:
virtual status_t Invoke(BMessage* message = NULL);
private:
BMenuItem(const BMenuItem& other);
BMenuItem& operator=(const BMenuItem& other);
private:
BMenuItem(const BMenuItem& other);
BMenuItem& operator=(const BMenuItem& other);
void _InitData();
void _InitMenuData(BMenu* menu);
void _InitData();
void _InitMenuData(BMenu* menu);
void _DrawMarkSymbol(rgb_color backgroundColor);
void _DrawShortcutSymbol();
void _DrawSubmenuSymbol(rgb_color backgroundColor);
void _DrawControlChar(char shortcut, BPoint where);
void _DrawMarkSymbol(rgb_color backgroundColor);
void _DrawShortcutSymbol();
void _DrawSubmenuSymbol(rgb_color backgroundColor);
void _DrawControlChar(char shortcut, BPoint where);
char* fLabel;
BMenu* fSubmenu;
BWindow* fWindow;
BMenu* fSuper;
BRect fBounds;
uint32 fModifiers;
float fCachedWidth;
int16 fTriggerIndex;
char fUserTrigger;
char fShortcutChar;
bool fMark;
bool fEnabled;
bool fSelected;
uint32 fTrigger;
private:
char* fLabel;
BMenu* fSubmenu;
BWindow* fWindow;
BMenu* fSuper;
BRect fBounds;
uint32 fModifiers;
float fCachedWidth;
int16 fTriggerIndex;
char fUserTrigger;
char fShortcutChar;
bool fMark;
bool fEnabled;
bool fSelected;
uint32 fTrigger;
uint32 _reserved[3];
uint32 _reserved[3];
};
// BSeparatorItem now has its own declaration file, but for source
// compatibility we're exporting that class from here too.
#include <SeparatorItem.h>
#endif /* _MENU_ITEM_H */
#endif // _MENU_ITEM_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MULTI_CHANNEL_CONTROL_H
#define _MULTI_CHANNEL_CONTROL_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2001-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _OPTION_CONTROL_H
#define _OPTION_CONTROL_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2001-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _OPTION_POP_UP_H
#define _OPTION_POP_UP_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2006-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _OUTLINE_LIST_VIEW_H
#define _OUTLINE_LIST_VIEW_H

View File

@ -1,12 +1,11 @@
/*
* Copyright 2001-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _PICTURE_H
#define _PICTURE_H
#include <BeBuild.h>
#include <InterfaceDefs.h>
#include <Rect.h>
#include <Archivable.h>

View File

@ -1,6 +1,6 @@
/*
* Copyright 2001-2008, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2001-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _PICTURE_BUTTON_H
#define _PICTURE_BUTTON_H

View File

@ -1,87 +1,88 @@
/*
* Copyright 2001-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Frans van Nispen
*/
#ifndef _POINT_H
#define _POINT_H
#include <BeBuild.h>
#include <SupportDefs.h>
class BRect;
class BPoint {
public:
float x;
float y;
float x;
float y;
BPoint();
BPoint(float X, float Y);
BPoint(const BPoint &p);
BPoint();
BPoint(float x, float y);
BPoint(const BPoint& p);
BPoint &operator=(const BPoint &p);
void Set(float X, float Y);
BPoint& operator=(const BPoint& other);
void Set(float x, float y);
void ConstrainTo(BRect r);
void PrintToStream() const;
void ConstrainTo(BRect rect);
void PrintToStream() const;
BPoint operator-() const;
BPoint operator+(const BPoint &p) const;
BPoint operator-(const BPoint &p) const;
BPoint& operator+=(const BPoint &p);
BPoint& operator-=(const BPoint &p);
BPoint operator-() const;
BPoint operator+(const BPoint& other) const;
BPoint operator-(const BPoint& other) const;
BPoint& operator+=(const BPoint& other);
BPoint& operator-=(const BPoint& other);
bool operator!=(const BPoint &p) const;
bool operator==(const BPoint &p) const;
bool operator!=(const BPoint& other) const;
bool operator==(const BPoint& other) const;
};
extern const BPoint B_ORIGIN;
// returns (0,0)
// returns (0, 0)
inline
BPoint::BPoint()
:
x(0.0f),
y(0.0f)
{
x = y = 0;
}
inline
BPoint::BPoint(float X, float Y)
BPoint::BPoint(float x, float y)
:
x(x),
y(y)
{
x = X;
y = Y;
}
inline
BPoint::BPoint(const BPoint& pt)
BPoint::BPoint(const BPoint& other)
:
x(other.x),
y(other.y)
{
x = pt.x;
y = pt.y;
}
inline BPoint &
BPoint::operator=(const BPoint& from)
inline BPoint&
BPoint::operator=(const BPoint& other)
{
x = from.x;
y = from.y;
x = other.x;
y = other.y;
return *this;
}
inline void
BPoint::Set(float X, float Y)
BPoint::Set(float x, float y)
{
x = X;
y = Y;
this->x = x;
this->y = y;
}
#endif // _POINT_H
#endif // _POINT_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2001-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _POLYGON_H
#define _POLYGON_H

View File

@ -1,15 +1,11 @@
/*
* Copyright 2001-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Frans van Nispen
*/
#ifndef _RECT_H
#define _RECT_H
#include <SupportDefs.h>
#include <Point.h>
#include <Size.h>
@ -17,77 +13,79 @@
class BRect {
public:
float left;
float top;
float right;
float bottom;
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(BPoint leftTop, BSize size);
BRect();
BRect(const BRect& other);
BRect(float left, float top, float right,
float bottom);
BRect(BPoint leftTop, BPoint rightBottom);
BRect(BPoint leftTop, BSize size);
BRect &operator=(const BRect &r);
void Set(float l, float t, float r, float b);
BRect& operator=(const BRect& other);
void Set(float left, float top, float right,
float bottom);
void PrintToStream() const;
void PrintToStream() const;
BPoint LeftTop() const;
BPoint RightBottom() const;
BPoint LeftBottom() const;
BPoint RightTop() 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);
void SetLeftTop(const BPoint leftTop);
void SetRightBottom(const BPoint rightBottom);
void SetLeftBottom(const BPoint leftBottom);
void SetRightTop(const BPoint rightTop);
// 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);
// Transformation
void InsetBy(BPoint inset);
void InsetBy(float dx, float dy);
void OffsetBy(BPoint delta);
void OffsetBy(float dx, float dy);
void OffsetTo(BPoint offset);
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);
// Expression transformations
BRect& InsetBySelf(BPoint inset);
BRect& InsetBySelf(float dx, float dy);
BRect InsetByCopy(BPoint inset);
BRect InsetByCopy(float dx, float dy);
BRect& OffsetBySelf(BPoint offset);
BRect& OffsetBySelf(float dx, float dy);
BRect OffsetByCopy(BPoint offset);
BRect OffsetByCopy(float dx, float dy);
BRect& OffsetToSelf(BPoint offset);
BRect& OffsetToSelf(float dx, float dy);
BRect OffsetToCopy(BPoint offset);
BRect OffsetToCopy(float dx, float dy);
// comparison
bool operator==(BRect r) const;
bool operator!=(BRect r) const;
// Comparison
bool operator==(BRect r) const;
bool operator!=(BRect r) const;
// intersection and union
BRect operator&(BRect r) const;
BRect operator|(BRect r) const;
// Intersection and union
BRect operator&(BRect r) const;
BRect operator|(BRect r) const;
bool IsValid() const;
float Width() const;
int32 IntegerWidth() const;
float Height() const;
int32 IntegerHeight() const;
BSize Size() const;
bool IsValid() const;
float Width() const;
int32 IntegerWidth() const;
float Height() const;
int32 IntegerHeight() const;
BSize Size() const;
bool Intersects(BRect r) const;
bool Contains(BPoint p) const;
bool Contains(BRect r) const;
bool Intersects(BRect r) const;
bool Contains(BPoint p) const;
bool Contains(BRect r) const;
};
// inline definitions ----------------------------------------------------------
// #pragma mark - inline definitions
inline BPoint
BRect::LeftTop() const
@ -136,7 +134,7 @@ BRect::BRect(float l, float t, float r, float b)
inline
BRect::BRect(const BRect &r)
BRect::BRect(const BRect& r)
{
left = r.left;
top = r.top;
@ -165,7 +163,7 @@ BRect::BRect(BPoint leftTop, BSize size)
}
inline BRect &
inline BRect&
BRect::operator=(const BRect& from)
{
left = from.left;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2007, Haiku. All rights reserved.
* Copyright 2007, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2007, Haiku, Inc. All Rights Reserved.
* Copyright 2007-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SCREEN_H
@ -19,71 +19,83 @@ namespace BPrivate {
class BPrivateScreen;
}
class BScreen {
public:
BScreen(screen_id id = B_MAIN_SCREEN_ID);
BScreen(BWindow* window);
~BScreen();
public:
BScreen(screen_id id = B_MAIN_SCREEN_ID);
BScreen(BWindow* window);
~BScreen();
bool IsValid();
status_t SetToNext();
bool IsValid();
status_t SetToNext();
color_space ColorSpace();
BRect Frame();
screen_id ID();
color_space ColorSpace();
BRect Frame();
screen_id ID();
status_t WaitForRetrace();
status_t WaitForRetrace(bigtime_t timeout);
status_t WaitForRetrace();
status_t WaitForRetrace(bigtime_t timeout);
uint8 IndexForColor(rgb_color color);
uint8 IndexForColor(uint8 red, uint8 green, uint8 blue,
uint8 alpha = 255);
rgb_color ColorForIndex(uint8 index);
uint8 InvertIndex(uint8 index);
uint8 IndexForColor(rgb_color color);
uint8 IndexForColor(uint8 red, uint8 green,
uint8 blue, uint8 alpha = 255);
rgb_color ColorForIndex(uint8 index);
uint8 InvertIndex(uint8 index);
const color_map* ColorMap();
const color_map* ColorMap();
status_t GetBitmap(BBitmap** _bitmap, bool drawCursor = true,
BRect* frame = NULL);
status_t ReadBitmap(BBitmap* bitmap, bool drawCursor = true,
BRect* frame = NULL);
status_t GetBitmap(BBitmap** _bitmap,
bool drawCursor = true,
BRect* frame = NULL);
status_t ReadBitmap(BBitmap* bitmap,
bool drawCursor = true,
BRect* frame = NULL);
rgb_color DesktopColor();
rgb_color DesktopColor(uint32 index);
void SetDesktopColor(rgb_color color, bool makeDefault = true);
void SetDesktopColor(rgb_color color, uint32 index,
bool makeDefault = true);
rgb_color DesktopColor();
rgb_color DesktopColor(uint32 index);
void SetDesktopColor(rgb_color color,
bool makeDefault = true);
void SetDesktopColor(rgb_color color,
uint32 index, bool makeDefault = true);
status_t ProposeMode(display_mode* target, const display_mode* low,
const display_mode* high);
status_t GetModeList(display_mode** _modeList, uint32* _count);
status_t GetMode(display_mode* mode);
status_t GetMode(uint32 workspace, display_mode* mode);
status_t SetMode(display_mode* mode, bool makeDefault = false);
status_t SetMode(uint32 workspace, display_mode* mode,
bool makeDefault = false);
status_t GetDeviceInfo(accelerant_device_info* info);
status_t GetMonitorInfo(monitor_info* info);
status_t GetPixelClockLimits(display_mode* mode, uint32* low,
uint32* high);
status_t GetTimingConstraints(
display_timing_constraints* timingConstraints);
status_t SetDPMS(uint32 state);
uint32 DPMSState();
uint32 DPMSCapabilites();
status_t ProposeMode(display_mode* target,
const display_mode* low,
const display_mode* high);
status_t GetModeList(display_mode** _modeList,
uint32* _count);
status_t GetMode(display_mode* _mode);
status_t GetMode(uint32 workspace,
display_mode* _mode);
status_t SetMode(display_mode* mode,
bool makeDefault = false);
status_t SetMode(uint32 workspace,
display_mode* mode,
bool makeDefault = false);
status_t GetDeviceInfo(accelerant_device_info* info);
status_t GetMonitorInfo(monitor_info* info);
status_t GetPixelClockLimits(display_mode* mode,
uint32* low, uint32* high);
status_t GetTimingConstraints(
display_timing_constraints*
timingConstraints);
status_t SetDPMS(uint32 state);
uint32 DPMSState();
uint32 DPMSCapabilites();
private:
BScreen& operator=(const BScreen& other);
BScreen(const BScreen& other);
private:
// Forbidden and deprecated methods
BScreen(const BScreen& other);
BScreen& operator=(const BScreen& other);
// old and deprecated methods - should be faded out
BPrivate::BPrivateScreen* private_screen();
status_t ProposeDisplayMode(display_mode* target,
const display_mode* low, const display_mode* high);
void* BaseAddress();
uint32 BytesPerRow();
BPrivate::BPrivateScreen* private_screen();
status_t ProposeDisplayMode(display_mode* target,
const display_mode* low,
const display_mode* high);
void* BaseAddress();
uint32 BytesPerRow();
BPrivate::BPrivateScreen* fScreen;
private:
BPrivate::BPrivateScreen* fScreen;
};
@ -93,4 +105,4 @@ BScreen::IndexForColor(rgb_color color)
return IndexForColor(color.red, color.green, color.blue, color.alpha);
}
#endif // _SCREEN_H
#endif // _SCREEN_H

View File

@ -1,12 +1,6 @@
/*
* Copyright (c) 2001-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Authors:
* Marc Flerackers (mflerackers@androme.be)
* DarkWyrm (bpmagic@columbus.rr.com)
* Stefano Ceccherini (burton666@libero.it)
* Stephan Aßmus <superstippi@gmx.de>
* Copyright 2001-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SCROLL_BAR_H
#define _SCROLL_BAR_H
@ -32,11 +26,13 @@ public:
BView* target, float min, float max,
orientation direction);
BScrollBar(const char* name, BView* target,
float min, float max, orientation direction);
BScrollBar(BMessage* data);
float min, float max,
enum orientation orientation);
BScrollBar(BMessage* archive);
virtual ~BScrollBar();
static BArchivable* Instantiate(BMessage* data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void AttachedToWindow();
void SetValue(float value);
@ -56,7 +52,7 @@ public:
void SetOrientation(enum orientation orientation);
orientation Orientation() const;
// TODO: make this a virtual method, it should be one,
// TODO: Make this a virtual method, it should be one,
// but it's not important right now. This is supposed
// to be used in case the BScrollBar should draw part of
// the focus indication of the target view for aesthetical
@ -78,7 +74,8 @@ public:
int32 form, const char* property);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float* _width, float* _height);
virtual void GetPreferredSize(float* _width,
float* _height);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
@ -128,6 +125,7 @@ private:
BSize _MinSize() const;
private:
float fMin;
float fMax;
float fSmallStep;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2004-2009, Haiku Inc. All Rights Reserved.
* Copyright 2004-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*/
#ifndef _SCROLL_VIEW_H
@ -14,104 +14,109 @@
*/
class BScrollView : public BView {
public:
BScrollView(const char* name, BView* target,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = 0, bool horizontal = false,
bool vertical = false,
border_style border = B_FANCY_BORDER);
BScrollView(const char* name, BView* target,
uint32 flags, bool horizontal, bool vertical,
border_style border = B_FANCY_BORDER);
BScrollView(BMessage* archive);
virtual ~BScrollView();
BScrollView(const char* name, BView* target,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = 0, bool horizontal = false,
bool vertical = false,
border_style border = B_FANCY_BORDER);
BScrollView(const char* name, BView* target,
uint32 flags, bool horizontal,
bool vertical, border_style border
= B_FANCY_BORDER);
BScrollView(BMessage* archive);
virtual ~BScrollView();
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive, bool deep = true) const;
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 AttachedToWindow();
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
BScrollBar* ScrollBar(orientation posture) const;
virtual void Draw(BRect updateRect);
virtual void SetBorder(border_style border);
border_style Border() const;
virtual void WindowActivated(bool active);
virtual void MakeFocus(bool state = true);
virtual status_t SetBorderHighlighted(bool state);
bool IsBorderHighlighted() const;
virtual void GetPreferredSize(float* _width,
float* _height);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void ResizeToPreferred();
void SetTarget(BView* target);
BView* Target() const;
virtual void InvalidateLayout(bool descendants = false);
virtual void DoLayout();
virtual void FrameMoved(BPoint position);
virtual void FrameResized(float width, float height);
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint point);
virtual void MessageReceived(BMessage* message);
virtual void WindowActivated(bool active);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 code,
const BMessage* dragMessage);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 code,
const BMessage* dragMessage);
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
// BScrollView
BScrollBar* ScrollBar(orientation posture) const;
virtual void FrameMoved(BPoint position);
virtual void FrameResized(float width, float height);
virtual void SetBorder(border_style border);
border_style Border() const;
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form,
const char* property);
virtual status_t SetBorderHighlighted(bool state);
bool IsBorderHighlighted() const;
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float* _width, float* _height);
virtual void MakeFocus(bool state = true);
virtual status_t GetSupportedSuites(BMessage* data);
void SetTarget(BView* target);
BView* Target() const;
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
// Scripting
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual void InvalidateLayout(bool descendants = false);
virtual void DoLayout();
virtual status_t Perform(perform_code d, void* arg);
// private or reserved methods are following
private:
// FBC padding and forbidden methods
virtual void _ReservedScrollView1();
virtual void _ReservedScrollView2();
virtual void _ReservedScrollView3();
virtual void _ReservedScrollView4();
virtual status_t Perform(perform_code d, void* arg);
BScrollView& operator=(const BScrollView& other);
private:
friend class BView;
virtual void _ReservedScrollView1();
virtual void _ReservedScrollView2();
virtual void _ReservedScrollView3();
virtual void _ReservedScrollView4();
void _Init(bool horizontal, bool vertical);
float _BorderSize() const;
BRect _InnerFrame() const;
BSize _ComputeSize(BSize targetSize) const;
BRect _ComputeFrame(BRect targetRect) const;
void _AlignScrollBars(bool horizontal,
bool vertical, BRect targetFrame);
BScrollView& operator=(const BScrollView& other);
static BRect _ComputeFrame(BRect frame, bool horizontal,
bool vertical, border_style border);
static BRect _ComputeFrame(BView* target, bool horizontal,
bool vertical, border_style border);
static float _BorderSize(border_style border);
static int32 _ModifyFlags(int32 flags, border_style border);
void _Init(bool horizontal, bool vertical);
float _BorderSize() const;
BRect _InnerFrame() const;
BSize _ComputeSize(BSize targetSize) const;
BRect _ComputeFrame(BRect targetRect) const;
void _AlignScrollBars(bool horizontal, bool vertical,
BRect targetFrame);
private:
BView* fTarget;
BScrollBar* fHorizontalScrollBar;
BScrollBar* fVerticalScrollBar;
border_style fBorder;
uint16 fPreviousWidth;
uint16 fPreviousHeight;
bool fHighlighted;
static BRect _ComputeFrame(BRect frame, bool horizontal,
bool vertical, border_style border);
static BRect _ComputeFrame(BView* target, bool horizontal,
bool vertical, border_style border);
static float _BorderSize(border_style border);
static int32 _ModifyFlags(int32 flags, border_style border);
BView* fTarget;
BScrollBar* fHorizontalScrollBar;
BScrollBar* fVerticalScrollBar;
border_style fBorder;
uint16 fPreviousWidth;
uint16 fPreviousHeight;
bool fHighlighted;
uint32 _reserved[3];
uint32 _reserved[3];
};
#endif /* _SCROLL_VIEW_H */
#endif // _SCROLL_VIEW_H

View File

@ -1,37 +1,41 @@
/*
* Copyright 2001-2007, Haiku, Inc.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
*/
#ifndef _SEPARATOR_ITEM_H
#define _SEPARATOR_ITEM_H
#include <MenuItem.h>
class BMessage;
class BSeparatorItem : public BMenuItem {
public:
BSeparatorItem();
BSeparatorItem(BMessage *data);
virtual ~BSeparatorItem();
virtual status_t Archive(BMessage *data, bool deep = true) const;
BSeparatorItem();
BSeparatorItem(BMessage* archive);
virtual ~BSeparatorItem();
static BArchivable *Instantiate(BMessage *data);
virtual void SetEnabled(bool state);
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void SetEnabled(bool state);
protected:
virtual void GetContentSize(float *width, float *height);
virtual void Draw();
virtual void GetContentSize(float* _width, float* _height);
virtual void Draw();
private:
virtual void _ReservedSeparatorItem1();
virtual void _ReservedSeparatorItem2();
// FBC padding, reserved and forbidden
virtual void _ReservedSeparatorItem1();
virtual void _ReservedSeparatorItem2();
BSeparatorItem &operator=(const BSeparatorItem &);
BSeparatorItem& operator=(const BSeparatorItem& other);
uint32 _reserved[1];
uint32 _reserved[1];
};
#endif /* _SEPARATOR_ITEM_H */
#endif // _SEPARATOR_ITEM_H

View File

@ -1,11 +1,11 @@
/*
* Copyright 2001-2009, Stephan Aßmus <superstippi@gmx.de>
* Copyright 2001-2009, Ingo Weinhold <ingo_weinhold@gmx.de>
* All rights reserved. Distributed under the terms of the MIT license.
* Copyright 2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SEPARATOR_VIEW_H
#define _SEPARATOR_VIEW_H
#include <Alignment.h>
#include <String.h>
#include <View.h>
@ -55,8 +55,8 @@ public:
bool deep = true) const;
virtual void Draw(BRect updateRect);
virtual void GetPreferredSize(float* width, float* height);
virtual void GetPreferredSize(float* width, float* height);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
@ -74,6 +74,7 @@ protected:
virtual void DoLayout();
private:
// FBC padding
virtual void _ReservedSeparatorView1();
virtual void _ReservedSeparatorView2();
virtual void _ReservedSeparatorView3();
@ -93,6 +94,7 @@ private:
float _BorderSize() const;
BRect _MaxLabelBounds() const;
private:
BString fLabel;
BView* fLabelView;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2007, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SHAPE_H
@ -21,70 +21,80 @@ namespace BPrivate {
class BShapeIterator {
public:
BShapeIterator();
virtual ~BShapeIterator();
BShapeIterator();
virtual ~BShapeIterator();
virtual status_t IterateMoveTo(BPoint *point);
virtual status_t IterateLineTo(int32 lineCount, BPoint *linePts);
virtual status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPts);
virtual status_t IterateClose();
virtual status_t IterateMoveTo(BPoint* point);
virtual status_t IterateLineTo(int32 lineCount,
BPoint* linePts);
virtual status_t IterateBezierTo(int32 bezierCount,
BPoint* bezierPts);
virtual status_t IterateClose();
status_t Iterate(BShape *shape);
status_t Iterate(BShape* shape);
private:
virtual void _ReservedShapeIterator1();
virtual void _ReservedShapeIterator2();
virtual void _ReservedShapeIterator3();
virtual void _ReservedShapeIterator4();
virtual void _ReservedShapeIterator1();
virtual void _ReservedShapeIterator2();
virtual void _ReservedShapeIterator3();
virtual void _ReservedShapeIterator4();
uint32 reserved[4];
uint32 reserved[4];
};
class BShape : public BArchivable {
public:
BShape();
BShape(const BShape &copyFrom);
BShape(BMessage *data);
virtual ~BShape();
BShape();
BShape(const BShape& other);
BShape(BMessage* archive);
virtual ~BShape();
virtual status_t Archive(BMessage *into, bool deep = true) const;
static BArchivable *Instantiate(BMessage *data);
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
void Clear();
BRect Bounds() const;
void Clear();
BRect Bounds() const;
status_t AddShape(const BShape *other);
status_t AddShape(const BShape* other);
status_t MoveTo(BPoint point);
status_t LineTo(BPoint linePoint);
status_t BezierTo(BPoint controlPoints[3]);
status_t Close();
status_t MoveTo(BPoint point);
status_t LineTo(BPoint linePoint);
status_t BezierTo(BPoint controlPoints[3]);
status_t Close();
private:
virtual status_t Perform(perform_code d, void *arg);
// FBC padding
virtual status_t Perform(perform_code code, void* data);
virtual void _ReservedShape1();
virtual void _ReservedShape2();
virtual void _ReservedShape3();
virtual void _ReservedShape4();
virtual void _ReservedShape1();
virtual void _ReservedShape2();
virtual void _ReservedShape3();
virtual void _ReservedShape4();
private:
friend class BShapeIterator;
friend class BView;
friend class BFont;
friend class BPrivate::PicturePlayer;
friend class BPrivate::ServerLink;
void GetData(int32 *opCount, int32 *ptCount, uint32 **opList, BPoint **ptList);
void SetData(int32 opCount, int32 ptCount, const uint32 *opList, const BPoint *ptList);
void InitData();
bool AllocatePts(int32 count);
bool AllocateOps(int32 count);
void GetData(int32* opCount, int32* ptCount,
uint32** opList, BPoint** ptList);
void SetData(int32 opCount, int32 ptCount,
const uint32* opList,
const BPoint* ptList);
void InitData();
bool AllocatePts(int32 count);
bool AllocateOps(int32 count);
uint32 fState;
uint32 fBuildingOp;
void* fPrivateData;
uint32 reserved[4];
private:
uint32 fState;
uint32 fBuildingOp;
void* fPrivateData;
uint32 reserved[4];
};
#endif // _SHAPE_H
#endif // _SHAPE_H

View File

@ -1,15 +1,17 @@
/*
* Copyright 2001-2009, Haiku Inc.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SHELF_H
#define _SHELF_H
#include <Dragger.h>
#include <Handler.h>
#include <List.h>
#include <Locker.h>
class BDataIO;
class BPoint;
class BView;
@ -24,106 +26,123 @@ namespace BPrivate {
class BShelf : public BHandler {
public:
BShelf(BView* view, bool allowDrags = true, const char* shelfType = NULL);
BShelf(const entry_ref* ref, BView* view, bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BDataIO* stream, BView* view, bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BMessage *data);
virtual ~BShelf();
public:
BShelf(BView* view, bool allowDrags = true,
const char* shelfType = NULL);
BShelf(const entry_ref* ref, BView* view,
bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BDataIO* stream, BView* view,
bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BMessage* archive);
virtual ~BShelf();
virtual status_t Archive(BMessage* data, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive);
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void MessageReceived(BMessage *msg);
status_t Save();
virtual void SetDirty(bool state);
bool IsDirty() const;
virtual void MessageReceived(BMessage* message);
status_t Save();
virtual void SetDirty(bool state);
bool IsDirty() const;
virtual BHandler* ResolveSpecifier(BMessage *msg,
int32 index, BMessage *specifier,
int32 form, const char *property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual status_t Perform(perform_code d, void *arg);
bool AllowsDragging() const;
void SetAllowsDragging(bool state);
bool AllowsZombies() const;
void SetAllowsZombies(bool state);
bool DisplaysZombies() const;
void SetDisplaysZombies(bool state);
bool IsTypeEnforced() const;
void SetTypeEnforced(bool state);
virtual status_t Perform(perform_code code, void* data);
status_t SetSaveLocation(BDataIO *data_io);
status_t SetSaveLocation(const entry_ref *ref);
BDataIO* SaveLocation(entry_ref *ref) const;
bool AllowsDragging() const;
void SetAllowsDragging(bool state);
bool AllowsZombies() const;
void SetAllowsZombies(bool state);
bool DisplaysZombies() const;
void SetDisplaysZombies(bool state);
bool IsTypeEnforced() const;
void SetTypeEnforced(bool state);
status_t AddReplicant(BMessage *data, BPoint location);
status_t DeleteReplicant(BView *replicant);
status_t DeleteReplicant(BMessage *data);
status_t DeleteReplicant(int32 index);
int32 CountReplicants() const;
BMessage* ReplicantAt(int32 index,
BView **view = NULL,
uint32 *uid = NULL,
status_t *perr = NULL) const;
int32 IndexOf(const BView *replicantView) const;
int32 IndexOf(const BMessage *archive) const;
int32 IndexOf(uint32 id) const;
status_t SetSaveLocation(BDataIO* stream);
status_t SetSaveLocation(const entry_ref* ref);
BDataIO* SaveLocation(entry_ref* ref) const;
protected:
virtual bool CanAcceptReplicantMessage(BMessage*) const;
virtual bool CanAcceptReplicantView(BRect, BView*, BMessage*) const;
virtual BPoint AdjustReplicantBy(BRect, BMessage*) const;
status_t AddReplicant(BMessage* archive,
BPoint location);
status_t DeleteReplicant(BView* replicant);
status_t DeleteReplicant(BMessage* archive);
status_t DeleteReplicant(int32 index);
int32 CountReplicants() const;
BMessage* ReplicantAt(int32 index, BView** view = NULL,
uint32* uid = NULL,
status_t* perr = NULL) const;
int32 IndexOf(const BView* replicantView) const;
int32 IndexOf(const BMessage* archive) const;
int32 IndexOf(uint32 id) const;
virtual void ReplicantDeleted(int32 index, const BMessage *archive,
const BView *replicant);
protected:
virtual bool CanAcceptReplicantMessage(
BMessage* archive) const;
virtual bool CanAcceptReplicantView(BRect,
BView*, BMessage*) const;
virtual BPoint AdjustReplicantBy(BRect, BMessage*) const;
private:
friend class BPrivate::ShelfContainerViewFilter;
virtual void ReplicantDeleted(int32 index,
const BMessage* archive,
const BView *replicant);
virtual void _ReservedShelf2();
virtual void _ReservedShelf3();
virtual void _ReservedShelf4();
virtual void _ReservedShelf5();
virtual void _ReservedShelf6();
virtual void _ReservedShelf7();
virtual void _ReservedShelf8();
private:
// FBC padding and forbidden methods
virtual void _ReservedShelf2();
virtual void _ReservedShelf3();
virtual void _ReservedShelf4();
virtual void _ReservedShelf5();
virtual void _ReservedShelf6();
virtual void _ReservedShelf7();
virtual void _ReservedShelf8();
BShelf(const BShelf& other);
BShelf& operator=(const BShelf& other);
BShelf(const BShelf& other);
BShelf& operator=(const BShelf& other);
status_t _Archive(BMessage* data) const;
void _InitData(BEntry* entry, BDataIO* stream,
BView* view, bool allowDrags);
status_t _DeleteReplicant(BPrivate::replicant_data* replicant);
status_t _AddReplicant(BMessage* data,
BPoint* location, uint32 uniqueID);
BView *_GetReplicant(BMessage *data, BView *view, const BPoint &point,
BDragger *&dragger, BDragger::relation &relation);
_BZombieReplicantView_ *_CreateZombie(BMessage *data, BDragger *&dragger);
status_t _GetProperty(BMessage* message, BMessage* reply);
static void _GetReplicantData(BMessage *message, BView *view, BView *&replicant,
BDragger *&dragger, BDragger::relation &relation);
static BArchivable* _InstantiateObject(BMessage *archive, image_id *image);
private:
friend class BPrivate::ShelfContainerViewFilter;
private:
BView* fContainerView;
BDataIO* fStream;
BEntry* fEntry;
BList fReplicants;
BPrivate::ShelfContainerViewFilter* fFilter;
uint32 fGenCount;
bool fAllowDragging;
bool fDirty;
bool fDisplayZombies;
bool fAllowZombies;
bool fTypeEnforced;
status_t _Archive(BMessage* data) const;
void _InitData(BEntry* entry, BDataIO* stream,
BView* view, bool allowDrags);
status_t _DeleteReplicant(
BPrivate::replicant_data* replicant);
status_t _AddReplicant(BMessage* data,
BPoint* location, uint32 uniqueID);
BView* _GetReplicant(BMessage* data, BView* view,
const BPoint& point, BDragger*& dragger,
BDragger::relation& relation);
_BZombieReplicantView_* _CreateZombie(BMessage *data,
BDragger *&dragger);
status_t _GetProperty(BMessage* message,
BMessage* reply);
static void _GetReplicantData(BMessage* message,
BView* view, BView*& replicant,
BDragger*& dragger,
BDragger::relation& relation);
static BArchivable* _InstantiateObject(BMessage* archive,
image_id* image);
uint32 _reserved[8];
private:
BView* fContainerView;
BDataIO* fStream;
BEntry* fEntry;
BList fReplicants;
BPrivate::ShelfContainerViewFilter* fFilter;
uint32 fGenCount;
bool fAllowDragging;
bool fDirty;
bool fDisplayZombies;
bool fAllowZombies;
bool fTypeEnforced;
uint32 _reserved[8];
};
#endif /* _SHELF_H */

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SIZE_H
@ -45,7 +45,6 @@ public:
};
// constructor
inline
BSize::BSize()
: width(B_SIZE_UNSET),
@ -54,7 +53,6 @@ BSize::BSize()
}
// copy constructor
inline
BSize::BSize(const BSize& other)
: width(other.width),
@ -63,7 +61,6 @@ BSize::BSize(const BSize& other)
}
// constructor
inline
BSize::BSize(float width, float height)
: width(width),
@ -72,7 +69,6 @@ BSize::BSize(float width, float height)
}
// Width
inline float
BSize::Width() const
{
@ -80,7 +76,6 @@ BSize::Width() const
}
// Height
inline float
BSize::Height() const
{
@ -88,7 +83,6 @@ BSize::Height() const
}
// Set
inline void
BSize::Set(float width, float height)
{
@ -97,7 +91,6 @@ BSize::Set(float width, float height)
}
// SetWidth
inline void
BSize::SetWidth(float width)
{
@ -105,7 +98,6 @@ BSize::SetWidth(float width)
}
// SetHeight
inline void
BSize::SetHeight(float height)
{
@ -113,7 +105,6 @@ BSize::SetHeight(float height)
}
// IntegerWidth
inline int32
BSize::IntegerWidth() const
{
@ -121,7 +112,6 @@ BSize::IntegerWidth() const
}
// IntegerHeight
inline int32
BSize::IntegerHeight() const
{
@ -129,7 +119,6 @@ BSize::IntegerHeight() const
}
// IsWidthSet
inline bool
BSize::IsWidthSet() const
{
@ -137,7 +126,6 @@ BSize::IsWidthSet() const
}
// IsHeightSet
inline bool
BSize::IsHeightSet() const
{
@ -145,7 +133,6 @@ BSize::IsHeightSet() const
}
// ==
inline bool
BSize::operator==(const BSize& other) const
{
@ -153,7 +140,6 @@ BSize::operator==(const BSize& other) const
}
// !=
inline bool
BSize::operator!=(const BSize& other) const
{
@ -161,7 +147,6 @@ BSize::operator!=(const BSize& other) const
}
// =
inline BSize&
BSize::operator=(const BSize& other)
{
@ -170,4 +155,4 @@ BSize::operator=(const BSize& other)
return *this;
}
#endif // _SIZE_H
#endif // _SIZE_H

View File

@ -1,9 +1,6 @@
/*
* Copyright 2001-2009, Haiku.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Marc Flerackers (mflerackers@androme.be)
*/
#ifndef _SLIDER_H
#define _SLIDER_H
@ -56,11 +53,12 @@ public:
uint32 flags = B_NAVIGABLE | B_WILL_DRAW
| B_FRAME_EVENTS);
BSlider(BMessage* data);
BSlider(BMessage* archive);
virtual ~BSlider();
static BArchivable* Instantiate(BMessage* data);
virtual status_t Archive(BMessage* data, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual status_t Perform(perform_code code, void* data);
virtual void WindowActivated(bool state);
@ -89,7 +87,8 @@ public:
virtual void SetPosition(float);
float Position() const;
virtual void SetEnabled(bool on);
void GetLimits(int32* minimum, int32* maximum) const;
void GetLimits(int32* minimum,
int32* maximum) const;
virtual void Draw(BRect);
virtual void DrawSlider();
@ -108,13 +107,14 @@ public:
virtual void SetFlags(uint32 flags);
virtual void SetResizingMode(uint32 mode);
virtual void GetPreferredSize(float* width, float* height);
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 form,
const char* property);
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual void SetModificationMessage(BMessage* message);
@ -176,6 +176,11 @@ private:
BSize _ValidateMinSize();
void _InitBarColor();
void _InitObject();
private:
// FBC padding and forbidden methods
virtual void _ReservedSlider6();
virtual void _ReservedSlider7();
virtual void _ReservedSlider8();
@ -186,9 +191,6 @@ private:
BSlider& operator=(const BSlider& other);
void _InitBarColor();
void _InitObject();
private:
BMessage* fModificationMessage;
int32 fSnoozeAmount;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SPACE_LAYOUT_ITEM_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SPLIT_LAYOUT_BUILDER_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SPLIT_VIEW_H
@ -13,14 +13,15 @@ class BSplitLayout;
class BSplitView : public BView {
public:
BSplitView(
enum orientation orientation = B_HORIZONTAL,
enum orientation orientation
= B_HORIZONTAL,
float spacing = 0.0f);
virtual ~BSplitView();
void SetInsets(float left, float top, float right,
float bottom);
void GetInsets(float* left, float* top, float* right,
float* bottom) const;
void GetInsets(float* left, float* top,
float* right, float* bottom) const;
float Spacing() const;
void SetSpacing(float spacing);
@ -61,12 +62,14 @@ public:
protected:
virtual void DrawSplitter(BRect frame,
const BRect& updateRect,
enum orientation orientation, bool pressed);
enum orientation orientation,
bool pressed);
private:
static void _DrawDefaultSplitter(BView* view, BRect frame,
const BRect& updateRect,
enum orientation orientation, bool pressed);
enum orientation orientation,
bool pressed);
private:
BSplitLayout* fSplitLayout;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _STATUS_BAR_H
@ -26,9 +26,32 @@ public:
bool deep = true) const;
virtual void AttachedToWindow();
virtual void MessageReceived(BMessage* message);
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void WindowActivated(bool state);
virtual void MakeFocus(bool focus = true);
virtual void GetPreferredSize(float* _width,
float* _height);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void ResizeToPreferred();
virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float newWidth, float newHeight);
virtual void Draw(BRect updateRect);
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage);
// BStatusBar
virtual void SetBarColor(rgb_color color);
virtual void SetBarHeight(float height);
@ -53,33 +76,13 @@ public:
const char* Label() const;
const char* TrailingLabel() const;
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void WindowActivated(bool state);
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage);
virtual void DetachedFromWindow();
virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float newWidth, float newHeight);
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 focus = 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* data);
virtual status_t Perform(perform_code d, void* arg);
// Layout methods
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
private:
// FBC memebers
virtual void _ReservedStatusBar2();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _STRING_ITEM_H
@ -11,33 +11,37 @@
class BStringItem : public BListItem {
public:
BStringItem(const char* text,
uint32 outlineLevel = 0, bool expanded = true);
BStringItem(BMessage* archive);
virtual ~BStringItem();
BStringItem(const char* text,
uint32 outlineLevel = 0,
bool expanded = true);
BStringItem(BMessage* archive);
virtual ~BStringItem();
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
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 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 void Update(BView* owner, const BFont* font);
virtual status_t Perform(perform_code code, void* arg);
virtual status_t Perform(perform_code code, void* arg);
private:
virtual void _ReservedStringItem1();
virtual void _ReservedStringItem2();
// FBC padding and forbidden methods
virtual void _ReservedStringItem1();
virtual void _ReservedStringItem2();
BStringItem(const BStringItem& item);
BStringItem& operator=(const BStringItem& item);
BStringItem(const BStringItem& item);
BStringItem& operator=(const BStringItem& item);
char* fText;
float fBaselineOffset;
uint32 _reserved[2];
private:
char* fText;
float fBaselineOffset;
uint32 _reserved[2];
};
#endif // _STRING_ITEM_H

View File

@ -1,9 +1,6 @@
/*
* Copyright 2001-2005, Haiku Inc.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Frans van Nispen (xlr8@tref.nl)
*/
#ifndef _STRING_VIEW_H
#define _STRING_VIEW_H
@ -14,70 +11,78 @@
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(const char* name, const char* text,
uint32 flags = B_WILL_DRAW);
BStringView(BMessage* data);
virtual ~BStringView();
public:
BStringView(BRect bounds, const char* name,
const char* text, uint32 resizeFlags
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
BStringView(const char* name, const char* text,
uint32 flags = B_WILL_DRAW);
BStringView(BMessage* archive);
virtual ~BStringView();
static BArchivable* Instantiate(BMessage* data);
virtual status_t Archive(BMessage* data, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
void SetText(const char* text);
const char* Text() const;
void SetAlignment(alignment flag);
alignment Alignment() 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 AttachedToWindow();
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit,
const BMessage* dragMessage);
virtual void DetachedFromWindow();
virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float newWidth, float newHeight);
virtual void MakeFocus(bool state = true);
virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index,
BMessage* specifier, int32 form,
const char* property);
virtual void GetPreferredSize(float* _width,
float* _height);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void InvalidateLayout(bool descendants = false);
virtual void ResizeToPreferred();
virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float newWidth, float newHeight);
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 void Draw(BRect bounds);
virtual void SetFont(const BFont* font,
uint32 mask = B_FONT_ALL);
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit,
const BMessage* dragMessage);
virtual void InvalidateLayout(bool descendants = false);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
private:
virtual status_t Perform(perform_code d, void* arg);
virtual void _ReservedStringView1();
virtual void _ReservedStringView2();
virtual void _ReservedStringView3();
virtual void SetFont(const BFont* font,
uint32 mask = B_FONT_ALL);
BSize _ValidatePreferredSize();
BStringView &operator=(const BStringView&);
private:
// FBC padding and forbidden methods
virtual status_t Perform(perform_code code, void* data);
char* fText;
alignment fAlign;
BSize fPreferredSize;
uint32 _reserved[1];
virtual void _ReservedStringView1();
virtual void _ReservedStringView2();
virtual void _ReservedStringView3();
BStringView& operator=(const BStringView& other);
private:
BSize _ValidatePreferredSize();
private:
char* fText;
alignment fAlign;
BSize fPreferredSize;
uint32 _reserved[1];
};
#endif // _STRING_VIEW_H
#endif // _STRING_VIEW_H

View File

@ -1,6 +1,6 @@
/*
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Distributed under the terms of the MIT License.
*/
#ifndef _TAB_VIEW_H
#define _TAB_VIEW_H
@ -51,6 +51,7 @@ public:
tab_position position, bool full = true);
private:
// FBC padding and forbidden methods
virtual void _ReservedTab1();
virtual void _ReservedTab2();
virtual void _ReservedTab3();
@ -66,6 +67,7 @@ private:
BTab& operator=(const BTab&);
private:
bool fEnabled;
bool fSelected;
bool fFocus;
@ -79,15 +81,15 @@ class BTabView : public BView {
public:
BTabView(const char* name,
button_width width = B_WIDTH_AS_USUAL,
uint32 flags = B_FULL_UPDATE_ON_RESIZE |
B_WILL_DRAW | B_NAVIGABLE_JUMP |
B_FRAME_EVENTS | B_NAVIGABLE);
uint32 flags = B_FULL_UPDATE_ON_RESIZE
| B_WILL_DRAW | B_NAVIGABLE_JUMP
| B_FRAME_EVENTS | B_NAVIGABLE);
BTabView(BRect frame, const char* name,
button_width width = B_WIDTH_AS_USUAL,
uint32 resizingMode = B_FOLLOW_ALL,
uint32 flags = B_FULL_UPDATE_ON_RESIZE |
B_WILL_DRAW | B_NAVIGABLE_JUMP |
B_FRAME_EVENTS | B_NAVIGABLE);
uint32 flags = B_FULL_UPDATE_ON_RESIZE
| B_WILL_DRAW | B_NAVIGABLE_JUMP
| B_FRAME_EVENTS | B_NAVIGABLE);
virtual ~BTabView();
BTabView(BMessage* archive);
@ -96,15 +98,12 @@ public:
bool deep = true) const;
virtual status_t Perform(perform_code d, void* arg);
virtual void WindowActivated(bool active);
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void DetachedFromWindow();
virtual void MessageReceived(BMessage* message);
virtual void FrameMoved(BPoint newLocation);
virtual void FrameResized(float width,float height);
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
@ -115,6 +114,7 @@ public:
virtual void Select(int32 tab);
int32 Selection() const;
virtual void WindowActivated(bool active);
virtual void MakeFocus(bool focused = true);
virtual void SetFocusTab(int32 tab, bool focused);
int32 FocusTab() const;
@ -135,11 +135,15 @@ public:
virtual BSize MaxSize();
virtual BSize PreferredSize();
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);
// BTabView
virtual void AddTab(BView* target, BTab* tab = NULL);
virtual BTab* RemoveTab(int32 tabIndex);
@ -157,9 +161,7 @@ public:
BView* ViewForTab(int32 tabIndex) const;
private:
void _InitObject(bool layouted, button_width width);
BSize _TabsMinSize() const;
// FBC padding and forbidden methods
virtual void _ReservedTabView1();
virtual void _ReservedTabView2();
virtual void _ReservedTabView3();
@ -176,6 +178,11 @@ private:
BTabView(const BTabView&);
BTabView& operator=(const BTabView&);
private:
void _InitObject(bool layouted, button_width width);
BSize _TabsMinSize() const;
private:
BList* fTabList;
BView* fContainerView;
button_width fTabWidthSetting;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _TEXT_CONTROL_H
@ -11,9 +11,10 @@
class BLayoutItem;
namespace BPrivate {
class _BTextInput_;
class _BTextInput_;
}
class BTextControl : public BControl {
public:
BTextControl(BRect frame, const char* name,
@ -62,13 +63,14 @@ public:
virtual void FrameResized(float newWidth, float newHeight);
virtual void WindowActivated(bool active);
virtual void GetPreferredSize(float* _width, float* _height);
virtual void GetPreferredSize(float* _width,
float* _height);
virtual void ResizeToPreferred();
virtual void MessageReceived(BMessage* message);
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 what,
const char* property);
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 what, const char* property);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit,
@ -93,14 +95,7 @@ protected:
virtual void DoLayout();
private:
class LabelLayoutItem;
class TextViewLayoutItem;
struct LayoutData;
friend class _BTextInput_;
friend class LabelLayoutItem;
friend class TextViewLayoutItem;
// FBC padding and forbidden methods
virtual status_t Perform(perform_code d, void* arg);
virtual void _ReservedTextControl1();
@ -110,9 +105,19 @@ private:
BTextControl& operator=(const BTextControl& other);
private:
class LabelLayoutItem;
class TextViewLayoutItem;
struct LayoutData;
friend class _BTextInput_;
friend class LabelLayoutItem;
friend class TextViewLayoutItem;
void _CommitValue();
void _UpdateTextViewColors(bool enabled);
void _InitData(const char* label, const char* initialText,
void _InitData(const char* label,
const char* initialText,
BMessage* archive = NULL);
void _ValidateLayout();
void _LayoutTextView();

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Copyright 2007-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _TEXTVIEW_H
#define _TEXTVIEW_H
@ -38,7 +38,8 @@ enum undo_state {
namespace BPrivate {
class TextGapBuffer;
} // namespace BPrivate
}
class BTextView : public BView {
public:
@ -59,12 +60,13 @@ public:
const rgb_color* initialColor,
uint32 flags);
BTextView(BMessage* data);
BTextView(BMessage* archive);
virtual ~BTextView();
static BArchivable* Instantiate(BMessage* data);
virtual status_t Archive(BMessage* data, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
@ -80,11 +82,10 @@ public:
virtual void MakeFocus(bool focusState = true);
virtual void MessageReceived(BMessage* message);
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form,
const char* property);
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual status_t Perform(perform_code d, void* arg);
void SetText(const char* inText,
const text_run_array* inRuns = NULL);
@ -224,9 +225,6 @@ public:
protected:
virtual void DoLayout();
private:
void _ValidateLayoutData();
public:
virtual void AllAttached();
virtual void AllDetached();
@ -256,6 +254,22 @@ protected:
BBitmap** _bitmap, BPoint* point,
BHandler** _handler);
// FBC padding and forbidden methods
public:
virtual status_t Perform(perform_code code, void* data);
private:
virtual void _ReservedTextView3();
virtual void _ReservedTextView4();
virtual void _ReservedTextView5();
virtual void _ReservedTextView6();
virtual void _ReservedTextView7();
virtual void _ReservedTextView8();
virtual void _ReservedTextView9();
virtual void _ReservedTextView10();
virtual void _ReservedTextView11();
virtual void _ReservedTextView12();
private:
class InlineInput;
struct LayoutData;
@ -273,21 +287,12 @@ private:
friend class TextTrackState;
virtual void _ReservedTextView3();
virtual void _ReservedTextView4();
virtual void _ReservedTextView5();
virtual void _ReservedTextView6();
virtual void _ReservedTextView7();
virtual void _ReservedTextView8();
virtual void _ReservedTextView9();
virtual void _ReservedTextView10();
virtual void _ReservedTextView11();
virtual void _ReservedTextView12();
void _InitObject(BRect textRect,
const BFont* initialFont,
const rgb_color* initialColor);
void _ValidateLayoutData();
void _HandleBackspace();
void _HandleArrowKey(uint32 inArrowKey);
void _HandleDelete();
@ -316,14 +321,17 @@ private:
int32 inLength, int32 inOffset,
const text_run_array* inRuns);
void _DoDeleteText(int32 fromOffset, int32 toOffset);
void _DoDeleteText(int32 fromOffset,
int32 toOffset);
void _DrawLine(BView* view, const int32 &startLine,
const int32& startOffset, const bool& erase,
BRect& eraseRect, BRegion& inputRegion);
const int32& startOffset,
const bool& erase, BRect& eraseRect,
BRegion& inputRegion);
void _DrawLines(int32 startLine, int32 endLine,
int32 startOffset = -1, bool erase = false);
int32 startOffset = -1,
bool erase = false);
void _RequestDrawLines(int32 startLine,
int32 endLine, int32 startOffset = -1,
bool erase = false);
@ -398,6 +406,7 @@ private:
float verticalStep);
void _ScrollTo(float x, float y);
private:
BPrivate::TextGapBuffer* fText;
LineBuffer* fLines;
StyleBuffer* fStyles;

View File

@ -1,10 +1,11 @@
/*
* Copyright 2006, Haiku Inc.
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _TWO_DIMENSIONAL_LAYOUT_H
#define _TWO_DIMENSIONAL_LAYOUT_H
#include <Layout.h>
class BLayoutContext;
@ -90,4 +91,4 @@ private:
LocalLayouter* fLocalLayouter;
};
#endif // _TWO_DIMENSIONAL_LAYOUT_H
#endif // _TWO_DIMENSIONAL_LAYOUT_H

View File

@ -1,9 +1,6 @@
/*
* Copyright 2001-2009, Haiku Inc. All Rights Reserved.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Erik Jaesler (erik@cgsoftware.com)
*/
#ifndef _UNICODEBLOCKOBJECTS_H
#define _UNICODEBLOCKOBJECTS_H

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,6 @@
/*
* Copyright 2001-2009, Haiku.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Adrian Oanca <adioanca@cotty.iren.ro>
*/
#ifndef _WINDOW_H
#define _WINDOW_H
@ -32,31 +29,31 @@ namespace BPrivate {
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
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
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
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 {
@ -87,177 +84,198 @@ enum {
B_NO_SERVER_SIDE_WINDOW_MODIFIERS = 0x00000200
};
#define B_CURRENT_WORKSPACE 0
#define B_ALL_WORKSPACES 0xffffffff
#define B_CURRENT_WORKSPACE 0
#define B_ALL_WORKSPACES 0xffffffff
//----------------------------------------------------------------
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(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;
BWindow(BMessage* archive);
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void Quit();
void Close() { Quit(); }
virtual void Quit();
void Close() { Quit(); }
void AddChild(BView* child, BView* before = NULL);
bool RemoveChild(BView* child);
int32 CountChildren() const;
BView* ChildAt(int32 index) const;
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 newPosition);
virtual void WorkspacesChanged(uint32 oldWorkspaces,
uint32 newWorkspaces);
virtual void WorkspaceActivated(int32 workspace, bool state);
virtual void FrameResized(float newWidth, float newHeight);
virtual void Minimize(bool minimize);
virtual void Zoom(BPoint origin, float width, float height);
void Zoom();
void SetZoomLimits(float maxWidth, float maxHeight);
virtual void ScreenChanged(BRect screenSize, color_space format);
virtual void DispatchMessage(BMessage* message,
BHandler* handler);
virtual void MessageReceived(BMessage* message);
virtual void FrameMoved(BPoint newPosition);
virtual void WorkspacesChanged(uint32 oldWorkspaces,
uint32 newWorkspaces);
virtual void WorkspaceActivated(int32 workspace,
bool state);
virtual void FrameResized(float newWidth, float newHeight);
virtual void Minimize(bool minimize);
virtual void Zoom(BPoint origin, float width, float height);
void Zoom();
void SetZoomLimits(float maxWidth, float maxHeight);
virtual void ScreenChanged(BRect screenSize,
color_space format);
void SetPulseRate(bigtime_t rate);
bigtime_t PulseRate() const;
void SetPulseRate(bigtime_t rate);
bigtime_t PulseRate() const;
void AddShortcut(uint32 key, uint32 modifiers,
BMessage* message);
void AddShortcut(uint32 key, uint32 modifiers,
BMessage* message, BHandler* target);
void RemoveShortcut(uint32 key, uint32 modifiers);
void AddShortcut(uint32 key, uint32 modifiers,
BMessage* message);
void AddShortcut(uint32 key, uint32 modifiers,
BMessage* message, BHandler* target);
void RemoveShortcut(uint32 key, uint32 modifiers);
void SetDefaultButton(BButton* button);
BButton* DefaultButton() const;
void SetDefaultButton(BButton* button);
BButton* DefaultButton() const;
virtual void MenusBeginning();
virtual void MenusEnded();
virtual void MenusBeginning();
virtual void MenusEnded();
bool NeedsUpdate() const;
void UpdateIfNeeded();
bool NeedsUpdate() const;
void UpdateIfNeeded();
BView* FindView(const char* viewName) const;
BView* FindView(BPoint) const;
BView* CurrentFocus() const;
BView* FindView(const char* viewName) const;
BView* FindView(BPoint) const;
BView* CurrentFocus() const;
void Activate(bool = true);
virtual void WindowActivated(bool state);
void Activate(bool = true);
virtual void WindowActivated(bool state);
void ConvertToScreen(BPoint* point) const;
BPoint ConvertToScreen(BPoint point) const;
void ConvertFromScreen(BPoint* point) const;
BPoint ConvertFromScreen(BPoint point) const;
void ConvertToScreen(BRect* rect) const;
BRect ConvertToScreen(BRect rect) const;
void ConvertFromScreen(BRect* rect) const;
BRect ConvertFromScreen(BRect rect) const;
void ConvertToScreen(BPoint* point) const;
BPoint ConvertToScreen(BPoint point) const;
void ConvertFromScreen(BPoint* point) const;
BPoint ConvertFromScreen(BPoint point) 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);
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);
void CenterIn(const BRect& rect);
void CenterOnScreen();
void CenterIn(const BRect& rect);
void CenterOnScreen();
virtual void Show();
virtual void Hide();
bool IsHidden() const;
bool IsMinimized() const;
virtual void Show();
virtual void Hide();
bool IsHidden() const;
bool IsMinimized() const;
void Flush() const;
void Sync() const;
void Flush() const;
void Sync() const;
status_t SendBehind(const BWindow* window);
status_t SendBehind(const BWindow* window);
void DisableUpdates();
void EnableUpdates();
void DisableUpdates();
void EnableUpdates();
void BeginViewTransaction();
// referred as OpenViewTransaction() in BeBook
void EndViewTransaction();
// referred as CommitViewTransaction() in BeBook
void BeginViewTransaction();
// referred as OpenViewTransaction()
// in BeBook
void EndViewTransaction();
// referred as CommitViewTransaction()
// in BeBook
BRect Bounds() const;
BRect Frame() const;
BRect DecoratorFrame() const;
BSize Size() const;
const char* Title() const;
void SetTitle(const char* title);
bool IsFront() const;
bool IsActive() const;
BRect Bounds() const;
BRect Frame() const;
BRect DecoratorFrame() const;
BSize Size() const;
const char* Title() const;
void SetTitle(const char* title);
bool IsFront() const;
bool IsActive() const;
void SetKeyMenuBar(BMenuBar* bar);
BMenuBar* KeyMenuBar() const;
void SetKeyMenuBar(BMenuBar* bar);
BMenuBar* KeyMenuBar() const;
void SetSizeLimits(float minWidth, float maxWidth,
float minHeight, float maxHeight);
void GetSizeLimits(float* minWidth, float* maxWidth,
float* minHeight, float* maxHeight);
void SetSizeLimits(float minWidth, float maxWidth,
float minHeight, float maxHeight);
void GetSizeLimits(float* minWidth, float* maxWidth,
float* minHeight, float* maxHeight);
status_t SetDecoratorSettings(const BMessage& settings);
status_t GetDecoratorSettings(BMessage* settings) const;
status_t SetDecoratorSettings(const BMessage& settings);
status_t GetDecoratorSettings(BMessage* settings) const;
uint32 Workspaces() const;
void SetWorkspaces(uint32);
uint32 Workspaces() const;
void SetWorkspaces(uint32);
BView* LastMouseMovedView() const;
BView* LastMouseMovedView() const;
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form,
const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual BHandler* ResolveSpecifier(BMessage* message,
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);
status_t AddToSubset(BWindow* window);
status_t RemoveFromSubset(BWindow* window);
virtual status_t Perform(perform_code d, void* arg);
virtual status_t Perform(perform_code code, void* data);
status_t SetType(window_type type);
window_type Type() const;
status_t SetType(window_type type);
window_type Type() const;
status_t SetLook(window_look look);
window_look Look() const;
status_t SetLook(window_look look);
window_look Look() const;
status_t SetFeel(window_feel feel);
window_feel Feel() const;
status_t SetFeel(window_feel feel);
window_feel Feel() const;
status_t SetFlags(uint32);
uint32 Flags() const;
status_t SetFlags(uint32);
uint32 Flags() const;
bool IsModal() const;
bool IsFloating() 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;
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();
virtual bool QuitRequested();
virtual thread_id Run();
virtual void SetLayout(BLayout* layout);
BLayout* GetLayout() const;
virtual void SetLayout(BLayout* layout);
BLayout* GetLayout() const;
void InvalidateLayout(bool descendants = false);
void InvalidateLayout(bool descendants = false);
private:
// FBC padding and forbidden methods
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&);
private:
typedef BLooper inherited;
@ -275,118 +293,108 @@ private:
friend void _set_menu_sem_(BWindow* w, sem_id sem);
friend status_t _safe_get_server_token_(const BLooper*, int32*);
virtual void _ReservedWindow2();
virtual void _ReservedWindow3();
virtual void _ReservedWindow4();
virtual void _ReservedWindow5();
virtual void _ReservedWindow6();
virtual void _ReservedWindow7();
virtual void _ReservedWindow8();
BWindow(BRect frame, int32 bitmapToken);
void _InitData(BRect frame, const char* title,
window_look look, window_feel feel,
uint32 flags, uint32 workspace,
int32 bitmapToken = -1);
BWindow();
BWindow(BWindow&);
BWindow& operator=(BWindow&);
virtual void task_looper();
BWindow(BRect frame, int32 bitmapToken);
void _InitData(BRect frame, const char* title,
window_look look, window_feel feel,
uint32 flags, uint32 workspace,
int32 bitmapToken = -1);
virtual BMessage* ConvertToMessage(void* raw, int32 code);
virtual void task_looper();
void AddShortcut(uint32 key, uint32 modifiers,
BMenuItem* item);
BHandler* _DetermineTarget(BMessage* message,
BHandler* target);
bool _IsFocusMessage(BMessage* message);
bool _UnpackMessage(unpack_cookie& state,
BMessage** _message, BHandler** _target,
bool* _usePreferred);
void _SanitizeMessage(BMessage* message,
BHandler* target, bool usePreferred);
bool _StealMouseMessage(BMessage* message,
bool& deleteMessage);
uint32 _TransitForMouseMoved(BView* view,
BView* viewUnderMouse) const;
virtual BMessage* ConvertToMessage(void* raw, int32 code);
bool InUpdate();
void _DequeueAll();
window_type _ComposeType(window_look look,
window_feel feel) const;
void _DecomposeType(window_type type,
window_look* look,
window_feel* feel) const;
void AddShortcut(uint32 key, uint32 modifiers,
BMenuItem* item);
BHandler* _DetermineTarget(BMessage* message,
BHandler* target);
bool _IsFocusMessage(BMessage* message);
bool _UnpackMessage(unpack_cookie& state,
BMessage** _message, BHandler** _target,
bool* _usePreferred);
void _SanitizeMessage(BMessage* message,
BHandler* target, bool usePreferred);
bool _StealMouseMessage(BMessage* message,
bool& deleteMessage);
uint32 _TransitForMouseMoved(BView* view,
BView* viewUnderMouse) const;
void SetIsFilePanel(bool yes);
bool IsFilePanel() const;
bool InUpdate();
void _DequeueAll();
window_type _ComposeType(window_look look,
window_feel feel) const;
void _DecomposeType(window_type type, window_look* look,
window_feel* feel) const;
void _CreateTopView();
void _AdoptResize();
void _SetFocus(BView* focusView,
bool notifyIputServer = false);
void _SetName(const char* title);
void SetIsFilePanel(bool yes);
bool IsFilePanel() const;
Shortcut* _FindShortcut(uint32 key, uint32 modifiers);
BView* _FindView(BView* view, BPoint point) const;
BView* _FindView(int32 token);
BView* _LastViewChild(BView* parent);
void _CreateTopView();
void _AdoptResize();
void _SetFocus(BView* focusView,
bool notifyIputServer = false);
void _SetName(const char* title);
BView* _FindNextNavigable(BView* focus, uint32 flags);
BView* _FindPreviousNavigable(BView* focus,
uint32 flags);
void _Switcher(int32 rawKey, uint32 modifiers,
bool repeat);
bool _HandleKeyDown(BMessage* event);
bool _HandleUnmappedKeyDown(BMessage* event);
void _KeyboardNavigation();
Shortcut* _FindShortcut(uint32 key, uint32 modifiers);
BView* _FindView(BView* view, BPoint point) const;
BView* _FindView(int32 token);
BView* _LastViewChild(BView* parent);
void _GetDecoratorSize(float* _borderWidth,
float* _tabHeight) const;
BView* _FindNextNavigable(BView *focus, uint32 flags);
BView* _FindPreviousNavigable(BView *focus, uint32 flags);
void _Switcher(int32 rawKey, uint32 modifiers,
bool repeat);
bool _HandleKeyDown(BMessage* event);
bool _HandleUnmappedKeyDown(BMessage* event);
void _KeyboardNavigation();
void _GetDecoratorSize(float* _borderWidth,
float* _tabHeight) const;
void _CheckSizeLimits();
void _CheckSizeLimits();
private:
char* fTitle;
int32 _unused0;
bool fInTransaction;
bool fActive;
short fShowLevel;
uint32 fFlags;
char* fTitle;
int32 _unused0;
bool fInTransaction;
bool fActive;
short fShowLevel;
uint32 fFlags;
BView* fTopView;
BView* fFocus;
BView* fLastMouseMovedView;
BMessageRunner* fIdleMouseRunner;
BMenuBar* fKeyMenuBar;
BButton* fDefaultButton;
BList fShortcuts;
int32 fTopViewToken;
bool fUpdateRequested;
bool fOffscreen;
bool fIsFilePanel;
bool _unused4;
bigtime_t fPulseRate;
bool _unused5;
bool fMinimized;
bool fNoQuitShortcut;
bool _unused6;
sem_id fMenuSem;
float fMaxZoomHeight;
float fMaxZoomWidth;
float fMinHeight;
float fMinWidth;
float fMaxHeight;
float fMaxWidth;
BRect fFrame;
window_look fLook;
window_feel fFeel;
int32 fLastViewToken;
BView* fTopView;
BView* fFocus;
BView* fLastMouseMovedView;
BMessageRunner* fIdleMouseRunner;
BMenuBar* fKeyMenuBar;
BButton* fDefaultButton;
BList fShortcuts;
int32 fTopViewToken;
bool fUpdateRequested;
bool fOffscreen;
bool fIsFilePanel;
bool _unused4;
bigtime_t fPulseRate;
bool _unused5;
bool fMinimized;
bool fNoQuitShortcut;
bool _unused6;
sem_id fMenuSem;
float fMaxZoomHeight;
float fMaxZoomWidth;
float fMinHeight;
float fMinWidth;
float fMaxHeight;
float fMaxWidth;
BRect fFrame;
window_look fLook;
window_feel fFeel;
int32 fLastViewToken;
BPrivate::PortLink* fLink;
BMessageRunner* fPulseRunner;
BRect fPreviousFrame;
BMessageRunner* fPulseRunner;
BRect fPreviousFrame;
uint32 _reserved[9];
uint32 _reserved[9];
};
#endif // _WINDOW_H
#endif // _WINDOW_H

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2008, Haiku, Inc.
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Authors:
@ -323,6 +323,9 @@ BScrollBar::Archive(BMessage *data, bool deep) const
}
// #pragma mark -
void
BScrollBar::AttachedToWindow()
{

View File

@ -85,61 +85,11 @@ BScrollView::~BScrollView()
}
void
BScrollView::_Init(bool horizontal, bool vertical)
{
fHorizontalScrollBar = NULL;
fVerticalScrollBar = NULL;
fHighlighted = false;
if (be_control_look != NULL)
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BRect targetFrame;
if (fTarget) {
// layout target and add it
fTarget->TargetedByScrollView(this);
fTarget->MoveTo(B_ORIGIN);
if (fBorder != B_NO_BORDER)
fTarget->MoveBy(_BorderSize(), _BorderSize());
AddChild(fTarget);
targetFrame = fTarget->Frame();
} else {
// no target specified
targetFrame = Bounds();
if (horizontal)
targetFrame.bottom -= B_H_SCROLL_BAR_HEIGHT + 1;
if (vertical)
targetFrame.right -= B_V_SCROLL_BAR_WIDTH + 1;
if (fBorder == B_FANCY_BORDER) {
targetFrame.bottom--;
targetFrame.right--;
}
}
if (horizontal) {
fHorizontalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_HSB_",
fTarget, 0, 1000, B_HORIZONTAL);
AddChild(fHorizontalScrollBar);
}
if (vertical) {
fVerticalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_VSB_",
fTarget, 0, 1000, B_VERTICAL);
AddChild(fVerticalScrollBar);
}
_AlignScrollBars(horizontal, vertical, targetFrame);
fPreviousWidth = uint16(Bounds().Width());
fPreviousHeight = uint16(Bounds().Height());
}
// #pragma mark -
BArchivable *
BScrollView::Instantiate(BMessage *archive)
BArchivable*
BScrollView::Instantiate(BMessage* archive)
{
if (validate_instantiation(archive, "BScrollView"))
return new BScrollView(archive);
@ -149,7 +99,7 @@ BScrollView::Instantiate(BMessage *archive)
status_t
BScrollView::Archive(BMessage *archive, bool deep) const
BScrollView::Archive(BMessage* archive, bool deep) const
{
status_t status = BView::Archive(archive, deep);
if (status != B_OK)
@ -245,21 +195,24 @@ BScrollView::Draw(BRect updateRect)
}
if (fBorder == B_PLAIN_BORDER) {
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT));
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
StrokeRect(Bounds());
return;
} else if (fBorder != B_FANCY_BORDER)
return;
BRect bounds = Bounds();
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT));
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
StrokeRect(bounds.InsetByCopy(1, 1));
if (fHighlighted && Window()->IsActive()) {
SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR));
StrokeRect(bounds);
} else {
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_1_TINT));
StrokeLine(bounds.LeftBottom(), bounds.LeftTop());
bounds.left++;
StrokeLine(bounds.LeftTop(), bounds.RightTop());
@ -273,7 +226,215 @@ BScrollView::Draw(BRect updateRect)
}
BScrollBar *
// #pragma mark -
void
BScrollView::WindowActivated(bool active)
{
if (fHighlighted)
Invalidate();
BView::WindowActivated(active);
}
void
BScrollView::MakeFocus(bool state)
{
BView::MakeFocus(state);
}
// #pragma mark -
void
BScrollView::GetPreferredSize(float *_width, float *_height)
{
BSize size = PreferredSize();
if (_width)
*_width = size.width;
if (_height)
*_height = size.height;
}
BSize
BScrollView::MinSize()
{
BSize size = _ComputeSize(fTarget != NULL ? fTarget->MinSize()
: BSize(16, 16));
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
}
BSize
BScrollView::MaxSize()
{
BSize size = _ComputeSize(fTarget != NULL ? fTarget->MaxSize()
: BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
}
BSize
BScrollView::PreferredSize()
{
BSize size = _ComputeSize(fTarget != NULL ? fTarget->PreferredSize()
: BSize(32, 32));
return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size);
}
void
BScrollView::ResizeToPreferred()
{
if (Window() == NULL)
return;
BView::ResizeToPreferred();
}
void
BScrollView::InvalidateLayout(bool descendants)
{
BView::InvalidateLayout(descendants);
}
void
BScrollView::DoLayout()
{
if (!(Flags() & B_SUPPORTS_LAYOUT))
return;
// If the user set a layout, we let the base class version call its hook.
if (GetLayout()) {
BView::DoLayout();
return;
}
BRect innerFrame = _InnerFrame();
if (fTarget != NULL) {
fTarget->MoveTo(innerFrame.left, innerFrame.top);
fTarget->ResizeTo(innerFrame.Width(), innerFrame.Height());
//BLayoutUtils::AlignInFrame(fTarget, fTarget->Bounds());
}
_AlignScrollBars(fHorizontalScrollBar != NULL, fVerticalScrollBar != NULL,
innerFrame);
}
void
BScrollView::FrameMoved(BPoint position)
{
BView::FrameMoved(position);
}
void
BScrollView::FrameResized(float width, float height)
{
BView::FrameResized(width, height);
if (fBorder == B_NO_BORDER)
return;
BRect bounds = Bounds();
float border = _BorderSize() - 1;
if (be_control_look && fHorizontalScrollBar && fVerticalScrollBar) {
BRect scrollCorner(bounds);
scrollCorner.left = min_c(
fPreviousWidth - fVerticalScrollBar->Frame().Height(),
fHorizontalScrollBar->Frame().right + 1);
scrollCorner.top = min_c(
fPreviousHeight - fHorizontalScrollBar->Frame().Width(),
fVerticalScrollBar->Frame().bottom + 1);
Invalidate(scrollCorner);
}
// changes in width
if (bounds.Width() > fPreviousWidth) {
// invalidate the region between the old and the new right border
BRect rect = bounds;
rect.left += fPreviousWidth - border;
rect.right--;
Invalidate(rect);
} else if (bounds.Width() < fPreviousWidth) {
// invalidate the region of the new right border
BRect rect = bounds;
rect.left = rect.right - border;
Invalidate(rect);
}
// changes in height
if (bounds.Height() > fPreviousHeight) {
// invalidate the region between the old and the new bottom border
BRect rect = bounds;
rect.top += fPreviousHeight - border;
rect.bottom--;
Invalidate(rect);
} else if (bounds.Height() < fPreviousHeight) {
// invalidate the region of the new bottom border
BRect rect = bounds;
rect.top = rect.bottom - border;
Invalidate(rect);
}
fPreviousWidth = uint16(bounds.Width());
fPreviousHeight = uint16(bounds.Height());
}
// #pragma mark -
void
BScrollView::MessageReceived(BMessage* message)
{
switch (message->what) {
default:
BView::MessageReceived(message);
}
}
void
BScrollView::MouseDown(BPoint point)
{
BView::MouseDown(point);
}
void
BScrollView::MouseUp(BPoint point)
{
BView::MouseUp(point);
}
void
BScrollView::MouseMoved(BPoint point, uint32 code, const BMessage *dragMessage)
{
BView::MouseMoved(point, code, dragMessage);
}
// #pragma mark -
BScrollBar*
BScrollView::ScrollBar(orientation posture) const
{
if (posture == B_HORIZONTAL)
@ -425,126 +586,141 @@ BScrollView::SetTarget(BView *target)
}
BView *
BView*
BScrollView::Target() const
{
return fTarget;
}
void
BScrollView::MessageReceived(BMessage *message)
// #pragma mark -
BHandler*
BScrollView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier,
int32 form, const char* property)
{
switch (message->what) {
default:
BView::MessageReceived(message);
}
return BView::ResolveSpecifier(msg, index, specifier, form, property);
}
void
BScrollView::MouseDown(BPoint point)
status_t
BScrollView::GetSupportedSuites(BMessage *data)
{
BView::MouseDown(point);
return BView::GetSupportedSuites(data);
}
void
BScrollView::MouseUp(BPoint point)
status_t
BScrollView::Perform(perform_code code, void* _data)
{
BView::MouseUp(point);
}
void
BScrollView::MouseMoved(BPoint point, uint32 code, const BMessage *dragMessage)
{
BView::MouseMoved(point, code, dragMessage);
}
void
BScrollView::FrameMoved(BPoint position)
{
BView::FrameMoved(position);
}
void
BScrollView::FrameResized(float width, float height)
{
BView::FrameResized(width, height);
if (fBorder == B_NO_BORDER)
return;
BRect bounds = Bounds();
float border = _BorderSize() - 1;
if (be_control_look && fHorizontalScrollBar && fVerticalScrollBar) {
BRect scrollCorner(bounds);
scrollCorner.left = min_c(
fPreviousWidth - fVerticalScrollBar->Frame().Height(),
fHorizontalScrollBar->Frame().right + 1);
scrollCorner.top = min_c(
fPreviousHeight - fHorizontalScrollBar->Frame().Width(),
fVerticalScrollBar->Frame().bottom + 1);
Invalidate(scrollCorner);
switch (code) {
case PERFORM_CODE_MIN_SIZE:
((perform_data_min_size*)_data)->return_value
= BScrollView::MinSize();
return B_OK;
case PERFORM_CODE_MAX_SIZE:
((perform_data_max_size*)_data)->return_value
= BScrollView::MaxSize();
return B_OK;
case PERFORM_CODE_PREFERRED_SIZE:
((perform_data_preferred_size*)_data)->return_value
= BScrollView::PreferredSize();
return B_OK;
case PERFORM_CODE_LAYOUT_ALIGNMENT:
((perform_data_layout_alignment*)_data)->return_value
= BScrollView::LayoutAlignment();
return B_OK;
case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
((perform_data_has_height_for_width*)_data)->return_value
= BScrollView::HasHeightForWidth();
return B_OK;
case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
{
perform_data_get_height_for_width* data
= (perform_data_get_height_for_width*)_data;
BScrollView::GetHeightForWidth(data->width, &data->min, &data->max,
&data->preferred);
return B_OK;
}
case PERFORM_CODE_SET_LAYOUT:
{
perform_data_set_layout* data = (perform_data_set_layout*)_data;
BScrollView::SetLayout(data->layout);
return B_OK;
}
case PERFORM_CODE_INVALIDATE_LAYOUT:
{
perform_data_invalidate_layout* data
= (perform_data_invalidate_layout*)_data;
BScrollView::InvalidateLayout(data->descendants);
return B_OK;
}
case PERFORM_CODE_DO_LAYOUT:
{
BScrollView::DoLayout();
return B_OK;
}
}
// changes in width
if (bounds.Width() > fPreviousWidth) {
// invalidate the region between the old and the new right border
BRect rect = bounds;
rect.left += fPreviousWidth - border;
rect.right--;
Invalidate(rect);
} else if (bounds.Width() < fPreviousWidth) {
// invalidate the region of the new right border
BRect rect = bounds;
rect.left = rect.right - border;
Invalidate(rect);
}
// changes in height
if (bounds.Height() > fPreviousHeight) {
// invalidate the region between the old and the new bottom border
BRect rect = bounds;
rect.top += fPreviousHeight - border;
rect.bottom--;
Invalidate(rect);
} else if (bounds.Height() < fPreviousHeight) {
// invalidate the region of the new bottom border
BRect rect = bounds;
rect.top = rect.bottom - border;
Invalidate(rect);
}
fPreviousWidth = uint16(bounds.Width());
fPreviousHeight = uint16(bounds.Height());
return BView::Perform(code, _data);
}
void
BScrollView::ResizeToPreferred()
{
if (Window() == NULL)
return;
BView::ResizeToPreferred();
}
// #pragma mark -
void
BScrollView::GetPreferredSize(float *_width, float *_height)
BScrollView::_Init(bool horizontal, bool vertical)
{
BSize size = PreferredSize();
fHorizontalScrollBar = NULL;
fVerticalScrollBar = NULL;
fHighlighted = false;
if (_width)
*_width = size.width;
if (_height)
*_height = size.height;
if (be_control_look != NULL)
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BRect targetFrame;
if (fTarget) {
// layout target and add it
fTarget->TargetedByScrollView(this);
fTarget->MoveTo(B_ORIGIN);
if (fBorder != B_NO_BORDER)
fTarget->MoveBy(_BorderSize(), _BorderSize());
AddChild(fTarget);
targetFrame = fTarget->Frame();
} else {
// no target specified
targetFrame = Bounds();
if (horizontal)
targetFrame.bottom -= B_H_SCROLL_BAR_HEIGHT + 1;
if (vertical)
targetFrame.right -= B_V_SCROLL_BAR_WIDTH + 1;
if (fBorder == B_FANCY_BORDER) {
targetFrame.bottom--;
targetFrame.right--;
}
}
if (horizontal) {
fHorizontalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_HSB_",
fTarget, 0, 1000, B_HORIZONTAL);
AddChild(fHorizontalScrollBar);
}
if (vertical) {
fVerticalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_VSB_",
fTarget, 0, 1000, B_VERTICAL);
AddChild(fVerticalScrollBar);
}
_AlignScrollBars(horizontal, vertical, targetFrame);
fPreviousWidth = uint16(Bounds().Width());
fPreviousHeight = uint16(Bounds().Height());
}
@ -671,8 +847,8 @@ BScrollView::_ComputeFrame(BRect frame, bool horizontal, bool vertical,
BScrollView::_ComputeFrame(BView *target, bool horizontal, bool vertical,
border_style border)
{
return _ComputeFrame(target != NULL ? target->Frame() : BRect(0, 0, 16, 16),
horizontal, vertical, border);
return _ComputeFrame(target != NULL ? target->Frame()
: BRect(0, 0, 16, 16), horizontal, vertical, border);
}
@ -705,155 +881,7 @@ BScrollView::_ModifyFlags(int32 flags, border_style border)
}
void
BScrollView::WindowActivated(bool active)
{
if (fHighlighted)
Invalidate();
BView::WindowActivated(active);
}
void
BScrollView::MakeFocus(bool state)
{
BView::MakeFocus(state);
}
BHandler*
BScrollView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier,
int32 form, const char* property)
{
return BView::ResolveSpecifier(msg, index, specifier, form, property);
}
status_t
BScrollView::GetSupportedSuites(BMessage *data)
{
return BView::GetSupportedSuites(data);
}
BSize
BScrollView::MinSize()
{
BSize size = _ComputeSize(fTarget != NULL ? fTarget->MinSize()
: BSize(16, 16));
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
}
BSize
BScrollView::MaxSize()
{
BSize size = _ComputeSize(fTarget != NULL ? fTarget->MaxSize()
: BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
}
BSize
BScrollView::PreferredSize()
{
BSize size = _ComputeSize(fTarget != NULL ? fTarget->PreferredSize()
: BSize(32, 32));
return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size);
}
void
BScrollView::InvalidateLayout(bool descendants)
{
BView::InvalidateLayout(descendants);
}
void
BScrollView::DoLayout()
{
if (!(Flags() & B_SUPPORTS_LAYOUT))
return;
// If the user set a layout, we let the base class version call its hook.
if (GetLayout()) {
BView::DoLayout();
return;
}
BRect innerFrame = _InnerFrame();
if (fTarget != NULL) {
fTarget->MoveTo(innerFrame.left, innerFrame.top);
fTarget->ResizeTo(innerFrame.Width(), innerFrame.Height());
//BLayoutUtils::AlignInFrame(fTarget, fTarget->Bounds());
}
_AlignScrollBars(fHorizontalScrollBar != NULL, fVerticalScrollBar != NULL,
innerFrame);
}
status_t
BScrollView::Perform(perform_code code, void* _data)
{
switch (code) {
case PERFORM_CODE_MIN_SIZE:
((perform_data_min_size*)_data)->return_value
= BScrollView::MinSize();
return B_OK;
case PERFORM_CODE_MAX_SIZE:
((perform_data_max_size*)_data)->return_value
= BScrollView::MaxSize();
return B_OK;
case PERFORM_CODE_PREFERRED_SIZE:
((perform_data_preferred_size*)_data)->return_value
= BScrollView::PreferredSize();
return B_OK;
case PERFORM_CODE_LAYOUT_ALIGNMENT:
((perform_data_layout_alignment*)_data)->return_value
= BScrollView::LayoutAlignment();
return B_OK;
case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
((perform_data_has_height_for_width*)_data)->return_value
= BScrollView::HasHeightForWidth();
return B_OK;
case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
{
perform_data_get_height_for_width* data
= (perform_data_get_height_for_width*)_data;
BScrollView::GetHeightForWidth(data->width, &data->min, &data->max,
&data->preferred);
return B_OK;
}
case PERFORM_CODE_SET_LAYOUT:
{
perform_data_set_layout* data = (perform_data_set_layout*)_data;
BScrollView::SetLayout(data->layout);
return B_OK;
}
case PERFORM_CODE_INVALIDATE_LAYOUT:
{
perform_data_invalidate_layout* data
= (perform_data_invalidate_layout*)_data;
BScrollView::InvalidateLayout(data->descendants);
return B_OK;
}
case PERFORM_CODE_DO_LAYOUT:
{
BScrollView::DoLayout();
return B_OK;
}
}
return BView::Perform(code, _data);
}
// #pragma mark -
BScrollView &
@ -863,22 +891,6 @@ BScrollView::operator=(const BScrollView &)
}
/** Although BScrollView::InitObject() was defined in the original ScrollView.h,
* it is not exported by the R5 libbe.so, so we don't have to export it as well.
*/
#if 0
void
BScrollView::InitObject()
{
}
#endif
// #pragma mark -
// Reserved virtuals
void BScrollView::_ReservedScrollView1() {}
void BScrollView::_ReservedScrollView2() {}
void BScrollView::_ReservedScrollView3() {}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2008, Haiku. All Rights Reserved.
* Copyright 2001-2008, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -28,8 +28,9 @@ static const rgb_color kDefaultBarColor = {50, 150, 255, 255};
BStatusBar::BStatusBar(BRect frame, const char *name, const char *label,
const char *trailingLabel)
: BView(frame, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW),
const char *trailingLabel)
:
BView(frame, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW),
fLabel(label),
fTrailingLabel(trailingLabel)
{
@ -38,9 +39,10 @@ BStatusBar::BStatusBar(BRect frame, const char *name, const char *label,
BStatusBar::BStatusBar(const char *name, const char *label,
const char *trailingLabel)
: BView(BRect(0, 0, -1, -1), name, B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_SUPPORTS_LAYOUT),
const char *trailingLabel)
:
BView(BRect(0, 0, -1, -1), name, B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_SUPPORTS_LAYOUT),
fLabel(label),
fTrailingLabel(trailingLabel)
{
@ -49,7 +51,8 @@ BStatusBar::BStatusBar(const char *name, const char *label,
BStatusBar::BStatusBar(BMessage *archive)
: BView(archive)
:
BView(archive)
{
_InitObject();
@ -81,22 +84,6 @@ BStatusBar::~BStatusBar()
}
void
BStatusBar::_InitObject()
{
fMax = 100.0;
fCurrent = 0.0;
fBarHeight = -1.0;
fTextDivider = Bounds().Width();
fBarColor = kDefaultBarColor;
fCustomBarHeight = false;
SetFlags(Flags() | B_FRAME_EVENTS);
}
BArchivable *
BStatusBar::Instantiate(BMessage *archive)
{
@ -139,6 +126,9 @@ BStatusBar::Archive(BMessage *archive, bool deep) const
}
// #pragma mark -
void
BStatusBar::AttachedToWindow()
{
@ -164,42 +154,124 @@ BStatusBar::AttachedToWindow()
void
BStatusBar::MessageReceived(BMessage *message)
BStatusBar::DetachedFromWindow()
{
switch(message->what) {
case B_UPDATE_STATUS_BAR:
{
float delta;
const char *text = NULL, *trailing_text = NULL;
BView::DetachedFromWindow();
}
message->FindFloat("delta", &delta);
message->FindString("text", &text);
message->FindString("trailing_text", &trailing_text);
Update(delta, text, trailing_text);
void
BStatusBar::AllAttached()
{
BView::AllAttached();
}
break;
}
case B_RESET_STATUS_BAR:
{
const char *label = NULL, *trailing_label = NULL;
void
BStatusBar::AllDetached()
{
BView::AllDetached();
}
message->FindString("label", &label);
message->FindString("trailing_label", &trailing_label);
Reset(label, trailing_label);
// #pragma mark -
break;
}
default:
BView::MessageReceived(message);
break;
void
BStatusBar::WindowActivated(bool state)
{
BView::WindowActivated(state);
}
void
BStatusBar::MakeFocus(bool state)
{
BView::MakeFocus(state);
}
// #pragma mark -
void
BStatusBar::GetPreferredSize(float* _width, float* _height)
{
if (_width) {
// AttachedToWindow() might not have been called yet
*_width = ceilf(StringWidth(fLabel.String()))
+ ceilf(StringWidth(fTrailingLabel.String()))
+ ceilf(StringWidth(fText.String()))
+ ceilf(StringWidth(fTrailingText.String()))
+ 5;
}
if (_height) {
font_height fontHeight;
GetFontHeight(&fontHeight);
*_height = ceilf(fontHeight.ascent + fontHeight.descent) + 6
+ BarHeight();
}
}
BSize
BStatusBar::MinSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height));
}
BSize
BStatusBar::MaxSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
BSize(B_SIZE_UNLIMITED, height));
}
BSize
BStatusBar::PreferredSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height));
}
void
BStatusBar::ResizeToPreferred()
{
BView::ResizeToPreferred();
}
void
BStatusBar::FrameMoved(BPoint newPosition)
{
BView::FrameMoved(newPosition);
}
void
BStatusBar::FrameResized(float newWidth, float newHeight)
{
BView::FrameResized(newWidth, newHeight);
Invalidate();
}
// #pragma mark -
void
BStatusBar::Draw(BRect updateRect)
{
@ -321,6 +393,67 @@ BStatusBar::Draw(BRect updateRect)
}
void
BStatusBar::MessageReceived(BMessage *message)
{
switch(message->what) {
case B_UPDATE_STATUS_BAR:
{
float delta;
const char *text = NULL, *trailing_text = NULL;
message->FindFloat("delta", &delta);
message->FindString("text", &text);
message->FindString("trailing_text", &trailing_text);
Update(delta, text, trailing_text);
break;
}
case B_RESET_STATUS_BAR:
{
const char *label = NULL, *trailing_label = NULL;
message->FindString("label", &label);
message->FindString("trailing_label", &trailing_label);
Reset(label, trailing_label);
break;
}
default:
BView::MessageReceived(message);
break;
}
}
void
BStatusBar::MouseDown(BPoint point)
{
BView::MouseDown(point);
}
void
BStatusBar::MouseUp(BPoint point)
{
BView::MouseUp(point);
}
void
BStatusBar::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
{
BView::MouseMoved(point, transit, message);
}
// #pragma mark -
void
BStatusBar::SetBarColor(rgb_color color)
{
@ -385,6 +518,26 @@ BStatusBar::Update(float delta, const char* text, const char* trailingText)
}
void
BStatusBar::Reset(const char *label, const char *trailingLabel)
{
// Reset replaces the label and trailing label with copies of the
// strings passed as arguments. If either argument is NULL, the
// label or trailing label will be deleted and erased.
fLabel = label ? label : "";
fTrailingLabel = trailingLabel ? trailingLabel : "";
// Reset deletes and erases any text or trailing text
fText = "";
fTrailingText = "";
fCurrent = 0;
fMax = 100;
Invalidate();
}
void
BStatusBar::SetTo(float value, const char* text, const char* trailingText)
{
@ -425,26 +578,6 @@ BStatusBar::SetTo(float value, const char* text, const char* trailingText)
}
void
BStatusBar::Reset(const char *label, const char *trailingLabel)
{
// Reset replaces the label and trailing label with copies of the
// strings passed as arguments. If either argument is NULL, the
// label or trailing label will be deleted and erased.
fLabel = label ? label : "";
fTrailingLabel = trailingLabel ? trailingLabel : "";
// Reset deletes and erases any text or trailing text
fText = "";
fTrailingText = "";
fCurrent = 0;
fMax = 100;
Invalidate();
}
float
BStatusBar::CurrentValue() const
{
@ -509,54 +642,7 @@ BStatusBar::TrailingLabel() const
}
void
BStatusBar::MouseDown(BPoint point)
{
BView::MouseDown(point);
}
void
BStatusBar::MouseUp(BPoint point)
{
BView::MouseUp(point);
}
void
BStatusBar::WindowActivated(bool state)
{
BView::WindowActivated(state);
}
void
BStatusBar::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
{
BView::MouseMoved(point, transit, message);
}
void
BStatusBar::DetachedFromWindow()
{
BView::DetachedFromWindow();
}
void
BStatusBar::FrameMoved(BPoint newPosition)
{
BView::FrameMoved(newPosition);
}
void
BStatusBar::FrameResized(float newWidth, float newHeight)
{
BView::FrameResized(newWidth, newHeight);
Invalidate();
}
// #pragma mark -
BHandler *
@ -567,56 +653,6 @@ BStatusBar::ResolveSpecifier(BMessage* message, int32 index,
}
void
BStatusBar::ResizeToPreferred()
{
BView::ResizeToPreferred();
}
void
BStatusBar::GetPreferredSize(float* _width, float* _height)
{
if (_width) {
// AttachedToWindow() might not have been called yet
*_width = ceilf(StringWidth(fLabel.String()))
+ ceilf(StringWidth(fTrailingLabel.String()))
+ ceilf(StringWidth(fText.String()))
+ ceilf(StringWidth(fTrailingText.String()))
+ 5;
}
if (_height) {
font_height fontHeight;
GetFontHeight(&fontHeight);
*_height = ceilf(fontHeight.ascent + fontHeight.descent) + 6
+ BarHeight();
}
}
void
BStatusBar::MakeFocus(bool state)
{
BView::MakeFocus(state);
}
void
BStatusBar::AllAttached()
{
BView::AllAttached();
}
void
BStatusBar::AllDetached()
{
BView::AllDetached();
}
status_t
BStatusBar::GetSupportedSuites(BMessage* data)
{
@ -624,37 +660,6 @@ BStatusBar::GetSupportedSuites(BMessage* data)
}
BSize
BStatusBar::MinSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height));
}
BSize
BStatusBar::MaxSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
BSize(B_SIZE_UNLIMITED, height));
}
BSize
BStatusBar::PreferredSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height));
}
status_t
BStatusBar::Perform(perform_code code, void* _data)
{
@ -686,7 +691,7 @@ BStatusBar::Perform(perform_code code, void* _data)
BStatusBar::GetHeightForWidth(data->width, &data->min, &data->max,
&data->preferred);
return B_OK;
}
}
case PERFORM_CODE_SET_LAYOUT:
{
perform_data_set_layout* data = (perform_data_set_layout*)_data;
@ -711,6 +716,9 @@ BStatusBar::Perform(perform_code code, void* _data)
}
// #pragma mark -
extern "C" void
_ReservedStatusBar1__10BStatusBar(BStatusBar* self, float value,
const char* text, const char* trailingText)
@ -731,6 +739,25 @@ BStatusBar::operator=(const BStatusBar& other)
}
// #pragma mark -
void
BStatusBar::_InitObject()
{
fMax = 100.0;
fCurrent = 0.0;
fBarHeight = -1.0;
fTextDivider = Bounds().Width();
fBarColor = kDefaultBarColor;
fCustomBarHeight = false;
SetFlags(Flags() | B_FRAME_EVENTS);
}
void
BStatusBar::_SetTextData(BString& text, const char* source,
const BString& combineWith, bool rightAligned)

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2008, Haiku Inc. All rights reserved.
* Copyright 2001-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -64,6 +64,12 @@ BStringView::BStringView(BMessage* data)
}
BStringView::~BStringView()
{
free(fText);
}
BArchivable*
BStringView::Instantiate(BMessage* data)
{
@ -89,12 +95,199 @@ BStringView::Archive(BMessage* data, bool deep) const
}
BStringView::~BStringView()
// #pragma mark -
void
BStringView::AttachedToWindow()
{
free(fText);
rgb_color color = B_TRANSPARENT_COLOR;
BView* parent = Parent();
if (parent != NULL)
color = parent->ViewColor();
if (color == B_TRANSPARENT_COLOR)
color = ui_color(B_PANEL_BACKGROUND_COLOR);
SetViewColor(color);
}
void
BStringView::DetachedFromWindow()
{
BView::DetachedFromWindow();
}
void
BStringView::AllAttached()
{
BView::AllAttached();
}
void
BStringView::AllDetached()
{
BView::AllDetached();
}
// #pragma mark -
void
BStringView::MakeFocus(bool state)
{
BView::MakeFocus(state);
}
void
BStringView::GetPreferredSize(float* _width, float* _height)
{
_ValidatePreferredSize();
if (_width)
*_width = fPreferredSize.width;
if (_height)
*_height = fPreferredSize.height;
}
BSize
BStringView::MinSize()
{
return BLayoutUtils::ComposeSize(ExplicitMinSize(),
_ValidatePreferredSize());
}
BSize
BStringView::MaxSize()
{
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
_ValidatePreferredSize());
}
BSize
BStringView::PreferredSize()
{
return BLayoutUtils::ComposeSize(ExplicitPreferredSize(),
_ValidatePreferredSize());
}
void
BStringView::InvalidateLayout(bool descendants)
{
// invalidate cached preferred size
fPreferredSize.Set(-1, -1);
BView::InvalidateLayout(descendants);
}
void
BStringView::ResizeToPreferred()
{
float width, height;
GetPreferredSize(&width, &height);
// Resize the width only for B_ALIGN_LEFT (if its large enough already, that is)
if (Bounds().Width() > width && Alignment() != B_ALIGN_LEFT)
width = Bounds().Width();
BView::ResizeTo(width, height);
}
void
BStringView::FrameMoved(BPoint newPosition)
{
BView::FrameMoved(newPosition);
}
void
BStringView::FrameResized(float newWidth, float newHeight)
{
BView::FrameResized(newWidth, newHeight);
}
// #pragma mark -
void
BStringView::Draw(BRect updateRect)
{
if (!fText)
return;
SetLowColor(ViewColor());
font_height fontHeight;
GetFontHeight(&fontHeight);
BRect bounds = Bounds();
float y = (bounds.top + bounds.bottom - ceilf(fontHeight.ascent)
- ceilf(fontHeight.descent)) / 2.0 + ceilf(fontHeight.ascent);
float x;
switch (fAlign) {
case B_ALIGN_RIGHT:
x = bounds.Width() - StringWidth(fText);
break;
case B_ALIGN_CENTER:
x = (bounds.Width() - StringWidth(fText)) / 2.0;
break;
default:
x = 0.0;
break;
}
DrawString(fText, BPoint(x, y));
}
void
BStringView::MessageReceived(BMessage* message)
{
BView::MessageReceived(message);
}
void
BStringView::MouseDown(BPoint point)
{
BView::MouseDown(point);
}
void
BStringView::MouseUp(BPoint point)
{
BView::MouseUp(point);
}
void
BStringView::MouseMoved(BPoint point, uint32 transit, const BMessage* msg)
{
BView::MouseMoved(point, transit, msg);
}
// #pragma mark -
void
BStringView::SetText(const char* text)
{
@ -131,132 +324,6 @@ BStringView::Alignment() const
}
void
BStringView::AttachedToWindow()
{
rgb_color color = B_TRANSPARENT_COLOR;
BView* parent = Parent();
if (parent != NULL)
color = parent->ViewColor();
if (color == B_TRANSPARENT_COLOR)
color = ui_color(B_PANEL_BACKGROUND_COLOR);
SetViewColor(color);
}
void
BStringView::Draw(BRect updateRect)
{
if (!fText)
return;
SetLowColor(ViewColor());
font_height fontHeight;
GetFontHeight(&fontHeight);
BRect bounds = Bounds();
float y = (bounds.top + bounds.bottom - ceilf(fontHeight.ascent)
- ceilf(fontHeight.descent)) / 2.0 + ceilf(fontHeight.ascent);
float x;
switch (fAlign) {
case B_ALIGN_RIGHT:
x = bounds.Width() - StringWidth(fText);
break;
case B_ALIGN_CENTER:
x = (bounds.Width() - StringWidth(fText)) / 2.0;
break;
default:
x = 0.0;
break;
}
DrawString(fText, BPoint(x, y));
}
void
BStringView::ResizeToPreferred()
{
float width, height;
GetPreferredSize(&width, &height);
// Resize the width only for B_ALIGN_LEFT (if its large enough already, that is)
if (Bounds().Width() > width && Alignment() != B_ALIGN_LEFT)
width = Bounds().Width();
BView::ResizeTo(width, height);
}
void
BStringView::GetPreferredSize(float* _width, float* _height)
{
_ValidatePreferredSize();
if (_width)
*_width = fPreferredSize.width;
if (_height)
*_height = fPreferredSize.height;
}
void
BStringView::MessageReceived(BMessage* message)
{
BView::MessageReceived(message);
}
void
BStringView::MouseDown(BPoint point)
{
BView::MouseDown(point);
}
void
BStringView::MouseUp(BPoint point)
{
BView::MouseUp(point);
}
void
BStringView::MouseMoved(BPoint point, uint32 transit, const BMessage* msg)
{
BView::MouseMoved(point, transit, msg);
}
void
BStringView::DetachedFromWindow()
{
BView::DetachedFromWindow();
}
void
BStringView::FrameMoved(BPoint newPosition)
{
BView::FrameMoved(newPosition);
}
void
BStringView::FrameResized(float newWidth, float newHeight)
{
BView::FrameResized(newWidth, newHeight);
}
BHandler*
BStringView::ResolveSpecifier(BMessage* msg, int32 index,
BMessage* specifier, int32 form, const char* property)
@ -265,27 +332,6 @@ BStringView::ResolveSpecifier(BMessage* msg, int32 index,
}
void
BStringView::MakeFocus(bool state)
{
BView::MakeFocus(state);
}
void
BStringView::AllAttached()
{
BView::AllAttached();
}
void
BStringView::AllDetached()
{
BView::AllDetached();
}
status_t
BStringView::GetSupportedSuites(BMessage* message)
{
@ -303,38 +349,7 @@ BStringView::SetFont(const BFont* font, uint32 mask)
}
void
BStringView::InvalidateLayout(bool descendants)
{
// invalidate cached preferred size
fPreferredSize.Set(-1, -1);
BView::InvalidateLayout(descendants);
}
BSize
BStringView::MinSize()
{
return BLayoutUtils::ComposeSize(ExplicitMinSize(),
_ValidatePreferredSize());
}
BSize
BStringView::MaxSize()
{
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
_ValidatePreferredSize());
}
BSize
BStringView::PreferredSize()
{
return BLayoutUtils::ComposeSize(ExplicitPreferredSize(),
_ValidatePreferredSize());
}
// #pragma mark -
status_t
@ -406,6 +421,10 @@ BStringView::operator=(const BStringView&)
return *this;
}
// #pragma mark -
BSize
BStringView::_ValidatePreferredSize()
{

View File

@ -1,6 +1,6 @@
/*
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
* Distributed under the terms of the MIT License.
*
* Authors:
* Marc Flerackers (mflerackers@androme.be)
@ -382,7 +382,7 @@ BTab &BTab::operator=(const BTab &)
}
// #pragma mark -
// #pragma mark - BTabView
BTabView::BTabView(const char *name, button_width width, uint32 flags)
@ -523,16 +523,6 @@ BTabView::Perform(perform_code d, void *arg)
}
void
BTabView::WindowActivated(bool active)
{
BView::WindowActivated(active);
if (IsFocus())
Invalidate();
}
void
BTabView::AttachedToWindow()
{
@ -542,6 +532,13 @@ BTabView::AttachedToWindow()
}
void
BTabView::DetachedFromWindow()
{
BView::DetachedFromWindow();
}
void
BTabView::AllAttached()
{
@ -556,11 +553,7 @@ BTabView::AllDetached()
}
void
BTabView::DetachedFromWindow()
{
BView::DetachedFromWindow();
}
// #pragma mark -
void
@ -635,20 +628,6 @@ BTabView::MessageReceived(BMessage *message)
}
void
BTabView::FrameMoved(BPoint newLocation)
{
BView::FrameMoved(newLocation);
}
void
BTabView::FrameResized(float width,float height)
{
BView::FrameResized(width, height);
}
void
BTabView::KeyDown(const char *bytes, int32 numBytes)
{
@ -773,6 +752,16 @@ BTabView::Selection() const
}
void
BTabView::WindowActivated(bool active)
{
BView::WindowActivated(active);
if (IsFocus())
Invalidate();
}
void
BTabView::MakeFocus(bool focused)
{
@ -1060,6 +1049,16 @@ BTabView::SetResizingMode(uint32 mode)
}
// #pragma mark -
void
BTabView::ResizeToPreferred()
{
BView::ResizeToPreferred();
}
void
BTabView::GetPreferredSize(float *width, float *height)
{
@ -1104,12 +1103,22 @@ BTabView::PreferredSize()
void
BTabView::ResizeToPreferred()
BTabView::FrameMoved(BPoint newLocation)
{
BView::ResizeToPreferred();
BView::FrameMoved(newLocation);
}
void
BTabView::FrameResized(float width,float height)
{
BView::FrameResized(width, height);
}
// #pragma mark -
BHandler *
BTabView::ResolveSpecifier(BMessage *message, int32 index,
BMessage *specifier, int32 what, const char *property)
@ -1136,6 +1145,9 @@ BTabView::GetSupportedSuites(BMessage *message)
}
// #pragma mark -
void
BTabView::AddTab(BView *target, BTab *tab)
{