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
+1 -1
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
+1 -4
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 ([email protected])
*/
#ifndef _ALERT_H
#define _ALERT_H
+1 -1
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
+1 -4
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 ([email protected])
*/
#ifndef _BITMAP_H
#define _BITMAP_H
+2 -6
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 <[email protected]>
* Stephan Aßmus <[email protected]>
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _BUTTON_H
#define _BUTTON_H
+1 -1
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
+2 -2
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
+2 -2
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
+2 -2
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
+1 -1
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
+5 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009, Stephan Aßmus <[email protected]>
* 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 {
+2 -2
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
+2 -2
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
+2 -2
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_
+2 -2
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
+2 -2
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
+2 -2
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
+2 -2
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
+2 -2
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
+2 -2
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
+1 -1
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
+1 -1
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
+1 -1
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
+1 -1
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
+1 -1
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
+1 -1
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
+1 -1
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
+2 -2
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
+2 -5
View File
@@ -1,9 +1,6 @@
/*
* Copyright (c) 2001-2008, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
* Erik Jaesler ([email protected])
* Copyright 2001-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _INTERFACE_DEFS_H
#define _INTERFACE_DEFS_H
+1 -1
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
+1 -1
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
+1 -1
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
+1 -1
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
+1 -1
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
+1 -1
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
+1 -1
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
+2 -2
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
+2 -2
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
+2 -2
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
+15 -11
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,15 +16,17 @@ class BWindow;
class BMenuItem : public BArchivable, public BInvoker {
public:
public:
BMenuItem(const char* label, BMessage* message,
char shortcut = 0, uint32 modifiers = 0);
BMenuItem(BMenu* menu, BMessage* message = NULL);
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;
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void SetLabel(const char* name);
virtual void SetEnabled(bool enabled);
@@ -42,7 +44,7 @@ class BMenuItem : public BArchivable, public BInvoker {
BMenu* Menu() const;
BRect Frame() const;
protected:
protected:
virtual void GetContentSize(float* _width, float* _height);
virtual void TruncateLabel(float maxWidth, char* newLabel);
virtual void DrawContent();
@@ -51,7 +53,7 @@ class BMenuItem : public BArchivable, public BInvoker {
bool IsSelected() const;
BPoint ContentLocation() const;
private:
private:
friend class BMenu;
friend class BPopUpMenu;
friend class BMenuBar;
@@ -65,12 +67,13 @@ class BMenuItem : public BArchivable, public BInvoker {
void Uninstall();
void SetSuper(BMenu* superMenu);
void Select(bool select);
void SetAutomaticTrigger(int32 index, uint32 trigger);
void SetAutomaticTrigger(int32 index,
uint32 trigger);
protected:
virtual status_t Invoke(BMessage *msg = NULL);
protected:
virtual status_t Invoke(BMessage* message = NULL);
private:
private:
BMenuItem(const BMenuItem& other);
BMenuItem& operator=(const BMenuItem& other);
@@ -82,6 +85,7 @@ class BMenuItem : public BArchivable, public BInvoker {
void _DrawSubmenuSymbol(rgb_color backgroundColor);
void _DrawControlChar(char shortcut, BPoint where);
private:
char* fLabel;
BMenu* fSubmenu;
BWindow* fWindow;
@@ -104,4 +108,4 @@ class BMenuItem : public BArchivable, public BInvoker {
// compatibility we're exporting that class from here too.
#include <SeparatorItem.h>
#endif /* _MENU_ITEM_H */
#endif // _MENU_ITEM_H
+2 -2
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
+2 -2
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
+2 -2
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
+2 -2
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
+2 -3
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>
+2 -2
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
+32 -31
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;
BPoint();
BPoint(float X, float Y);
BPoint(const BPoint &p);
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 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& 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
+2 -2
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
+29 -31
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,20 +13,22 @@
class BRect {
public:
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(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;
@@ -39,38 +37,38 @@ class BRect {
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);
// Transformation
void InsetBy(BPoint inset);
void InsetBy(float dx, float dy);
void OffsetBy(BPoint p);
void OffsetBy(BPoint delta);
void OffsetBy(float dx, float dy);
void OffsetTo(BPoint p);
void OffsetTo(BPoint offset);
void OffsetTo(float x, float y);
// expression transformations
BRect& InsetBySelf(BPoint);
// Expression transformations
BRect& InsetBySelf(BPoint inset);
BRect& InsetBySelf(float dx, float dy);
BRect InsetByCopy(BPoint);
BRect InsetByCopy(BPoint inset);
BRect InsetByCopy(float dx, float dy);
BRect& OffsetBySelf(BPoint);
BRect& OffsetBySelf(BPoint offset);
BRect& OffsetBySelf(float dx, float dy);
BRect OffsetByCopy(BPoint);
BRect OffsetByCopy(BPoint offset);
BRect OffsetByCopy(float dx, float dy);
BRect& OffsetToSelf(BPoint);
BRect& OffsetToSelf(BPoint offset);
BRect& OffsetToSelf(float dx, float dy);
BRect OffsetToCopy(BPoint);
BRect OffsetToCopy(BPoint offset);
BRect OffsetToCopy(float dx, float dy);
// comparison
// Comparison
bool operator==(BRect r) const;
bool operator!=(BRect r) const;
// intersection and union
// Intersection and union
BRect operator&(BRect r) const;
BRect operator|(BRect r) const;
@@ -87,7 +85,7 @@ class BRect {
};
// 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;
+1 -1
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.
*/
+33 -21
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,8 +19,9 @@ namespace BPrivate {
class BPrivateScreen;
}
class BScreen {
public:
public:
BScreen(screen_id id = B_MAIN_SCREEN_ID);
BScreen(BWindow* window);
~BScreen();
@@ -36,53 +37,64 @@ class BScreen {
status_t WaitForRetrace(bigtime_t timeout);
uint8 IndexForColor(rgb_color color);
uint8 IndexForColor(uint8 red, uint8 green, uint8 blue,
uint8 alpha = 255);
uint8 IndexForColor(uint8 red, uint8 green,
uint8 blue, uint8 alpha = 255);
rgb_color ColorForIndex(uint8 index);
uint8 InvertIndex(uint8 index);
const color_map* ColorMap();
status_t GetBitmap(BBitmap** _bitmap, bool drawCursor = true,
status_t GetBitmap(BBitmap** _bitmap,
bool drawCursor = true,
BRect* frame = NULL);
status_t ReadBitmap(BBitmap* bitmap, bool drawCursor = true,
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,
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,
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,
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 GetPixelClockLimits(display_mode* mode,
uint32* low, uint32* high);
status_t GetTimingConstraints(
display_timing_constraints* timingConstraints);
display_timing_constraints*
timingConstraints);
status_t SetDPMS(uint32 state);
uint32 DPMSState();
uint32 DPMSCapabilites();
private:
BScreen& operator=(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);
const display_mode* low,
const display_mode* high);
void* BaseAddress();
uint32 BytesPerRow();
private:
BPrivate::BPrivateScreen* fScreen;
};
+12 -14
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;
+46 -41
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
@@ -21,17 +21,46 @@ public:
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);
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;
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void Draw(BRect updateRect);
virtual void AttachedToWindow();
virtual void WindowActivated(bool active);
virtual void MakeFocus(bool state = true);
virtual void GetPreferredSize(float* _width,
float* _height);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void ResizeToPreferred();
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 MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 code,
const BMessage* dragMessage);
// BScrollView
BScrollBar* ScrollBar(orientation posture) const;
virtual void SetBorder(border_style border);
@@ -43,44 +72,16 @@ public:
void SetTarget(BView* target);
BView* Target() const;
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint point);
virtual void WindowActivated(bool active);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 code,
const BMessage* dragMessage);
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void FrameMoved(BPoint position);
virtual void FrameResized(float width, float height);
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form,
const char* property);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float* _width, float* _height);
virtual void MakeFocus(bool state = true);
// Scripting
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void InvalidateLayout(bool descendants = false);
virtual void DoLayout();
// private or reserved methods are following
virtual status_t Perform(perform_code d, void* arg);
private:
friend class BView;
// FBC padding and forbidden methods
virtual void _ReservedScrollView1();
virtual void _ReservedScrollView2();
virtual void _ReservedScrollView3();
@@ -88,13 +89,16 @@ private:
BScrollView& operator=(const BScrollView& other);
private:
friend class BView;
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);
void _AlignScrollBars(bool horizontal,
bool vertical, BRect targetFrame);
static BRect _ComputeFrame(BRect frame, bool horizontal,
bool vertical, border_style border);
@@ -103,6 +107,7 @@ private:
static float _BorderSize(border_style border);
static int32 _ModifyFlags(int32 flags, border_style border);
private:
BView* fTarget;
BScrollBar* fHorizontalScrollBar;
BScrollBar* fVerticalScrollBar;
@@ -114,4 +119,4 @@ private:
uint32 _reserved[3];
};
#endif /* _SCROLL_VIEW_H */
#endif // _SCROLL_VIEW_H
+13 -9
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);
BSeparatorItem(BMessage* archive);
virtual ~BSeparatorItem();
virtual status_t Archive(BMessage *data, bool deep = true) const;
static BArchivable *Instantiate(BMessage *data);
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 GetContentSize(float* _width, float* _height);
virtual void Draw();
private:
// FBC padding, reserved and forbidden
virtual void _ReservedSeparatorItem1();
virtual void _ReservedSeparatorItem2();
BSeparatorItem &operator=(const BSeparatorItem &);
BSeparatorItem& operator=(const BSeparatorItem& other);
uint32 _reserved[1];
};
#endif /* _SEPARATOR_ITEM_H */
#endif // _SEPARATOR_ITEM_H
+6 -4
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;
+23 -13
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
@@ -24,12 +24,14 @@ public:
BShapeIterator();
virtual ~BShapeIterator();
virtual status_t IterateMoveTo(BPoint *point);
virtual status_t IterateLineTo(int32 lineCount, BPoint *linePts);
virtual status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPts);
virtual status_t 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();
@@ -44,17 +46,18 @@ private:
class BShape : public BArchivable {
public:
BShape();
BShape(const BShape &copyFrom);
BShape(BMessage *data);
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;
status_t AddShape(const BShape *other);
status_t AddShape(const BShape* other);
status_t MoveTo(BPoint point);
status_t LineTo(BPoint linePoint);
@@ -62,28 +65,35 @@ public:
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();
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 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);
private:
uint32 fState;
uint32 fBuildingOp;
void* fPrivateData;
uint32 reserved[4];
};
+59 -40
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,29 +26,34 @@ 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,
public:
BShelf(BView* view, bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BDataIO* stream, BView* view, bool allowDrags = true,
BShelf(const entry_ref* ref, BView* view,
bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BMessage *data);
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);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void MessageReceived(BMessage *msg);
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 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);
virtual status_t Perform(perform_code code, void* data);
bool AllowsDragging() const;
void SetAllowsDragging(bool state);
bool AllowsZombies() const;
@@ -56,34 +63,36 @@ class BShelf : public BHandler {
bool IsTypeEnforced() const;
void SetTypeEnforced(bool state);
status_t SetSaveLocation(BDataIO *data_io);
status_t SetSaveLocation(const entry_ref *ref);
BDataIO* SaveLocation(entry_ref *ref) const;
status_t SetSaveLocation(BDataIO* stream);
status_t SetSaveLocation(const entry_ref* ref);
BDataIO* SaveLocation(entry_ref* ref) const;
status_t AddReplicant(BMessage *data, BPoint location);
status_t DeleteReplicant(BView *replicant);
status_t DeleteReplicant(BMessage *data);
status_t 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;
BMessage* ReplicantAt(int32 index, BView** view = NULL,
uint32* uid = NULL,
status_t* perr = NULL) const;
int32 IndexOf(const BView* replicantView) const;
int32 IndexOf(const BMessage* archive) const;
int32 IndexOf(uint32 id) const;
protected:
virtual bool CanAcceptReplicantMessage(BMessage*) const;
virtual bool CanAcceptReplicantView(BRect, BView*, BMessage*) const;
protected:
virtual bool CanAcceptReplicantMessage(
BMessage* archive) const;
virtual bool CanAcceptReplicantView(BRect,
BView*, BMessage*) const;
virtual BPoint AdjustReplicantBy(BRect, BMessage*) const;
virtual void ReplicantDeleted(int32 index, const BMessage *archive,
virtual void ReplicantDeleted(int32 index,
const BMessage* archive,
const BView *replicant);
private:
friend class BPrivate::ShelfContainerViewFilter;
private:
// FBC padding and forbidden methods
virtual void _ReservedShelf2();
virtual void _ReservedShelf3();
virtual void _ReservedShelf4();
@@ -95,22 +104,32 @@ class BShelf : public BHandler {
BShelf(const BShelf& other);
BShelf& operator=(const BShelf& other);
private:
friend class BPrivate::ShelfContainerViewFilter;
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 _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);
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);
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:
private:
BView* fContainerView;
BDataIO* fStream;
BEntry* fEntry;
+1 -16
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)
{
+17 -15
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;
+1 -1
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
+1 -1
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
+9 -6
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;
+28 -25
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();
+7 -3
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
@@ -12,12 +12,14 @@
class BStringItem : public BListItem {
public:
BStringItem(const char* text,
uint32 outlineLevel = 0, bool expanded = true);
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;
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void DrawItem(BView* owner, BRect frame,
bool complete = false);
@@ -29,12 +31,14 @@ public:
virtual status_t Perform(perform_code code, void* arg);
private:
// FBC padding and forbidden methods
virtual void _ReservedStringItem1();
virtual void _ReservedStringItem2();
BStringItem(const BStringItem& item);
BStringItem& operator=(const BStringItem& item);
private:
char* fText;
float fBaselineOffset;
uint32 _reserved[2];
+35 -30
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,18 +11,19 @@
class BStringView : public BView{
public:
public:
BStringView(BRect bounds, const char* name,
const char* text,
uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP,
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);
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;
@@ -33,6 +31,22 @@ class BStringView : public BView{
alignment Alignment() const;
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void MakeFocus(bool state = true);
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 Draw(BRect bounds);
virtual void MessageReceived(BMessage* message);
@@ -40,43 +54,34 @@ class BStringView : public BView{
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 BHandler* ResolveSpecifier(BMessage* msg, int32 index,
BMessage* specifier, int32 form,
const char* property);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float* _width, float* _height);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual void SetFont(const BFont* font,
uint32 mask = B_FONT_ALL);
virtual void InvalidateLayout(bool descendants = false);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
private:
// FBC padding and forbidden methods
virtual status_t Perform(perform_code code, void* data);
private:
virtual status_t Perform(perform_code d, void* arg);
virtual void _ReservedStringView1();
virtual void _ReservedStringView2();
virtual void _ReservedStringView3();
BStringView& operator=(const BStringView& other);
private:
BSize _ValidatePreferredSize();
BStringView &operator=(const BStringView&);
private:
char* fText;
alignment fAlign;
BSize fPreferredSize;
uint32 _reserved[1];
};
+21 -14
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;
+20 -15
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();
+37 -28
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;
+2 -1
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;
+1 -4
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
+97 -72
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:
* Erik Jaesler (erik@cgsoftware.com)
*/
#ifndef _VIEW_H
#define _VIEW_H
@@ -45,7 +42,7 @@ enum {
B_LOCK_WINDOW_FOCUS = 0x00000001,
B_SUSPEND_VIEW_FOCUS = 0x00000002,
B_NO_POINTER_HISTORY = 0x00000004,
// new in Haiku (unless this flag is
// NOTE: New in Haiku (unless this flag is
// specified, both BWindow and BView::GetMouse()
// will filter out older mouse moved messages)
B_FULL_POINTER_HISTORY = 0x00000008
@@ -97,7 +94,8 @@ inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4)
{ return ((r1 << 12) | (r2 << 8) | (r3 << 4) | r4); }
#define B_FOLLOW_NONE 0
#define B_FOLLOW_ALL_SIDES _rule_(_VIEW_TOP_, _VIEW_LEFT_, _VIEW_BOTTOM_, _VIEW_RIGHT_)
#define B_FOLLOW_ALL_SIDES _rule_(_VIEW_TOP_, _VIEW_LEFT_, _VIEW_BOTTOM_, \
_VIEW_RIGHT_)
#define B_FOLLOW_ALL B_FOLLOW_ALL_SIDES
#define B_FOLLOW_LEFT _rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_)
@@ -143,16 +141,17 @@ public:
uint32 resizeMask, uint32 flags);
virtual ~BView();
BView(BMessage* data);
static BArchivable* Instantiate(BMessage* data);
virtual status_t Archive(BMessage* data, bool deep = true) const;
BView(BMessage* archive);
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void DetachedFromWindow();
virtual void AllDetached();
virtual void MessageReceived(BMessage* msg);
virtual void MessageReceived(BMessage* message);
void AddChild(BView* child, BView* before = NULL);
bool AddChild(BLayoutItem* child);
@@ -275,7 +274,8 @@ public:
uchar a = 255);
rgb_color LowColor() const;
void SetLineMode(cap_mode lineCap, join_mode lineJoin,
void SetLineMode(cap_mode lineCap,
join_mode lineJoin,
float miterLimit = B_DEFAULT_MITER_LIMIT);
join_mode LineJoinMode() const;
cap_mode LineCapMode() const;
@@ -292,7 +292,8 @@ public:
void MovePenTo(float x, float y);
void MovePenBy(float x, float y);
BPoint PenLocation() const;
void StrokeLine(BPoint toPt, pattern p = B_SOLID_HIGH);
void StrokeLine(BPoint toPt,
pattern p = B_SOLID_HIGH);
void StrokeLine(BPoint a, BPoint b,
pattern p = B_SOLID_HIGH);
void BeginLineArray(int32 count);
@@ -300,37 +301,45 @@ public:
void EndLineArray();
void StrokePolygon(const BPolygon* polygon,
bool closed = true, pattern p = B_SOLID_HIGH);
void StrokePolygon(const BPoint* ptArray, int32 numPts,
bool closed = true, pattern p = B_SOLID_HIGH);
void StrokePolygon(const BPoint* ptArray, int32 numPts,
BRect bounds, bool closed = true,
bool closed = true,
pattern p = B_SOLID_HIGH);
void StrokePolygon(const BPoint* ptArray,
int32 numPts, bool closed = true,
pattern p = B_SOLID_HIGH);
void StrokePolygon(const BPoint* ptArray,
int32 numPts, BRect bounds,
bool closed = true,
pattern p = B_SOLID_HIGH);
void FillPolygon(const BPolygon* polygon,
pattern p = B_SOLID_HIGH);
void FillPolygon(const BPoint* ptArray, int32 numPts,
void FillPolygon(const BPoint* ptArray,
int32 numPts, pattern p = B_SOLID_HIGH);
void FillPolygon(const BPoint* ptArray,
int32 numPts, BRect bounds,
pattern p = B_SOLID_HIGH);
void FillPolygon(const BPoint* ptArray, int32 numPts,
BRect bounds, pattern p = B_SOLID_HIGH);
void FillPolygon(const BPolygon* polygon,
const BGradient& gradient);
void FillPolygon(const BPoint* ptArray, int32 numPts,
void FillPolygon(const BPoint* ptArray,
int32 numPts, const BGradient& gradient);
void FillPolygon(const BPoint* ptArray,
int32 numPts, BRect bounds,
const BGradient& gradient);
void FillPolygon(const BPoint* ptArray, int32 numPts,
BRect bounds, const BGradient& gradient);
void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
BRect bounds, pattern p = B_SOLID_HIGH);
void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
void StrokeTriangle(BPoint pt1, BPoint pt2,
BPoint pt3, BRect bounds,
pattern p = B_SOLID_HIGH);
void FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
void StrokeTriangle(BPoint pt1, BPoint pt2,
BPoint pt3, pattern p = B_SOLID_HIGH);
void FillTriangle(BPoint pt1, BPoint pt2,
BPoint pt3, pattern p = B_SOLID_HIGH);
void FillTriangle(BPoint pt1, BPoint pt2,
BPoint pt3, BRect bounds,
pattern p = B_SOLID_HIGH);
void FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
BRect bounds, pattern p = B_SOLID_HIGH);
void FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
void FillTriangle(BPoint pt1, BPoint pt2,
BPoint pt3, const BGradient& gradient);
void FillTriangle(BPoint pt1, BPoint pt2,
BPoint pt3, BRect bounds,
const BGradient& gradient);
void FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
BRect bounds, const BGradient& gradient);
void StrokeRect(BRect r, pattern p = B_SOLID_HIGH);
void FillRect(BRect r, pattern p = B_SOLID_HIGH);
@@ -343,36 +352,38 @@ public:
void StrokeRoundRect(BRect r, float xRadius,
float yRadius, pattern p = B_SOLID_HIGH);
void FillRoundRect(BRect r, float xRadius, float yRadius,
pattern p = B_SOLID_HIGH);
void FillRoundRect(BRect r, float xRadius, float yRadius,
const BGradient& gradient);
void FillRoundRect(BRect r, float xRadius,
float yRadius, pattern p = B_SOLID_HIGH);
void FillRoundRect(BRect r, float xRadius,
float yRadius, const BGradient& gradient);
void StrokeEllipse(BPoint center, float xRadius,
float yRadius, pattern p = B_SOLID_HIGH);
void StrokeEllipse(BRect r, pattern p = B_SOLID_HIGH);
void StrokeEllipse(BRect r,
pattern p = B_SOLID_HIGH);
void FillEllipse(BPoint center, float xRadius,
float yRadius, pattern p = B_SOLID_HIGH);
void FillEllipse(BRect r, pattern p = B_SOLID_HIGH);
void FillEllipse(BPoint center, float xRadius,
float yRadius, const BGradient& gradient);
void FillEllipse(BRect r, const BGradient& gradient);
void FillEllipse(BRect r,
const BGradient& gradient);
void StrokeArc(BPoint center, float xRadius,
float yRadius, float startAngle, float arcAngle,
pattern p = B_SOLID_HIGH);
float yRadius, float startAngle,
float arcAngle, pattern p = B_SOLID_HIGH);
void StrokeArc(BRect r, float startAngle,
float arcAngle, pattern p = B_SOLID_HIGH);
void FillArc(BPoint center, float xRadius, float yRadius,
float startAngle, float arcAngle,
pattern p = B_SOLID_HIGH);
void FillArc(BRect r, float startAngle, float arcAngle,
pattern p = B_SOLID_HIGH);
void FillArc(BPoint center, float xRadius, float yRadius,
float startAngle, float arcAngle,
const BGradient& gradient);
void FillArc(BRect r, float startAngle, float arcAngle,
const BGradient& gradient);
void FillArc(BPoint center, float xRadius,
float yRadius, float startAngle,
float arcAngle, pattern p = B_SOLID_HIGH);
void FillArc(BRect r, float startAngle,
float arcAngle, pattern p = B_SOLID_HIGH);
void FillArc(BPoint center, float xRadius,
float yRadius, float startAngle,
float arcAngle, const BGradient& gradient);
void FillArc(BRect r, float startAngle,
float arcAngle, const BGradient& gradient);
void StrokeBezier(BPoint* controlPoints,
pattern p = B_SOLID_HIGH);
@@ -383,8 +394,10 @@ public:
void StrokeShape(BShape* shape,
pattern p = B_SOLID_HIGH);
void FillShape(BShape* shape, pattern p = B_SOLID_HIGH);
void FillShape(BShape* shape, const BGradient& gradient);
void FillShape(BShape* shape,
pattern p = B_SOLID_HIGH);
void FillShape(BShape* shape,
const BGradient& gradient);
void CopyBits(BRect src, BRect dst);
@@ -414,12 +427,14 @@ public:
void DrawChar(char aChar, BPoint location);
void DrawString(const char* aString,
escapement_delta* delta = NULL);
void DrawString(const char* aString, BPoint location,
void DrawString(const char* aString,
BPoint location,
escapement_delta* delta = NULL);
void DrawString(const char* aString, int32 length,
escapement_delta* delta = NULL);
void DrawString(const char* aString, int32 length,
BPoint location, escapement_delta* delta = 0L);
BPoint location,
escapement_delta* delta = 0L);
virtual void SetFont(const BFont* font,
uint32 mask = B_FONT_ALL);
@@ -428,7 +443,8 @@ public:
void TruncateString(BString* in_out, uint32 mode,
float width) const;
float StringWidth(const char* string) const;
float StringWidth(const char* string, int32 length) const;
float StringWidth(const char* string,
int32 length) const;
void GetStringWidths(char* stringArray[],
int32 lengthArray[], int32 numStrings,
float widthArray[]) const;
@@ -454,12 +470,13 @@ public:
void DrawPictureAsync(const BPicture* a_picture);
void DrawPictureAsync(const BPicture* a_picture,
BPoint where);
void DrawPictureAsync(const char* filename, long offset,
BPoint where);
void DrawPictureAsync(const char* filename,
long offset, BPoint where);
status_t SetEventMask(uint32 mask, uint32 options = 0);
uint32 EventMask();
status_t SetMouseEventMask(uint32 mask, uint32 options = 0);
status_t SetMouseEventMask(uint32 mask,
uint32 options = 0);
virtual void SetFlags(uint32 flags);
uint32 Flags() const;
@@ -558,6 +575,17 @@ protected:
private:
void _Layout(bool force, BLayoutContext* context);
private:
// FBC padding and forbidden methods
virtual void _ReservedView12();
virtual void _ReservedView13();
virtual void _ReservedView14();
virtual void _ReservedView15();
virtual void _ReservedView16();
BView(const BView&);
BView& operator=(const BView&);
private:
struct LayoutData;
@@ -569,15 +597,6 @@ private:
friend class BTabView;
friend class BWindow;
virtual void _ReservedView12();
virtual void _ReservedView13();
virtual void _ReservedView14();
virtual void _ReservedView15();
virtual void _ReservedView16();
BView(const BView&);
BView& operator=(const BView&);
void _InitData(BRect frame, const char* name,
uint32 resizeMask, uint32 flags);
status_t _SetViewBitmap(const BBitmap* bitmap,
@@ -603,15 +622,16 @@ private:
void _ParentResizedBy(int32 deltaWidth,
int32 deltaHeight);
void _ConvertToScreen(BPoint* pt, bool checkLock) const;
void _ConvertToScreen(BPoint* pt,
bool checkLock) const;
void _ConvertFromScreen(BPoint* pt,
bool checkLock) const;
void _ConvertToParent(BPoint* pt, bool checkLock) const;
void _ConvertToParent(BPoint* pt,
bool checkLock) const;
void _ConvertFromParent(BPoint* pt,
bool checkLock) const;
void _Activate(bool state);
void _Attach();
void _Detach();
@@ -625,7 +645,8 @@ private:
void _FlushIfNotInTransaction();
bool _CreateSelf();
bool _AddChildToList(BView* child, BView* before = NULL);
bool _AddChildToList(BView* child,
BView* before = NULL);
bool _RemoveChildFromList(BView* child);
bool _AddChild(BView *child, BView *before);
@@ -672,7 +693,8 @@ private:
};
// inline definitions ----------------------------------------------------------
// #pragma mark - inline definitions
inline void
BView::ScrollTo(float x, float y)
@@ -680,6 +702,7 @@ BView::ScrollTo(float x, float y)
ScrollTo(BPoint(x, y));
}
inline void
BView::SetViewColor(uchar r, uchar g, uchar b, uchar a)
{
@@ -691,6 +714,7 @@ BView::SetViewColor(uchar r, uchar g, uchar b, uchar a)
SetViewColor(color);
}
inline void
BView::SetHighColor(uchar r, uchar g, uchar b, uchar a)
{
@@ -702,6 +726,7 @@ BView::SetHighColor(uchar r, uchar g, uchar b, uchar a)
SetHighColor(color);
}
inline void
BView::SetLowColor(uchar r, uchar g, uchar b, uchar a)
{
+48 -40
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
@@ -90,7 +87,6 @@ enum {
#define B_CURRENT_WORKSPACE 0
#define B_ALL_WORKSPACES 0xffffffff
//----------------------------------------------------------------
class BWindow : public BLooper {
public:
@@ -98,13 +94,15 @@ public:
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);
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(); }
@@ -120,13 +118,15 @@ public:
virtual void FrameMoved(BPoint newPosition);
virtual void WorkspacesChanged(uint32 oldWorkspaces,
uint32 newWorkspaces);
virtual void WorkspaceActivated(int32 workspace, bool state);
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 ScreenChanged(BRect screenSize,
color_space format);
void SetPulseRate(bigtime_t rate);
bigtime_t PulseRate() const;
@@ -185,9 +185,11 @@ public:
void EnableUpdates();
void BeginViewTransaction();
// referred as OpenViewTransaction() in BeBook
// referred as OpenViewTransaction()
// in BeBook
void EndViewTransaction();
// referred as CommitViewTransaction() in BeBook
// referred as CommitViewTransaction()
// in BeBook
BRect Bounds() const;
BRect Frame() const;
@@ -214,15 +216,15 @@ public:
BView* LastMouseMovedView() const;
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);
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;
@@ -239,14 +241,16 @@ public:
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,
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* width = NULL,
int32* widthOffset = NULL,
int32* v = NULL, int32* vOffset = NULL,
int32* height = NULL,
int32* heightOffset = NULL) const;
@@ -259,6 +263,20 @@ public:
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;
struct unpack_cookie;
@@ -275,18 +293,6 @@ 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();
BWindow(BWindow&);
BWindow& operator=(BWindow&);
BWindow(BRect frame, int32 bitmapToken);
void _InitData(BRect frame, const char* title,
window_look look, window_feel feel,
@@ -316,7 +322,8 @@ private:
void _DequeueAll();
window_type _ComposeType(window_look look,
window_feel feel) const;
void _DecomposeType(window_type type, window_look* look,
void _DecomposeType(window_type type,
window_look* look,
window_feel* feel) const;
void SetIsFilePanel(bool yes);
@@ -333,8 +340,9 @@ private:
BView* _FindView(int32 token);
BView* _LastViewChild(BView* parent);
BView* _FindNextNavigable(BView *focus, uint32 flags);
BView* _FindPreviousNavigable(BView *focus, uint32 flags);
BView* _FindNextNavigable(BView* focus, uint32 flags);
BView* _FindPreviousNavigable(BView* focus,
uint32 flags);
void _Switcher(int32 rawKey, uint32 modifiers,
bool repeat);
bool _HandleKeyDown(BMessage* event);
+4 -1
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()
{
+339 -327
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);
}
status_t
BScrollView::GetSupportedSuites(BMessage *data)
{
return BView::GetSupportedSuites(data);
}
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;
}
}
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);
}
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());
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() {}
+222 -195
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:
@@ -29,7 +29,8 @@ 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),
:
BView(frame, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW),
fLabel(label),
fTrailingLabel(trailingLabel)
{
@@ -39,7 +40,8 @@ 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,
:
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;
void
BStatusBar::AllDetached()
{
BView::AllDetached();
}
// #pragma mark -
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;
}
case B_RESET_STATUS_BAR:
{
const char *label = NULL, *trailing_label = NULL;
if (_height) {
font_height fontHeight;
GetFontHeight(&fontHeight);
message->FindString("label", &label);
message->FindString("trailing_label", &trailing_label);
Reset(label, trailing_label);
break;
}
default:
BView::MessageReceived(message);
break;
*_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)
+201 -182
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()
{
+45 -33
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)
{