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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _ABSTRACT_LAYOUT_ITEM_H #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. * Distributed under the terms of the MIT License.
*
* Authors:
* Erik Jaesler ([email protected])
*/ */
#ifndef _ALERT_H #ifndef _ALERT_H
#define _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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _ALIGNMENT_H #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. * Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold ([email protected])
*/ */
#ifndef _BITMAP_H #ifndef _BITMAP_H
#define _BITMAP_H #define _BITMAP_H
+2 -6
View File
@@ -1,10 +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. * Distributed under the terms of the MIT License.
*
* Authors:
* Marc Flerackers <[email protected]>
* Stephan Aßmus <[email protected]>
*/ */
#ifndef _BUTTON_H #ifndef _BUTTON_H
#define _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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CARD_LAYOUT_H #ifndef _CARD_LAYOUT_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2008-2009 Haiku, Inc. All rights reserved. * Copyright 2008-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CHANNEL_CONTROL_H #ifndef _CHANNEL_CONTROL_H
#define _CHANNEL_CONTROL_H #define _CHANNEL_CONTROL_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2009, Haiku Inc. All rights reserved. * Copyright 2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CHANNEL_SLIDER_H #ifndef _CHANNEL_SLIDER_H
#define _CHANNEL_SLIDER_H #define _CHANNEL_SLIDER_H
+2 -2
View File
@@ -1,6 +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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CHECK_BOX_H #ifndef _CHECK_BOX_H
#define _CHECK_BOX_H #define _CHECK_BOX_H
+1 -1
View File
@@ -1,6 +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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CONTROL_H #ifndef _CONTROL_H
#define _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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CONTROL_LOOK_H #ifndef _CONTROL_LOOK_H
@@ -16,6 +16,10 @@ class BGradientLinear;
class BView; class BView;
// WARNING! This is experimental API and may change! Be prepared to
// recompile your software in a next version of haiku.
namespace BPrivate { namespace BPrivate {
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved. * 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 _DESKBAR_H #ifndef _DESKBAR_H
#define _DESKBAR_H #define _DESKBAR_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved. * 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 _DRAGGER_H #ifndef _DRAGGER_H
#define _DRAGGER_H #define _DRAGGER_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2005-2009, Haiku, Inc. All Rights Reserved. * Copyright 2005-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
*/ */
#ifndef _FONT_H_ #ifndef _FONT_H_
#define _FONT_H_ #define _FONT_H_
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2006-2009, Haiku Inc. All rights reserved. * 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 _GRADIENT_H #ifndef _GRADIENT_H
#define _GRADIENT_H #define _GRADIENT_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2006-2009, Haiku Inc. All rights reserved. * 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 _GRADIENT_CONIC_H #ifndef _GRADIENT_CONIC_H
#define _GRADIENT_CONIC_H #define _GRADIENT_CONIC_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2006-2009, Haiku Inc. All rights reserved. * 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 _GRADIENT_DIAMOND_H #ifndef _GRADIENT_DIAMOND_H
#define _GRADIENT_DIAMOND_H #define _GRADIENT_DIAMOND_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2006-2009, Haiku Inc. All rights reserved. * 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 _GRADIENT_LINEAR_H #ifndef _GRADIENT_LINEAR_H
#define _GRADIENT_LINEAR_H #define _GRADIENT_LINEAR_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2006-2009, Haiku Inc. All rights reserved. * 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 _GRADIENT_RADIAL_H #ifndef _GRADIENT_RADIAL_H
#define _GRADIENT_RADIAL_H #define _GRADIENT_RADIAL_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2006-2009, Haiku Inc. All rights reserved. * 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 _GRADIENT_RADIAL_FOCUS_H #ifndef _GRADIENT_RADIAL_FOCUS_H
#define _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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _GRAPHICS_DEFS_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _GRID_LAYOUT_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _GRID_LAYOUT_BUILDER_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _GRID_VIEW_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _GROUP_LAYOUT_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _GROUP_LAYOUT_BUILDER_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _GROUP_VIEW_H #ifndef _GROUP_VIEW_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2008, Haiku, Inc. * Copyright 2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
* *
*/ */
#ifndef _INPUT_H #ifndef _INPUT_H
+2 -5
View File
@@ -1,9 +1,6 @@
/* /*
* Copyright (c) 2001-2008, Haiku, Inc. * Copyright 2001-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
*
* Authors:
* Erik Jaesler ([email protected])
*/ */
#ifndef _INTERFACE_DEFS_H #ifndef _INTERFACE_DEFS_H
#define _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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _LAYOUT_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _LAYOUT_BUILDER_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _LAYOUT_CONTEXT_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _LAYOUT_ITEM_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _LAYOUT_UTILS_H #ifndef _LAYOUT_UTILS_H
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2006-2009, Haiku, Inc. All rights reserved. * 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 #ifndef _LIST_ITEM_H
#define _LIST_ITEM_H #define _LIST_ITEM_H
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2002-2009, Haiku, Inc. All rights reserved. * 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 #ifndef _LIST_VIEW_H
#define _LIST_VIEW_H #define _LIST_VIEW_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2007-2009, Haiku Inc. All rights reserved. * Copyright 2007-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
*/ */
#ifndef _MENU_H #ifndef _MENU_H
#define _MENU_H #define _MENU_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2003-2009, Haiku Inc. All rights reserved. * Copyright 2003-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
*/ */
#ifndef _MENU_BAR_H #ifndef _MENU_BAR_H
#define _MENU_BAR_H #define _MENU_BAR_H
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2006-2009, Haiku Inc. All rights reserved. * 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 _MENU_FIELD_H #ifndef _MENU_FIELD_H
#define _MENU_FIELD_H #define _MENU_FIELD_H
+10 -6
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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _MENU_ITEM_H #ifndef _MENU_ITEM_H
@@ -19,12 +19,14 @@ class BMenuItem : public BArchivable, public BInvoker {
public: public:
BMenuItem(const char* label, BMessage* message, BMenuItem(const char* label, BMessage* message,
char shortcut = 0, uint32 modifiers = 0); char shortcut = 0, uint32 modifiers = 0);
BMenuItem(BMenu* menu, BMessage* message = NULL); BMenuItem(BMenu* menu,
BMessage* message = NULL);
BMenuItem(BMessage* data); BMenuItem(BMessage* data);
virtual ~BMenuItem(); virtual ~BMenuItem();
static BArchivable* Instantiate(BMessage* archive); 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 SetLabel(const char* name);
virtual void SetEnabled(bool enabled); virtual void SetEnabled(bool enabled);
@@ -65,10 +67,11 @@ class BMenuItem : public BArchivable, public BInvoker {
void Uninstall(); void Uninstall();
void SetSuper(BMenu* superMenu); void SetSuper(BMenu* superMenu);
void Select(bool select); void Select(bool select);
void SetAutomaticTrigger(int32 index, uint32 trigger); void SetAutomaticTrigger(int32 index,
uint32 trigger);
protected: protected:
virtual status_t Invoke(BMessage *msg = NULL); virtual status_t Invoke(BMessage* message = NULL);
private: private:
BMenuItem(const BMenuItem& other); BMenuItem(const BMenuItem& other);
@@ -82,6 +85,7 @@ class BMenuItem : public BArchivable, public BInvoker {
void _DrawSubmenuSymbol(rgb_color backgroundColor); void _DrawSubmenuSymbol(rgb_color backgroundColor);
void _DrawControlChar(char shortcut, BPoint where); void _DrawControlChar(char shortcut, BPoint where);
private:
char* fLabel; char* fLabel;
BMenu* fSubmenu; BMenu* fSubmenu;
BWindow* fWindow; BWindow* fWindow;
@@ -104,4 +108,4 @@ class BMenuItem : public BArchivable, public BInvoker {
// compatibility we're exporting that class from here too. // compatibility we're exporting that class from here too.
#include <SeparatorItem.h> #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. * Copyright 2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
*/ */
#ifndef _MULTI_CHANNEL_CONTROL_H #ifndef _MULTI_CHANNEL_CONTROL_H
#define _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. * 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 _OPTION_CONTROL_H #ifndef _OPTION_CONTROL_H
#define _OPTION_CONTROL_H #define _OPTION_CONTROL_H
+2 -2
View File
@@ -1,6 +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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _OPTION_POP_UP_H #ifndef _OPTION_POP_UP_H
#define _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. * 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 _OUTLINE_LIST_VIEW_H #ifndef _OUTLINE_LIST_VIEW_H
#define _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. * 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 _PICTURE_H #ifndef _PICTURE_H
#define _PICTURE_H #define _PICTURE_H
#include <BeBuild.h>
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include <Rect.h> #include <Rect.h>
#include <Archivable.h> #include <Archivable.h>
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2001-2008, Haiku Inc. All rights reserved. * Copyright 2001-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
*/ */
#ifndef _PICTURE_BUTTON_H #ifndef _PICTURE_BUTTON_H
#define _PICTURE_BUTTON_H #define _PICTURE_BUTTON_H
+29 -28
View File
@@ -1,43 +1,40 @@
/* /*
* Copyright 2001-2007, Haiku, Inc. All Rights Reserved. * 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:
* Frans van Nispen
*/ */
#ifndef _POINT_H #ifndef _POINT_H
#define _POINT_H #define _POINT_H
#include <BeBuild.h>
#include <SupportDefs.h> #include <SupportDefs.h>
class BRect; class BRect;
class BPoint { class BPoint {
public: public:
float x; float x;
float y; float y;
BPoint(); BPoint();
BPoint(float X, float Y); BPoint(float x, float y);
BPoint(const BPoint& p); BPoint(const BPoint& p);
BPoint &operator=(const BPoint &p); BPoint& operator=(const BPoint& other);
void Set(float X, float Y); void Set(float x, float y);
void ConstrainTo(BRect r); void ConstrainTo(BRect rect);
void PrintToStream() const; void PrintToStream() const;
BPoint operator-() const; BPoint operator-() const;
BPoint operator+(const BPoint &p) const; BPoint operator+(const BPoint& other) const;
BPoint operator-(const BPoint &p) const; BPoint operator-(const BPoint& other) const;
BPoint& operator+=(const BPoint &p); BPoint& operator+=(const BPoint& other);
BPoint& operator-=(const BPoint &p); BPoint& operator-=(const BPoint& other);
bool operator!=(const BPoint &p) const; bool operator!=(const BPoint& other) const;
bool operator==(const BPoint &p) const; bool operator==(const BPoint& other) const;
}; };
@@ -47,41 +44,45 @@ extern const BPoint B_ORIGIN;
inline inline
BPoint::BPoint() BPoint::BPoint()
:
x(0.0f),
y(0.0f)
{ {
x = y = 0;
} }
inline inline
BPoint::BPoint(float X, float Y) BPoint::BPoint(float x, float y)
:
x(x),
y(y)
{ {
x = X;
y = Y;
} }
inline 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& inline BPoint&
BPoint::operator=(const BPoint& from) BPoint::operator=(const BPoint& other)
{ {
x = from.x; x = other.x;
y = from.y; y = other.y;
return *this; return *this;
} }
inline void inline void
BPoint::Set(float X, float Y) BPoint::Set(float x, float y)
{ {
x = X; this->x = x;
y = Y; this->y = y;
} }
#endif // _POINT_H #endif // _POINT_H
+2 -2
View File
@@ -1,6 +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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _POLYGON_H #ifndef _POLYGON_H
#define _POLYGON_H #define _POLYGON_H
+26 -28
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. * Distributed under the terms of the MIT License.
*
* Authors:
* Frans van Nispen
*/ */
#ifndef _RECT_H #ifndef _RECT_H
#define _RECT_H #define _RECT_H
#include <SupportDefs.h>
#include <Point.h> #include <Point.h>
#include <Size.h> #include <Size.h>
@@ -24,13 +20,15 @@ class BRect {
float bottom; float bottom;
BRect(); BRect();
BRect(const BRect &r); BRect(const BRect& other);
BRect(float l, float t, float r, float b); BRect(float left, float top, float right,
BRect(BPoint lt, BPoint rb); float bottom);
BRect(BPoint leftTop, BPoint rightBottom);
BRect(BPoint leftTop, BSize size); BRect(BPoint leftTop, BSize size);
BRect &operator=(const BRect &r); BRect& operator=(const BRect& other);
void Set(float l, float t, float r, float b); void Set(float left, float top, float right,
float bottom);
void PrintToStream() const; void PrintToStream() const;
@@ -39,38 +37,38 @@ class BRect {
BPoint LeftBottom() const; BPoint LeftBottom() const;
BPoint RightTop() const; BPoint RightTop() const;
void SetLeftTop(const BPoint p); void SetLeftTop(const BPoint leftTop);
void SetRightBottom(const BPoint p); void SetRightBottom(const BPoint rightBottom);
void SetLeftBottom(const BPoint p); void SetLeftBottom(const BPoint leftBottom);
void SetRightTop(const BPoint p); void SetRightTop(const BPoint rightTop);
// transformation // Transformation
void InsetBy(BPoint p); void InsetBy(BPoint inset);
void InsetBy(float dx, float dy); void InsetBy(float dx, float dy);
void OffsetBy(BPoint p); void OffsetBy(BPoint delta);
void OffsetBy(float dx, float dy); void OffsetBy(float dx, float dy);
void OffsetTo(BPoint p); void OffsetTo(BPoint offset);
void OffsetTo(float x, float y); void OffsetTo(float x, float y);
// expression transformations // Expression transformations
BRect& InsetBySelf(BPoint); BRect& InsetBySelf(BPoint inset);
BRect& InsetBySelf(float dx, float dy); BRect& InsetBySelf(float dx, float dy);
BRect InsetByCopy(BPoint); BRect InsetByCopy(BPoint inset);
BRect InsetByCopy(float dx, float dy); BRect InsetByCopy(float dx, float dy);
BRect& OffsetBySelf(BPoint); BRect& OffsetBySelf(BPoint offset);
BRect& OffsetBySelf(float dx, float dy); BRect& OffsetBySelf(float dx, float dy);
BRect OffsetByCopy(BPoint); BRect OffsetByCopy(BPoint offset);
BRect OffsetByCopy(float dx, float dy); BRect OffsetByCopy(float dx, float dy);
BRect& OffsetToSelf(BPoint); BRect& OffsetToSelf(BPoint offset);
BRect& OffsetToSelf(float dx, float dy); BRect& OffsetToSelf(float dx, float dy);
BRect OffsetToCopy(BPoint); BRect OffsetToCopy(BPoint offset);
BRect OffsetToCopy(float dx, float dy); BRect OffsetToCopy(float dx, float dy);
// comparison // Comparison
bool operator==(BRect r) const; bool operator==(BRect r) const;
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;
BRect operator|(BRect r) const; BRect operator|(BRect r) const;
@@ -87,7 +85,7 @@ class BRect {
}; };
// inline definitions ---------------------------------------------------------- // #pragma mark - inline definitions
inline BPoint inline BPoint
BRect::LeftTop() const BRect::LeftTop() const
+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. * Distributed under the terms of the MIT License.
*/ */
+31 -19
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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SCREEN_H #ifndef _SCREEN_H
@@ -19,6 +19,7 @@ namespace BPrivate {
class BPrivateScreen; class BPrivateScreen;
} }
class BScreen { class BScreen {
public: public:
BScreen(screen_id id = B_MAIN_SCREEN_ID); BScreen(screen_id id = B_MAIN_SCREEN_ID);
@@ -36,53 +37,64 @@ class BScreen {
status_t WaitForRetrace(bigtime_t timeout); status_t WaitForRetrace(bigtime_t timeout);
uint8 IndexForColor(rgb_color color); uint8 IndexForColor(rgb_color color);
uint8 IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 IndexForColor(uint8 red, uint8 green,
uint8 alpha = 255); uint8 blue, uint8 alpha = 255);
rgb_color ColorForIndex(uint8 index); rgb_color ColorForIndex(uint8 index);
uint8 InvertIndex(uint8 index); uint8 InvertIndex(uint8 index);
const color_map* ColorMap(); const color_map* ColorMap();
status_t GetBitmap(BBitmap** _bitmap, bool drawCursor = true, status_t GetBitmap(BBitmap** _bitmap,
bool drawCursor = true,
BRect* frame = NULL); BRect* frame = NULL);
status_t ReadBitmap(BBitmap* bitmap, bool drawCursor = true, status_t ReadBitmap(BBitmap* bitmap,
bool drawCursor = true,
BRect* frame = NULL); BRect* frame = NULL);
rgb_color DesktopColor(); rgb_color DesktopColor();
rgb_color DesktopColor(uint32 index); rgb_color DesktopColor(uint32 index);
void SetDesktopColor(rgb_color color, bool makeDefault = true); void SetDesktopColor(rgb_color color,
void SetDesktopColor(rgb_color color, uint32 index,
bool makeDefault = true); 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); const display_mode* high);
status_t GetModeList(display_mode** _modeList, uint32* _count); status_t GetModeList(display_mode** _modeList,
status_t GetMode(display_mode* mode); uint32* _count);
status_t GetMode(uint32 workspace, display_mode* mode); status_t GetMode(display_mode* _mode);
status_t SetMode(display_mode* mode, bool makeDefault = false); status_t GetMode(uint32 workspace,
status_t SetMode(uint32 workspace, display_mode* mode, display_mode* _mode);
status_t SetMode(display_mode* mode,
bool makeDefault = false);
status_t SetMode(uint32 workspace,
display_mode* mode,
bool makeDefault = false); bool makeDefault = false);
status_t GetDeviceInfo(accelerant_device_info* info); status_t GetDeviceInfo(accelerant_device_info* info);
status_t GetMonitorInfo(monitor_info* info); status_t GetMonitorInfo(monitor_info* info);
status_t GetPixelClockLimits(display_mode* mode, uint32* low, status_t GetPixelClockLimits(display_mode* mode,
uint32* high); uint32* low, uint32* high);
status_t GetTimingConstraints( status_t GetTimingConstraints(
display_timing_constraints* timingConstraints); display_timing_constraints*
timingConstraints);
status_t SetDPMS(uint32 state); status_t SetDPMS(uint32 state);
uint32 DPMSState(); uint32 DPMSState();
uint32 DPMSCapabilites(); uint32 DPMSCapabilites();
private: private:
BScreen& operator=(const BScreen& other); // Forbidden and deprecated methods
BScreen(const BScreen& other); BScreen(const BScreen& other);
BScreen& operator=(const BScreen& other);
// old and deprecated methods - should be faded out
BPrivate::BPrivateScreen* private_screen(); BPrivate::BPrivateScreen* private_screen();
status_t ProposeDisplayMode(display_mode* target, status_t ProposeDisplayMode(display_mode* target,
const display_mode* low, const display_mode* high); const display_mode* low,
const display_mode* high);
void* BaseAddress(); void* BaseAddress();
uint32 BytesPerRow(); uint32 BytesPerRow();
private:
BPrivate::BPrivateScreen* fScreen; BPrivate::BPrivateScreen* fScreen;
}; };
+12 -14
View File
@@ -1,12 +1,6 @@
/* /*
* Copyright (c) 2001-2008, Haiku, Inc. All rights reserved. * Copyright 2001-2008, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
*
* Authors:
* Marc Flerackers ([email protected])
* DarkWyrm ([email protected])
* Stefano Ceccherini ([email protected])
* Stephan Aßmus <[email protected]>
*/ */
#ifndef _SCROLL_BAR_H #ifndef _SCROLL_BAR_H
#define _SCROLL_BAR_H #define _SCROLL_BAR_H
@@ -32,11 +26,13 @@ public:
BView* target, float min, float max, BView* target, float min, float max,
orientation direction); orientation direction);
BScrollBar(const char* name, BView* target, BScrollBar(const char* name, BView* target,
float min, float max, orientation direction); float min, float max,
BScrollBar(BMessage* data); enum orientation orientation);
BScrollBar(BMessage* archive);
virtual ~BScrollBar(); virtual ~BScrollBar();
static BArchivable* Instantiate(BMessage* data); static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage *data, bool deep = true) const; virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void AttachedToWindow(); virtual void AttachedToWindow();
void SetValue(float value); void SetValue(float value);
@@ -56,7 +52,7 @@ public:
void SetOrientation(enum orientation orientation); void SetOrientation(enum orientation orientation);
orientation Orientation() const; 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 // but it's not important right now. This is supposed
// to be used in case the BScrollBar should draw part of // to be used in case the BScrollBar should draw part of
// the focus indication of the target view for aesthetical // the focus indication of the target view for aesthetical
@@ -78,7 +74,8 @@ public:
int32 form, const char* property); int32 form, const char* property);
virtual void ResizeToPreferred(); 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 MakeFocus(bool state = true);
virtual void AllAttached(); virtual void AllAttached();
virtual void AllDetached(); virtual void AllDetached();
@@ -128,6 +125,7 @@ private:
BSize _MinSize() const; BSize _MinSize() const;
private:
float fMin; float fMin;
float fMax; float fMax;
float fSmallStep; 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. * Distributed under the terms of the MIT license.
*/ */
#ifndef _SCROLL_VIEW_H #ifndef _SCROLL_VIEW_H
@@ -21,17 +21,46 @@ public:
bool vertical = false, bool vertical = false,
border_style border = B_FANCY_BORDER); border_style border = B_FANCY_BORDER);
BScrollView(const char* name, BView* target, BScrollView(const char* name, BView* target,
uint32 flags, bool horizontal, bool vertical, uint32 flags, bool horizontal,
border_style border = B_FANCY_BORDER); bool vertical, border_style border
= B_FANCY_BORDER);
BScrollView(BMessage* archive); BScrollView(BMessage* archive);
virtual ~BScrollView(); virtual ~BScrollView();
static BArchivable* Instantiate(BMessage* archive); 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 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; BScrollBar* ScrollBar(orientation posture) const;
virtual void SetBorder(border_style border); virtual void SetBorder(border_style border);
@@ -43,44 +72,16 @@ public:
void SetTarget(BView* target); void SetTarget(BView* target);
BView* Target() const; BView* Target() const;
virtual void MessageReceived(BMessage* message); // Scripting
virtual void MouseDown(BPoint point); virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
virtual void WindowActivated(bool active); int32 form, const char* property);
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);
virtual status_t GetSupportedSuites(BMessage* data); 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); virtual status_t Perform(perform_code d, void* arg);
private: private:
friend class BView; // FBC padding and forbidden methods
virtual void _ReservedScrollView1(); virtual void _ReservedScrollView1();
virtual void _ReservedScrollView2(); virtual void _ReservedScrollView2();
virtual void _ReservedScrollView3(); virtual void _ReservedScrollView3();
@@ -88,13 +89,16 @@ private:
BScrollView& operator=(const BScrollView& other); BScrollView& operator=(const BScrollView& other);
private:
friend class BView;
void _Init(bool horizontal, bool vertical); void _Init(bool horizontal, bool vertical);
float _BorderSize() const; float _BorderSize() const;
BRect _InnerFrame() const; BRect _InnerFrame() const;
BSize _ComputeSize(BSize targetSize) const; BSize _ComputeSize(BSize targetSize) const;
BRect _ComputeFrame(BRect targetRect) const; BRect _ComputeFrame(BRect targetRect) const;
void _AlignScrollBars(bool horizontal, bool vertical, void _AlignScrollBars(bool horizontal,
BRect targetFrame); bool vertical, BRect targetFrame);
static BRect _ComputeFrame(BRect frame, bool horizontal, static BRect _ComputeFrame(BRect frame, bool horizontal,
bool vertical, border_style border); bool vertical, border_style border);
@@ -103,6 +107,7 @@ private:
static float _BorderSize(border_style border); static float _BorderSize(border_style border);
static int32 _ModifyFlags(int32 flags, border_style border); static int32 _ModifyFlags(int32 flags, border_style border);
private:
BView* fTarget; BView* fTarget;
BScrollBar* fHorizontalScrollBar; BScrollBar* fHorizontalScrollBar;
BScrollBar* fVerticalScrollBar; BScrollBar* fVerticalScrollBar;
@@ -114,4 +119,4 @@ private:
uint32 _reserved[3]; 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. * Distributed under the terms of the MIT License.
*
*/ */
#ifndef _SEPARATOR_ITEM_H #ifndef _SEPARATOR_ITEM_H
#define _SEPARATOR_ITEM_H #define _SEPARATOR_ITEM_H
#include <MenuItem.h> #include <MenuItem.h>
class BMessage; class BMessage;
class BSeparatorItem : public BMenuItem { class BSeparatorItem : public BMenuItem {
public: public:
BSeparatorItem(); BSeparatorItem();
BSeparatorItem(BMessage *data); BSeparatorItem(BMessage* archive);
virtual ~BSeparatorItem(); 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); virtual void SetEnabled(bool state);
protected: protected:
virtual void GetContentSize(float *width, float *height); virtual void GetContentSize(float* _width, float* _height);
virtual void Draw(); virtual void Draw();
private: private:
// FBC padding, reserved and forbidden
virtual void _ReservedSeparatorItem1(); virtual void _ReservedSeparatorItem1();
virtual void _ReservedSeparatorItem2(); virtual void _ReservedSeparatorItem2();
BSeparatorItem &operator=(const BSeparatorItem &); BSeparatorItem& operator=(const BSeparatorItem& other);
uint32 _reserved[1]; uint32 _reserved[1];
}; };
#endif /* _SEPARATOR_ITEM_H */ #endif // _SEPARATOR_ITEM_H
+6 -4
View File
@@ -1,11 +1,11 @@
/* /*
* Copyright 2001-2009, Stephan Aßmus <[email protected]> * Copyright 2009, Haiku, Inc. All rights reserved.
* Copyright 2001-2009, Ingo Weinhold <[email protected]> * Distributed under the terms of the MIT License.
* All rights reserved. Distributed under the terms of the MIT license.
*/ */
#ifndef _SEPARATOR_VIEW_H #ifndef _SEPARATOR_VIEW_H
#define _SEPARATOR_VIEW_H #define _SEPARATOR_VIEW_H
#include <Alignment.h> #include <Alignment.h>
#include <String.h> #include <String.h>
#include <View.h> #include <View.h>
@@ -55,8 +55,8 @@ public:
bool deep = true) const; bool deep = true) const;
virtual void Draw(BRect updateRect); virtual void Draw(BRect updateRect);
virtual void GetPreferredSize(float* width, float* height);
virtual void GetPreferredSize(float* width, float* height);
virtual BSize MinSize(); virtual BSize MinSize();
virtual BSize MaxSize(); virtual BSize MaxSize();
virtual BSize PreferredSize(); virtual BSize PreferredSize();
@@ -74,6 +74,7 @@ protected:
virtual void DoLayout(); virtual void DoLayout();
private: private:
// FBC padding
virtual void _ReservedSeparatorView1(); virtual void _ReservedSeparatorView1();
virtual void _ReservedSeparatorView2(); virtual void _ReservedSeparatorView2();
virtual void _ReservedSeparatorView3(); virtual void _ReservedSeparatorView3();
@@ -93,6 +94,7 @@ private:
float _BorderSize() const; float _BorderSize() const;
BRect _MaxLabelBounds() const; BRect _MaxLabelBounds() const;
private:
BString fLabel; BString fLabel;
BView* fLabelView; BView* fLabelView;
+20 -10
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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SHAPE_H #ifndef _SHAPE_H
@@ -25,8 +25,10 @@ public:
virtual ~BShapeIterator(); virtual ~BShapeIterator();
virtual status_t IterateMoveTo(BPoint* point); virtual status_t IterateMoveTo(BPoint* point);
virtual status_t IterateLineTo(int32 lineCount, BPoint *linePts); virtual status_t IterateLineTo(int32 lineCount,
virtual status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPts); BPoint* linePts);
virtual status_t IterateBezierTo(int32 bezierCount,
BPoint* bezierPts);
virtual status_t IterateClose(); virtual status_t IterateClose();
status_t Iterate(BShape* shape); status_t Iterate(BShape* shape);
@@ -44,12 +46,13 @@ private:
class BShape : public BArchivable { class BShape : public BArchivable {
public: public:
BShape(); BShape();
BShape(const BShape &copyFrom); BShape(const BShape& other);
BShape(BMessage *data); BShape(BMessage* archive);
virtual ~BShape(); virtual ~BShape();
virtual status_t Archive(BMessage *into, bool deep = true) const; static BArchivable* Instantiate(BMessage* archive);
static BArchivable *Instantiate(BMessage *data); virtual status_t Archive(BMessage* archive,
bool deep = true) const;
void Clear(); void Clear();
BRect Bounds() const; BRect Bounds() const;
@@ -62,28 +65,35 @@ public:
status_t Close(); status_t Close();
private: 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 _ReservedShape1();
virtual void _ReservedShape2(); virtual void _ReservedShape2();
virtual void _ReservedShape3(); virtual void _ReservedShape3();
virtual void _ReservedShape4(); virtual void _ReservedShape4();
private:
friend class BShapeIterator; friend class BShapeIterator;
friend class BView; friend class BView;
friend class BFont; friend class BFont;
friend class BPrivate::PicturePlayer; friend class BPrivate::PicturePlayer;
friend class BPrivate::ServerLink; friend class BPrivate::ServerLink;
void GetData(int32 *opCount, int32 *ptCount, uint32 **opList, BPoint **ptList); void GetData(int32* opCount, int32* ptCount,
void SetData(int32 opCount, int32 ptCount, const uint32 *opList, const BPoint *ptList); uint32** opList, BPoint** ptList);
void SetData(int32 opCount, int32 ptCount,
const uint32* opList,
const BPoint* ptList);
void InitData(); void InitData();
bool AllocatePts(int32 count); bool AllocatePts(int32 count);
bool AllocateOps(int32 count); bool AllocateOps(int32 count);
private:
uint32 fState; uint32 fState;
uint32 fBuildingOp; uint32 fBuildingOp;
void* fPrivateData; void* fPrivateData;
uint32 reserved[4]; uint32 reserved[4];
}; };
+46 -27
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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SHELF_H #ifndef _SHELF_H
#define _SHELF_H #define _SHELF_H
#include <Dragger.h> #include <Dragger.h>
#include <Handler.h> #include <Handler.h>
#include <List.h> #include <List.h>
#include <Locker.h> #include <Locker.h>
class BDataIO; class BDataIO;
class BPoint; class BPoint;
class BView; class BView;
@@ -25,28 +27,33 @@ namespace BPrivate {
class BShelf : public BHandler { class BShelf : public BHandler {
public: public:
BShelf(BView* view, bool allowDrags = true, const char* shelfType = NULL); BShelf(BView* view, bool allowDrags = true,
BShelf(const entry_ref* ref, BView* view, bool allowDrags = true,
const char* shelfType = NULL); 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); 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 ~BShelf();
virtual status_t Archive(BMessage* data, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive); static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void MessageReceived(BMessage *msg); virtual void MessageReceived(BMessage* message);
status_t Save(); status_t Save();
virtual void SetDirty(bool state); virtual void SetDirty(bool state);
bool IsDirty() const; bool IsDirty() const;
virtual BHandler* ResolveSpecifier(BMessage *msg, virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier, int32 index, BMessage* specifier,
int32 form, const char* property); int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data); 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; bool AllowsDragging() const;
void SetAllowsDragging(bool state); void SetAllowsDragging(bool state);
bool AllowsZombies() const; bool AllowsZombies() const;
@@ -56,17 +63,17 @@ class BShelf : public BHandler {
bool IsTypeEnforced() const; bool IsTypeEnforced() const;
void SetTypeEnforced(bool state); void SetTypeEnforced(bool state);
status_t SetSaveLocation(BDataIO *data_io); status_t SetSaveLocation(BDataIO* stream);
status_t SetSaveLocation(const entry_ref* ref); status_t SetSaveLocation(const entry_ref* ref);
BDataIO* SaveLocation(entry_ref* ref) const; BDataIO* SaveLocation(entry_ref* ref) const;
status_t AddReplicant(BMessage *data, BPoint location); status_t AddReplicant(BMessage* archive,
BPoint location);
status_t DeleteReplicant(BView* replicant); status_t DeleteReplicant(BView* replicant);
status_t DeleteReplicant(BMessage *data); status_t DeleteReplicant(BMessage* archive);
status_t DeleteReplicant(int32 index); status_t DeleteReplicant(int32 index);
int32 CountReplicants() const; int32 CountReplicants() const;
BMessage* ReplicantAt(int32 index, BMessage* ReplicantAt(int32 index, BView** view = NULL,
BView **view = NULL,
uint32* uid = NULL, uint32* uid = NULL,
status_t* perr = NULL) const; status_t* perr = NULL) const;
int32 IndexOf(const BView* replicantView) const; int32 IndexOf(const BView* replicantView) const;
@@ -74,16 +81,18 @@ class BShelf : public BHandler {
int32 IndexOf(uint32 id) const; int32 IndexOf(uint32 id) const;
protected: protected:
virtual bool CanAcceptReplicantMessage(BMessage*) const; virtual bool CanAcceptReplicantMessage(
virtual bool CanAcceptReplicantView(BRect, BView*, BMessage*) const; BMessage* archive) const;
virtual bool CanAcceptReplicantView(BRect,
BView*, BMessage*) const;
virtual BPoint AdjustReplicantBy(BRect, 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); const BView *replicant);
private: private:
friend class BPrivate::ShelfContainerViewFilter; // FBC padding and forbidden methods
virtual void _ReservedShelf2(); virtual void _ReservedShelf2();
virtual void _ReservedShelf3(); virtual void _ReservedShelf3();
virtual void _ReservedShelf4(); virtual void _ReservedShelf4();
@@ -95,20 +104,30 @@ class BShelf : public BHandler {
BShelf(const BShelf& other); BShelf(const BShelf& other);
BShelf& operator=(const BShelf& other); BShelf& operator=(const BShelf& other);
private:
friend class BPrivate::ShelfContainerViewFilter;
status_t _Archive(BMessage* data) const; status_t _Archive(BMessage* data) const;
void _InitData(BEntry* entry, BDataIO* stream, void _InitData(BEntry* entry, BDataIO* stream,
BView* view, bool allowDrags); BView* view, bool allowDrags);
status_t _DeleteReplicant(BPrivate::replicant_data* replicant); status_t _DeleteReplicant(
BPrivate::replicant_data* replicant);
status_t _AddReplicant(BMessage* data, status_t _AddReplicant(BMessage* data,
BPoint* location, uint32 uniqueID); BPoint* location, uint32 uniqueID);
BView *_GetReplicant(BMessage *data, BView *view, const BPoint &point, BView* _GetReplicant(BMessage* data, BView* view,
BDragger *&dragger, BDragger::relation &relation); const BPoint& point, BDragger*& dragger,
_BZombieReplicantView_ *_CreateZombie(BMessage *data, BDragger *&dragger); BDragger::relation& relation);
_BZombieReplicantView_* _CreateZombie(BMessage *data,
BDragger *&dragger);
status_t _GetProperty(BMessage* message, BMessage* reply); status_t _GetProperty(BMessage* message,
static void _GetReplicantData(BMessage *message, BView *view, BView *&replicant, BMessage* reply);
BDragger *&dragger, BDragger::relation &relation); static void _GetReplicantData(BMessage* message,
static BArchivable* _InstantiateObject(BMessage *archive, image_id *image); BView* view, BView*& replicant,
BDragger*& dragger,
BDragger::relation& relation);
static BArchivable* _InstantiateObject(BMessage* archive,
image_id* image);
private: private:
BView* fContainerView; BView* fContainerView;
+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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SIZE_H #ifndef _SIZE_H
@@ -45,7 +45,6 @@ public:
}; };
// constructor
inline inline
BSize::BSize() BSize::BSize()
: width(B_SIZE_UNSET), : width(B_SIZE_UNSET),
@@ -54,7 +53,6 @@ BSize::BSize()
} }
// copy constructor
inline inline
BSize::BSize(const BSize& other) BSize::BSize(const BSize& other)
: width(other.width), : width(other.width),
@@ -63,7 +61,6 @@ BSize::BSize(const BSize& other)
} }
// constructor
inline inline
BSize::BSize(float width, float height) BSize::BSize(float width, float height)
: width(width), : width(width),
@@ -72,7 +69,6 @@ BSize::BSize(float width, float height)
} }
// Width
inline float inline float
BSize::Width() const BSize::Width() const
{ {
@@ -80,7 +76,6 @@ BSize::Width() const
} }
// Height
inline float inline float
BSize::Height() const BSize::Height() const
{ {
@@ -88,7 +83,6 @@ BSize::Height() const
} }
// Set
inline void inline void
BSize::Set(float width, float height) BSize::Set(float width, float height)
{ {
@@ -97,7 +91,6 @@ BSize::Set(float width, float height)
} }
// SetWidth
inline void inline void
BSize::SetWidth(float width) BSize::SetWidth(float width)
{ {
@@ -105,7 +98,6 @@ BSize::SetWidth(float width)
} }
// SetHeight
inline void inline void
BSize::SetHeight(float height) BSize::SetHeight(float height)
{ {
@@ -113,7 +105,6 @@ BSize::SetHeight(float height)
} }
// IntegerWidth
inline int32 inline int32
BSize::IntegerWidth() const BSize::IntegerWidth() const
{ {
@@ -121,7 +112,6 @@ BSize::IntegerWidth() const
} }
// IntegerHeight
inline int32 inline int32
BSize::IntegerHeight() const BSize::IntegerHeight() const
{ {
@@ -129,7 +119,6 @@ BSize::IntegerHeight() const
} }
// IsWidthSet
inline bool inline bool
BSize::IsWidthSet() const BSize::IsWidthSet() const
{ {
@@ -137,7 +126,6 @@ BSize::IsWidthSet() const
} }
// IsHeightSet
inline bool inline bool
BSize::IsHeightSet() const BSize::IsHeightSet() const
{ {
@@ -145,7 +133,6 @@ BSize::IsHeightSet() const
} }
// ==
inline bool inline bool
BSize::operator==(const BSize& other) const BSize::operator==(const BSize& other) const
{ {
@@ -153,7 +140,6 @@ BSize::operator==(const BSize& other) const
} }
// !=
inline bool inline bool
BSize::operator!=(const BSize& other) const BSize::operator!=(const BSize& other) const
{ {
@@ -161,7 +147,6 @@ BSize::operator!=(const BSize& other) const
} }
// =
inline BSize& inline BSize&
BSize::operator=(const BSize& other) 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. * Distributed under the terms of the MIT License.
*
* Authors:
* Marc Flerackers ([email protected])
*/ */
#ifndef _SLIDER_H #ifndef _SLIDER_H
#define _SLIDER_H #define _SLIDER_H
@@ -56,11 +53,12 @@ public:
uint32 flags = B_NAVIGABLE | B_WILL_DRAW uint32 flags = B_NAVIGABLE | B_WILL_DRAW
| B_FRAME_EVENTS); | B_FRAME_EVENTS);
BSlider(BMessage* data); BSlider(BMessage* archive);
virtual ~BSlider(); virtual ~BSlider();
static BArchivable* Instantiate(BMessage* data); static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* data, bool deep = true) const; virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual status_t Perform(perform_code code, void* data); virtual status_t Perform(perform_code code, void* data);
virtual void WindowActivated(bool state); virtual void WindowActivated(bool state);
@@ -89,7 +87,8 @@ public:
virtual void SetPosition(float); virtual void SetPosition(float);
float Position() const; float Position() const;
virtual void SetEnabled(bool on); 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 Draw(BRect);
virtual void DrawSlider(); virtual void DrawSlider();
@@ -108,13 +107,14 @@ public:
virtual void SetFlags(uint32 flags); virtual void SetFlags(uint32 flags);
virtual void SetResizingMode(uint32 mode); virtual void SetResizingMode(uint32 mode);
virtual void GetPreferredSize(float* width, float* height); virtual void GetPreferredSize(float* _width,
float* _height);
virtual void ResizeToPreferred(); virtual void ResizeToPreferred();
virtual status_t Invoke(BMessage* message = NULL); virtual status_t Invoke(BMessage* message = NULL);
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, virtual BHandler* ResolveSpecifier(BMessage* message,
BMessage* specifier, int32 form, int32 index, BMessage* specifier,
const char* property); int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* data);
virtual void SetModificationMessage(BMessage* message); virtual void SetModificationMessage(BMessage* message);
@@ -176,6 +176,11 @@ private:
BSize _ValidateMinSize(); BSize _ValidateMinSize();
void _InitBarColor();
void _InitObject();
private:
// FBC padding and forbidden methods
virtual void _ReservedSlider6(); virtual void _ReservedSlider6();
virtual void _ReservedSlider7(); virtual void _ReservedSlider7();
virtual void _ReservedSlider8(); virtual void _ReservedSlider8();
@@ -186,9 +191,6 @@ private:
BSlider& operator=(const BSlider& other); BSlider& operator=(const BSlider& other);
void _InitBarColor();
void _InitObject();
private: private:
BMessage* fModificationMessage; BMessage* fModificationMessage;
int32 fSnoozeAmount; 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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SPACE_LAYOUT_ITEM_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SPLIT_LAYOUT_BUILDER_H #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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SPLIT_VIEW_H #ifndef _SPLIT_VIEW_H
@@ -13,14 +13,15 @@ class BSplitLayout;
class BSplitView : public BView { class BSplitView : public BView {
public: public:
BSplitView( BSplitView(
enum orientation orientation = B_HORIZONTAL, enum orientation orientation
= B_HORIZONTAL,
float spacing = 0.0f); float spacing = 0.0f);
virtual ~BSplitView(); virtual ~BSplitView();
void SetInsets(float left, float top, float right, void SetInsets(float left, float top, float right,
float bottom); float bottom);
void GetInsets(float* left, float* top, float* right, void GetInsets(float* left, float* top,
float* bottom) const; float* right, float* bottom) const;
float Spacing() const; float Spacing() const;
void SetSpacing(float spacing); void SetSpacing(float spacing);
@@ -61,12 +62,14 @@ public:
protected: protected:
virtual void DrawSplitter(BRect frame, virtual void DrawSplitter(BRect frame,
const BRect& updateRect, const BRect& updateRect,
enum orientation orientation, bool pressed); enum orientation orientation,
bool pressed);
private: private:
static void _DrawDefaultSplitter(BView* view, BRect frame, static void _DrawDefaultSplitter(BView* view, BRect frame,
const BRect& updateRect, const BRect& updateRect,
enum orientation orientation, bool pressed); enum orientation orientation,
bool pressed);
private: private:
BSplitLayout* fSplitLayout; 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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _STATUS_BAR_H #ifndef _STATUS_BAR_H
@@ -26,9 +26,32 @@ public:
bool deep = true) const; bool deep = true) const;
virtual void AttachedToWindow(); 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 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 SetBarColor(rgb_color color);
virtual void SetBarHeight(float height); virtual void SetBarHeight(float height);
@@ -53,33 +76,13 @@ public:
const char* Label() const; const char* Label() const;
const char* TrailingLabel() const; const char* TrailingLabel() const;
virtual void MouseDown(BPoint where); virtual BHandler* ResolveSpecifier(BMessage* message,
virtual void MouseUp(BPoint where); int32 index, BMessage* specifier,
virtual void WindowActivated(bool state); int32 what, const char* property);
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 status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* data);
virtual status_t Perform(perform_code d, void* arg); virtual status_t Perform(perform_code d, void* arg);
// Layout methods
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
private: private:
// FBC memebers // FBC memebers
virtual void _ReservedStatusBar2(); 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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _STRING_ITEM_H #ifndef _STRING_ITEM_H
@@ -12,12 +12,14 @@
class BStringItem : public BListItem { class BStringItem : public BListItem {
public: public:
BStringItem(const char* text, BStringItem(const char* text,
uint32 outlineLevel = 0, bool expanded = true); uint32 outlineLevel = 0,
bool expanded = true);
BStringItem(BMessage* archive); BStringItem(BMessage* archive);
virtual ~BStringItem(); virtual ~BStringItem();
static BArchivable* Instantiate(BMessage* archive); 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, virtual void DrawItem(BView* owner, BRect frame,
bool complete = false); bool complete = false);
@@ -29,12 +31,14 @@ public:
virtual status_t Perform(perform_code code, void* arg); virtual status_t Perform(perform_code code, void* arg);
private: private:
// FBC padding and forbidden methods
virtual void _ReservedStringItem1(); virtual void _ReservedStringItem1();
virtual void _ReservedStringItem2(); virtual void _ReservedStringItem2();
BStringItem(const BStringItem& item); BStringItem(const BStringItem& item);
BStringItem& operator=(const BStringItem& item); BStringItem& operator=(const BStringItem& item);
private:
char* fText; char* fText;
float fBaselineOffset; float fBaselineOffset;
uint32 _reserved[2]; uint32 _reserved[2];
+34 -29
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. * Distributed under the terms of the MIT License.
*
* Authors:
* Frans van Nispen (xlr8@tref.nl)
*/ */
#ifndef _STRING_VIEW_H #ifndef _STRING_VIEW_H
#define _STRING_VIEW_H #define _STRING_VIEW_H
@@ -16,16 +13,17 @@
class BStringView : public BView{ class BStringView : public BView{
public: public:
BStringView(BRect bounds, const char* name, BStringView(BRect bounds, const char* name,
const char* text, const char* text, uint32 resizeFlags
uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP, = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW); uint32 flags = B_WILL_DRAW);
BStringView(const char* name, const char* text, BStringView(const char* name, const char* text,
uint32 flags = B_WILL_DRAW); uint32 flags = B_WILL_DRAW);
BStringView(BMessage* data); BStringView(BMessage* archive);
virtual ~BStringView(); virtual ~BStringView();
static BArchivable* Instantiate(BMessage* data); static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* data, bool deep = true) const; virtual status_t Archive(BMessage* archive,
bool deep = true) const;
void SetText(const char* text); void SetText(const char* text);
const char* Text() const; const char* Text() const;
@@ -33,6 +31,22 @@ class BStringView : public BView{
alignment Alignment() const; alignment Alignment() const;
virtual void AttachedToWindow(); 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 Draw(BRect bounds);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
@@ -40,43 +54,34 @@ class BStringView : public BView{
virtual void MouseUp(BPoint point); virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit, virtual void MouseMoved(BPoint point, uint32 transit,
const BMessage* dragMessage); 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, virtual BHandler* ResolveSpecifier(BMessage* message,
BMessage* specifier, int32 form, int32 index, BMessage* specifier,
const char* property); int32 form, const char* property);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float* _width, float* _height);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
virtual status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* data);
virtual void SetFont(const BFont* font, virtual void SetFont(const BFont* font,
uint32 mask = B_FONT_ALL); uint32 mask = B_FONT_ALL);
virtual void InvalidateLayout(bool descendants = false);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
private: private:
virtual status_t Perform(perform_code d, void* arg); // FBC padding and forbidden methods
virtual status_t Perform(perform_code code, void* data);
virtual void _ReservedStringView1(); virtual void _ReservedStringView1();
virtual void _ReservedStringView2(); virtual void _ReservedStringView2();
virtual void _ReservedStringView3(); virtual void _ReservedStringView3();
BStringView& operator=(const BStringView& other);
private:
BSize _ValidatePreferredSize(); BSize _ValidatePreferredSize();
BStringView &operator=(const BStringView&); private:
char* fText; char* fText;
alignment fAlign; alignment fAlign;
BSize fPreferredSize; BSize fPreferredSize;
uint32 _reserved[1]; uint32 _reserved[1];
}; };
+21 -14
View File
@@ -1,6 +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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _TAB_VIEW_H #ifndef _TAB_VIEW_H
#define _TAB_VIEW_H #define _TAB_VIEW_H
@@ -51,6 +51,7 @@ public:
tab_position position, bool full = true); tab_position position, bool full = true);
private: private:
// FBC padding and forbidden methods
virtual void _ReservedTab1(); virtual void _ReservedTab1();
virtual void _ReservedTab2(); virtual void _ReservedTab2();
virtual void _ReservedTab3(); virtual void _ReservedTab3();
@@ -66,6 +67,7 @@ private:
BTab& operator=(const BTab&); BTab& operator=(const BTab&);
private:
bool fEnabled; bool fEnabled;
bool fSelected; bool fSelected;
bool fFocus; bool fFocus;
@@ -79,15 +81,15 @@ class BTabView : public BView {
public: public:
BTabView(const char* name, BTabView(const char* name,
button_width width = B_WIDTH_AS_USUAL, button_width width = B_WIDTH_AS_USUAL,
uint32 flags = B_FULL_UPDATE_ON_RESIZE | uint32 flags = B_FULL_UPDATE_ON_RESIZE
B_WILL_DRAW | B_NAVIGABLE_JUMP | | B_WILL_DRAW | B_NAVIGABLE_JUMP
B_FRAME_EVENTS | B_NAVIGABLE); | B_FRAME_EVENTS | B_NAVIGABLE);
BTabView(BRect frame, const char* name, BTabView(BRect frame, const char* name,
button_width width = B_WIDTH_AS_USUAL, button_width width = B_WIDTH_AS_USUAL,
uint32 resizingMode = B_FOLLOW_ALL, uint32 resizingMode = B_FOLLOW_ALL,
uint32 flags = B_FULL_UPDATE_ON_RESIZE | uint32 flags = B_FULL_UPDATE_ON_RESIZE
B_WILL_DRAW | B_NAVIGABLE_JUMP | | B_WILL_DRAW | B_NAVIGABLE_JUMP
B_FRAME_EVENTS | B_NAVIGABLE); | B_FRAME_EVENTS | B_NAVIGABLE);
virtual ~BTabView(); virtual ~BTabView();
BTabView(BMessage* archive); BTabView(BMessage* archive);
@@ -96,15 +98,12 @@ public:
bool deep = true) const; bool deep = true) const;
virtual status_t Perform(perform_code d, void* arg); virtual status_t Perform(perform_code d, void* arg);
virtual void WindowActivated(bool active);
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void AllAttached(); virtual void AllAttached();
virtual void AllDetached(); virtual void AllDetached();
virtual void DetachedFromWindow();
virtual void MessageReceived(BMessage* message); 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 KeyDown(const char* bytes, int32 numBytes);
virtual void MouseDown(BPoint point); virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point); virtual void MouseUp(BPoint point);
@@ -115,6 +114,7 @@ public:
virtual void Select(int32 tab); virtual void Select(int32 tab);
int32 Selection() const; int32 Selection() const;
virtual void WindowActivated(bool active);
virtual void MakeFocus(bool focused = true); virtual void MakeFocus(bool focused = true);
virtual void SetFocusTab(int32 tab, bool focused); virtual void SetFocusTab(int32 tab, bool focused);
int32 FocusTab() const; int32 FocusTab() const;
@@ -135,11 +135,15 @@ public:
virtual BSize MaxSize(); virtual BSize MaxSize();
virtual BSize PreferredSize(); virtual BSize PreferredSize();
virtual void FrameMoved(BPoint newLocation);
virtual void FrameResized(float width,float height);
virtual BHandler* ResolveSpecifier(BMessage* message, virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier, int32 index, BMessage* specifier,
int32 what, const char* property); int32 what, const char* property);
virtual status_t GetSupportedSuites(BMessage* message); virtual status_t GetSupportedSuites(BMessage* message);
// BTabView
virtual void AddTab(BView* target, BTab* tab = NULL); virtual void AddTab(BView* target, BTab* tab = NULL);
virtual BTab* RemoveTab(int32 tabIndex); virtual BTab* RemoveTab(int32 tabIndex);
@@ -157,9 +161,7 @@ public:
BView* ViewForTab(int32 tabIndex) const; BView* ViewForTab(int32 tabIndex) const;
private: private:
void _InitObject(bool layouted, button_width width); // FBC padding and forbidden methods
BSize _TabsMinSize() const;
virtual void _ReservedTabView1(); virtual void _ReservedTabView1();
virtual void _ReservedTabView2(); virtual void _ReservedTabView2();
virtual void _ReservedTabView3(); virtual void _ReservedTabView3();
@@ -176,6 +178,11 @@ private:
BTabView(const BTabView&); BTabView(const BTabView&);
BTabView& operator=(const BTabView&); BTabView& operator=(const BTabView&);
private:
void _InitObject(bool layouted, button_width width);
BSize _TabsMinSize() const;
private:
BList* fTabList; BList* fTabList;
BView* fContainerView; BView* fContainerView;
button_width fTabWidthSetting; button_width fTabWidthSetting;
+19 -14
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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _TEXT_CONTROL_H #ifndef _TEXT_CONTROL_H
@@ -14,6 +14,7 @@ namespace BPrivate {
class _BTextInput_; class _BTextInput_;
} }
class BTextControl : public BControl { class BTextControl : public BControl {
public: public:
BTextControl(BRect frame, const char* name, BTextControl(BRect frame, const char* name,
@@ -62,13 +63,14 @@ public:
virtual void FrameResized(float newWidth, float newHeight); virtual void FrameResized(float newWidth, float newHeight);
virtual void WindowActivated(bool active); virtual void WindowActivated(bool active);
virtual void GetPreferredSize(float* _width, float* _height); virtual void GetPreferredSize(float* _width,
float* _height);
virtual void ResizeToPreferred(); virtual void ResizeToPreferred();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, virtual BHandler* ResolveSpecifier(BMessage* message,
BMessage* specifier, int32 what, int32 index, BMessage* specifier,
const char* property); int32 what, const char* property);
virtual void MouseUp(BPoint point); virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit, virtual void MouseMoved(BPoint point, uint32 transit,
@@ -93,14 +95,7 @@ protected:
virtual void DoLayout(); virtual void DoLayout();
private: private:
class LabelLayoutItem; // FBC padding and forbidden methods
class TextViewLayoutItem;
struct LayoutData;
friend class _BTextInput_;
friend class LabelLayoutItem;
friend class TextViewLayoutItem;
virtual status_t Perform(perform_code d, void* arg); virtual status_t Perform(perform_code d, void* arg);
virtual void _ReservedTextControl1(); virtual void _ReservedTextControl1();
@@ -110,9 +105,19 @@ private:
BTextControl& operator=(const BTextControl& other); BTextControl& operator=(const BTextControl& other);
private:
class LabelLayoutItem;
class TextViewLayoutItem;
struct LayoutData;
friend class _BTextInput_;
friend class LabelLayoutItem;
friend class TextViewLayoutItem;
void _CommitValue(); void _CommitValue();
void _UpdateTextViewColors(bool enabled); void _UpdateTextViewColors(bool enabled);
void _InitData(const char* label, const char* initialText, void _InitData(const char* label,
const char* initialText,
BMessage* archive = NULL); BMessage* archive = NULL);
void _ValidateLayout(); void _ValidateLayout();
void _LayoutTextView(); void _LayoutTextView();
+37 -28
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007-2008, Haiku, Inc. All rights reserved. * Copyright 2007-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT License.
*/ */
#ifndef _TEXTVIEW_H #ifndef _TEXTVIEW_H
#define _TEXTVIEW_H #define _TEXTVIEW_H
@@ -38,7 +38,8 @@ enum undo_state {
namespace BPrivate { namespace BPrivate {
class TextGapBuffer; class TextGapBuffer;
} // namespace BPrivate }
class BTextView : public BView { class BTextView : public BView {
public: public:
@@ -59,12 +60,13 @@ public:
const rgb_color* initialColor, const rgb_color* initialColor,
uint32 flags); uint32 flags);
BTextView(BMessage* data); BTextView(BMessage* archive);
virtual ~BTextView(); virtual ~BTextView();
static BArchivable* Instantiate(BMessage* data); static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* data, bool deep = true) const; virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void DetachedFromWindow(); virtual void DetachedFromWindow();
@@ -80,11 +82,10 @@ public:
virtual void MakeFocus(bool focusState = true); virtual void MakeFocus(bool focusState = true);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, virtual BHandler* ResolveSpecifier(BMessage* message,
BMessage* specifier, int32 form, int32 index, BMessage* specifier,
const char* property); int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* data);
virtual status_t Perform(perform_code d, void* arg);
void SetText(const char* inText, void SetText(const char* inText,
const text_run_array* inRuns = NULL); const text_run_array* inRuns = NULL);
@@ -224,9 +225,6 @@ public:
protected: protected:
virtual void DoLayout(); virtual void DoLayout();
private:
void _ValidateLayoutData();
public: public:
virtual void AllAttached(); virtual void AllAttached();
virtual void AllDetached(); virtual void AllDetached();
@@ -256,6 +254,22 @@ protected:
BBitmap** _bitmap, BPoint* point, BBitmap** _bitmap, BPoint* point,
BHandler** _handler); 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: private:
class InlineInput; class InlineInput;
struct LayoutData; struct LayoutData;
@@ -273,21 +287,12 @@ private:
friend class TextTrackState; 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, void _InitObject(BRect textRect,
const BFont* initialFont, const BFont* initialFont,
const rgb_color* initialColor); const rgb_color* initialColor);
void _ValidateLayoutData();
void _HandleBackspace(); void _HandleBackspace();
void _HandleArrowKey(uint32 inArrowKey); void _HandleArrowKey(uint32 inArrowKey);
void _HandleDelete(); void _HandleDelete();
@@ -316,14 +321,17 @@ private:
int32 inLength, int32 inOffset, int32 inLength, int32 inOffset,
const text_run_array* inRuns); const text_run_array* inRuns);
void _DoDeleteText(int32 fromOffset, int32 toOffset); void _DoDeleteText(int32 fromOffset,
int32 toOffset);
void _DrawLine(BView* view, const int32 &startLine, void _DrawLine(BView* view, const int32 &startLine,
const int32& startOffset, const bool& erase, const int32& startOffset,
BRect& eraseRect, BRegion& inputRegion); const bool& erase, BRect& eraseRect,
BRegion& inputRegion);
void _DrawLines(int32 startLine, int32 endLine, void _DrawLines(int32 startLine, int32 endLine,
int32 startOffset = -1, bool erase = false); int32 startOffset = -1,
bool erase = false);
void _RequestDrawLines(int32 startLine, void _RequestDrawLines(int32 startLine,
int32 endLine, int32 startOffset = -1, int32 endLine, int32 startOffset = -1,
bool erase = false); bool erase = false);
@@ -398,6 +406,7 @@ private:
float verticalStep); float verticalStep);
void _ScrollTo(float x, float y); void _ScrollTo(float x, float y);
private:
BPrivate::TextGapBuffer* fText; BPrivate::TextGapBuffer* fText;
LineBuffer* fLines; LineBuffer* fLines;
StyleBuffer* fStyles; 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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _TWO_DIMENSIONAL_LAYOUT_H #ifndef _TWO_DIMENSIONAL_LAYOUT_H
#define _TWO_DIMENSIONAL_LAYOUT_H #define _TWO_DIMENSIONAL_LAYOUT_H
#include <Layout.h> #include <Layout.h>
class BLayoutContext; 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. * Distributed under the terms of the MIT License.
*
* Authors:
* Erik Jaesler (erik@cgsoftware.com)
*/ */
#ifndef _UNICODEBLOCKOBJECTS_H #ifndef _UNICODEBLOCKOBJECTS_H
#define _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. * Distributed under the terms of the MIT License.
*
* Authors:
* Erik Jaesler (erik@cgsoftware.com)
*/ */
#ifndef _VIEW_H #ifndef _VIEW_H
#define _VIEW_H #define _VIEW_H
@@ -45,7 +42,7 @@ enum {
B_LOCK_WINDOW_FOCUS = 0x00000001, B_LOCK_WINDOW_FOCUS = 0x00000001,
B_SUSPEND_VIEW_FOCUS = 0x00000002, B_SUSPEND_VIEW_FOCUS = 0x00000002,
B_NO_POINTER_HISTORY = 0x00000004, 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() // specified, both BWindow and BView::GetMouse()
// will filter out older mouse moved messages) // will filter out older mouse moved messages)
B_FULL_POINTER_HISTORY = 0x00000008 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); } { return ((r1 << 12) | (r2 << 8) | (r3 << 4) | r4); }
#define B_FOLLOW_NONE 0 #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_ALL B_FOLLOW_ALL_SIDES
#define B_FOLLOW_LEFT _rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_) #define B_FOLLOW_LEFT _rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_)
@@ -143,16 +141,17 @@ public:
uint32 resizeMask, uint32 flags); uint32 resizeMask, uint32 flags);
virtual ~BView(); virtual ~BView();
BView(BMessage* data); BView(BMessage* archive);
static BArchivable* Instantiate(BMessage* data); static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* data, bool deep = true) const; virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void AllAttached(); virtual void AllAttached();
virtual void DetachedFromWindow(); virtual void DetachedFromWindow();
virtual void AllDetached(); virtual void AllDetached();
virtual void MessageReceived(BMessage* msg); virtual void MessageReceived(BMessage* message);
void AddChild(BView* child, BView* before = NULL); void AddChild(BView* child, BView* before = NULL);
bool AddChild(BLayoutItem* child); bool AddChild(BLayoutItem* child);
@@ -275,7 +274,8 @@ public:
uchar a = 255); uchar a = 255);
rgb_color LowColor() const; 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); float miterLimit = B_DEFAULT_MITER_LIMIT);
join_mode LineJoinMode() const; join_mode LineJoinMode() const;
cap_mode LineCapMode() const; cap_mode LineCapMode() const;
@@ -292,7 +292,8 @@ public:
void MovePenTo(float x, float y); void MovePenTo(float x, float y);
void MovePenBy(float x, float y); void MovePenBy(float x, float y);
BPoint PenLocation() const; 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, void StrokeLine(BPoint a, BPoint b,
pattern p = B_SOLID_HIGH); pattern p = B_SOLID_HIGH);
void BeginLineArray(int32 count); void BeginLineArray(int32 count);
@@ -300,37 +301,45 @@ public:
void EndLineArray(); void EndLineArray();
void StrokePolygon(const BPolygon* polygon, void StrokePolygon(const BPolygon* polygon,
bool closed = true, pattern p = B_SOLID_HIGH); bool closed = true,
void StrokePolygon(const BPoint* ptArray, int32 numPts, pattern p = B_SOLID_HIGH);
bool closed = true, pattern p = B_SOLID_HIGH); void StrokePolygon(const BPoint* ptArray,
void StrokePolygon(const BPoint* ptArray, int32 numPts, int32 numPts, bool closed = true,
BRect bounds, 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); pattern p = B_SOLID_HIGH);
void FillPolygon(const BPolygon* polygon, void FillPolygon(const BPolygon* polygon,
pattern p = B_SOLID_HIGH); 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); pattern p = B_SOLID_HIGH);
void FillPolygon(const BPoint* ptArray, int32 numPts,
BRect bounds, pattern p = B_SOLID_HIGH);
void FillPolygon(const BPolygon* polygon, void FillPolygon(const BPolygon* polygon,
const BGradient& gradient); 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); const BGradient& gradient);
void FillPolygon(const BPoint* ptArray, int32 numPts,
BRect bounds, const BGradient& gradient);
void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, void StrokeTriangle(BPoint pt1, BPoint pt2,
BRect bounds, pattern p = B_SOLID_HIGH); BPoint pt3, BRect bounds,
void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
pattern p = B_SOLID_HIGH); 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); pattern p = B_SOLID_HIGH);
void FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, void FillTriangle(BPoint pt1, BPoint pt2,
BRect bounds, pattern p = B_SOLID_HIGH); BPoint pt3, const BGradient& gradient);
void FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, void FillTriangle(BPoint pt1, BPoint pt2,
BPoint pt3, BRect bounds,
const BGradient& gradient); 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 StrokeRect(BRect r, pattern p = B_SOLID_HIGH);
void FillRect(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, void StrokeRoundRect(BRect r, float xRadius,
float yRadius, pattern p = B_SOLID_HIGH); float yRadius, pattern p = B_SOLID_HIGH);
void FillRoundRect(BRect r, float xRadius, float yRadius, void FillRoundRect(BRect r, float xRadius,
pattern p = B_SOLID_HIGH); float yRadius, pattern p = B_SOLID_HIGH);
void FillRoundRect(BRect r, float xRadius, float yRadius, void FillRoundRect(BRect r, float xRadius,
const BGradient& gradient); float yRadius, const BGradient& gradient);
void StrokeEllipse(BPoint center, float xRadius, void StrokeEllipse(BPoint center, float xRadius,
float yRadius, pattern p = B_SOLID_HIGH); 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, void FillEllipse(BPoint center, float xRadius,
float yRadius, pattern p = B_SOLID_HIGH); float yRadius, pattern p = B_SOLID_HIGH);
void FillEllipse(BRect r, pattern p = B_SOLID_HIGH); void FillEllipse(BRect r, pattern p = B_SOLID_HIGH);
void FillEllipse(BPoint center, float xRadius, void FillEllipse(BPoint center, float xRadius,
float yRadius, const BGradient& gradient); 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, void StrokeArc(BPoint center, float xRadius,
float yRadius, float startAngle, float arcAngle, float yRadius, float startAngle,
pattern p = B_SOLID_HIGH); float arcAngle, pattern p = B_SOLID_HIGH);
void StrokeArc(BRect r, float startAngle, void StrokeArc(BRect r, float startAngle,
float arcAngle, pattern p = B_SOLID_HIGH); float arcAngle, pattern p = B_SOLID_HIGH);
void FillArc(BPoint center, float xRadius, float yRadius, void FillArc(BPoint center, float xRadius,
float startAngle, float arcAngle, float yRadius, float startAngle,
pattern p = B_SOLID_HIGH); float arcAngle, pattern p = B_SOLID_HIGH);
void FillArc(BRect r, float startAngle, float arcAngle, void FillArc(BRect r, float startAngle,
pattern p = B_SOLID_HIGH); float arcAngle, pattern p = B_SOLID_HIGH);
void FillArc(BPoint center, float xRadius, float yRadius, void FillArc(BPoint center, float xRadius,
float startAngle, float arcAngle, float yRadius, float startAngle,
const BGradient& gradient); float arcAngle, const BGradient& gradient);
void FillArc(BRect r, float startAngle, float arcAngle, void FillArc(BRect r, float startAngle,
const BGradient& gradient); float arcAngle, const BGradient& gradient);
void StrokeBezier(BPoint* controlPoints, void StrokeBezier(BPoint* controlPoints,
pattern p = B_SOLID_HIGH); pattern p = B_SOLID_HIGH);
@@ -383,8 +394,10 @@ public:
void StrokeShape(BShape* shape, void StrokeShape(BShape* shape,
pattern p = B_SOLID_HIGH); pattern p = B_SOLID_HIGH);
void FillShape(BShape* shape, pattern p = B_SOLID_HIGH); void FillShape(BShape* shape,
void FillShape(BShape* shape, const BGradient& gradient); pattern p = B_SOLID_HIGH);
void FillShape(BShape* shape,
const BGradient& gradient);
void CopyBits(BRect src, BRect dst); void CopyBits(BRect src, BRect dst);
@@ -414,12 +427,14 @@ public:
void DrawChar(char aChar, BPoint location); void DrawChar(char aChar, BPoint location);
void DrawString(const char* aString, void DrawString(const char* aString,
escapement_delta* delta = NULL); escapement_delta* delta = NULL);
void DrawString(const char* aString, BPoint location, void DrawString(const char* aString,
BPoint location,
escapement_delta* delta = NULL); escapement_delta* delta = NULL);
void DrawString(const char* aString, int32 length, void DrawString(const char* aString, int32 length,
escapement_delta* delta = NULL); escapement_delta* delta = NULL);
void DrawString(const char* aString, int32 length, 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, virtual void SetFont(const BFont* font,
uint32 mask = B_FONT_ALL); uint32 mask = B_FONT_ALL);
@@ -428,7 +443,8 @@ public:
void TruncateString(BString* in_out, uint32 mode, void TruncateString(BString* in_out, uint32 mode,
float width) const; float width) const;
float StringWidth(const char* string) 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[], void GetStringWidths(char* stringArray[],
int32 lengthArray[], int32 numStrings, int32 lengthArray[], int32 numStrings,
float widthArray[]) const; float widthArray[]) const;
@@ -454,12 +470,13 @@ public:
void DrawPictureAsync(const BPicture* a_picture); void DrawPictureAsync(const BPicture* a_picture);
void DrawPictureAsync(const BPicture* a_picture, void DrawPictureAsync(const BPicture* a_picture,
BPoint where); BPoint where);
void DrawPictureAsync(const char* filename, long offset, void DrawPictureAsync(const char* filename,
BPoint where); long offset, BPoint where);
status_t SetEventMask(uint32 mask, uint32 options = 0); status_t SetEventMask(uint32 mask, uint32 options = 0);
uint32 EventMask(); uint32 EventMask();
status_t SetMouseEventMask(uint32 mask, uint32 options = 0); status_t SetMouseEventMask(uint32 mask,
uint32 options = 0);
virtual void SetFlags(uint32 flags); virtual void SetFlags(uint32 flags);
uint32 Flags() const; uint32 Flags() const;
@@ -558,6 +575,17 @@ protected:
private: private:
void _Layout(bool force, BLayoutContext* context); 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: private:
struct LayoutData; struct LayoutData;
@@ -569,15 +597,6 @@ private:
friend class BTabView; friend class BTabView;
friend class BWindow; 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, void _InitData(BRect frame, const char* name,
uint32 resizeMask, uint32 flags); uint32 resizeMask, uint32 flags);
status_t _SetViewBitmap(const BBitmap* bitmap, status_t _SetViewBitmap(const BBitmap* bitmap,
@@ -603,15 +622,16 @@ private:
void _ParentResizedBy(int32 deltaWidth, void _ParentResizedBy(int32 deltaWidth,
int32 deltaHeight); int32 deltaHeight);
void _ConvertToScreen(BPoint* pt, bool checkLock) const; void _ConvertToScreen(BPoint* pt,
bool checkLock) const;
void _ConvertFromScreen(BPoint* pt, void _ConvertFromScreen(BPoint* pt,
bool checkLock) const; bool checkLock) const;
void _ConvertToParent(BPoint* pt, bool checkLock) const; void _ConvertToParent(BPoint* pt,
bool checkLock) const;
void _ConvertFromParent(BPoint* pt, void _ConvertFromParent(BPoint* pt,
bool checkLock) const; bool checkLock) const;
void _Activate(bool state); void _Activate(bool state);
void _Attach(); void _Attach();
void _Detach(); void _Detach();
@@ -625,7 +645,8 @@ private:
void _FlushIfNotInTransaction(); void _FlushIfNotInTransaction();
bool _CreateSelf(); bool _CreateSelf();
bool _AddChildToList(BView* child, BView* before = NULL); bool _AddChildToList(BView* child,
BView* before = NULL);
bool _RemoveChildFromList(BView* child); bool _RemoveChildFromList(BView* child);
bool _AddChild(BView *child, BView *before); bool _AddChild(BView *child, BView *before);
@@ -672,7 +693,8 @@ private:
}; };
// inline definitions ---------------------------------------------------------- // #pragma mark - inline definitions
inline void inline void
BView::ScrollTo(float x, float y) BView::ScrollTo(float x, float y)
@@ -680,6 +702,7 @@ BView::ScrollTo(float x, float y)
ScrollTo(BPoint(x, y)); ScrollTo(BPoint(x, y));
} }
inline void inline void
BView::SetViewColor(uchar r, uchar g, uchar b, uchar a) 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); SetViewColor(color);
} }
inline void inline void
BView::SetHighColor(uchar r, uchar g, uchar b, uchar a) 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); SetHighColor(color);
} }
inline void inline void
BView::SetLowColor(uchar r, uchar g, uchar b, uchar a) BView::SetLowColor(uchar r, uchar g, uchar b, uchar a)
{ {
+47 -39
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. * Distributed under the terms of the MIT License.
*
* Authors:
* Adrian Oanca <adioanca@cotty.iren.ro>
*/ */
#ifndef _WINDOW_H #ifndef _WINDOW_H
#define _WINDOW_H #define _WINDOW_H
@@ -90,7 +87,6 @@ enum {
#define B_CURRENT_WORKSPACE 0 #define B_CURRENT_WORKSPACE 0
#define B_ALL_WORKSPACES 0xffffffff #define B_ALL_WORKSPACES 0xffffffff
//----------------------------------------------------------------
class BWindow : public BLooper { class BWindow : public BLooper {
public: public:
@@ -98,13 +94,15 @@ public:
window_type type, uint32 flags, window_type type, uint32 flags,
uint32 workspace = B_CURRENT_WORKSPACE); uint32 workspace = B_CURRENT_WORKSPACE);
BWindow(BRect frame, const char* title, BWindow(BRect frame, const char* title,
window_look look, window_feel feel, uint32 flags, window_look look, window_feel feel,
uint32 workspace = B_CURRENT_WORKSPACE); uint32 flags, uint32 workspace
= B_CURRENT_WORKSPACE);
virtual ~BWindow(); virtual ~BWindow();
BWindow(BMessage* data); BWindow(BMessage* archive);
static BArchivable* Instantiate(BMessage* data); static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* data, bool deep = true) const; virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void Quit(); virtual void Quit();
void Close() { Quit(); } void Close() { Quit(); }
@@ -120,13 +118,15 @@ public:
virtual void FrameMoved(BPoint newPosition); virtual void FrameMoved(BPoint newPosition);
virtual void WorkspacesChanged(uint32 oldWorkspaces, virtual void WorkspacesChanged(uint32 oldWorkspaces,
uint32 newWorkspaces); 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 FrameResized(float newWidth, float newHeight);
virtual void Minimize(bool minimize); virtual void Minimize(bool minimize);
virtual void Zoom(BPoint origin, float width, float height); virtual void Zoom(BPoint origin, float width, float height);
void Zoom(); void Zoom();
void SetZoomLimits(float maxWidth, float maxHeight); 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); void SetPulseRate(bigtime_t rate);
bigtime_t PulseRate() const; bigtime_t PulseRate() const;
@@ -185,9 +185,11 @@ public:
void EnableUpdates(); void EnableUpdates();
void BeginViewTransaction(); void BeginViewTransaction();
// referred as OpenViewTransaction() in BeBook // referred as OpenViewTransaction()
// in BeBook
void EndViewTransaction(); void EndViewTransaction();
// referred as CommitViewTransaction() in BeBook // referred as CommitViewTransaction()
// in BeBook
BRect Bounds() const; BRect Bounds() const;
BRect Frame() const; BRect Frame() const;
@@ -214,15 +216,15 @@ public:
BView* LastMouseMovedView() const; BView* LastMouseMovedView() const;
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, virtual BHandler* ResolveSpecifier(BMessage* message,
BMessage* specifier, int32 form, int32 index, BMessage* specifier,
const char* property); int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* data);
status_t AddToSubset(BWindow* window); status_t AddToSubset(BWindow* window);
status_t RemoveFromSubset(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); status_t SetType(window_type type);
window_type Type() const; window_type Type() const;
@@ -239,14 +241,16 @@ public:
bool IsModal() const; bool IsModal() const;
bool IsFloating() const; bool IsFloating() const;
status_t SetWindowAlignment(window_alignment mode, int32 h, status_t SetWindowAlignment(window_alignment mode,
int32 hOffset = 0, int32 width = 0, int32 h, int32 hOffset = 0,
int32 widthOffset = 0, int32 v = 0, int32 width = 0, int32 widthOffset = 0,
int32 vOffset = 0, int32 height = 0, int32 v = 0, int32 vOffset = 0,
int32 heightOffset = 0); int32 height = 0, int32 heightOffset = 0);
status_t GetWindowAlignment(window_alignment* mode = NULL, status_t GetWindowAlignment(
window_alignment* mode = NULL,
int32* h = NULL, int32* hOffset = 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* v = NULL, int32* vOffset = NULL,
int32* height = NULL, int32* height = NULL,
int32* heightOffset = NULL) const; int32* heightOffset = NULL) const;
@@ -259,6 +263,20 @@ public:
void InvalidateLayout(bool descendants = false); void InvalidateLayout(bool descendants = false);
private:
// FBC padding and forbidden methods
virtual void _ReservedWindow2();
virtual void _ReservedWindow3();
virtual void _ReservedWindow4();
virtual void _ReservedWindow5();
virtual void _ReservedWindow6();
virtual void _ReservedWindow7();
virtual void _ReservedWindow8();
BWindow();
BWindow(BWindow&);
BWindow& operator=(BWindow&);
private: private:
typedef BLooper inherited; typedef BLooper inherited;
struct unpack_cookie; struct unpack_cookie;
@@ -275,18 +293,6 @@ private:
friend void _set_menu_sem_(BWindow* w, sem_id sem); friend void _set_menu_sem_(BWindow* w, sem_id sem);
friend status_t _safe_get_server_token_(const BLooper*, int32*); 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); BWindow(BRect frame, int32 bitmapToken);
void _InitData(BRect frame, const char* title, void _InitData(BRect frame, const char* title,
window_look look, window_feel feel, window_look look, window_feel feel,
@@ -316,7 +322,8 @@ private:
void _DequeueAll(); void _DequeueAll();
window_type _ComposeType(window_look look, window_type _ComposeType(window_look look,
window_feel feel) const; window_feel feel) const;
void _DecomposeType(window_type type, window_look* look, void _DecomposeType(window_type type,
window_look* look,
window_feel* feel) const; window_feel* feel) const;
void SetIsFilePanel(bool yes); void SetIsFilePanel(bool yes);
@@ -334,7 +341,8 @@ private:
BView* _LastViewChild(BView* parent); BView* _LastViewChild(BView* parent);
BView* _FindNextNavigable(BView* focus, uint32 flags); BView* _FindNextNavigable(BView* focus, uint32 flags);
BView* _FindPreviousNavigable(BView *focus, uint32 flags); BView* _FindPreviousNavigable(BView* focus,
uint32 flags);
void _Switcher(int32 rawKey, uint32 modifiers, void _Switcher(int32 rawKey, uint32 modifiers,
bool repeat); bool repeat);
bool _HandleKeyDown(BMessage* event); 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. * Distributed under the terms of the MIT license.
* *
* Authors: * Authors:
@@ -323,6 +323,9 @@ BScrollBar::Archive(BMessage *data, bool deep) const
} }
// #pragma mark -
void void
BScrollBar::AttachedToWindow() BScrollBar::AttachedToWindow()
{ {
+332 -320
View File
@@ -85,57 +85,7 @@ BScrollView::~BScrollView()
} }
void // #pragma mark -
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());
}
BArchivable* BArchivable*
@@ -245,21 +195,24 @@ BScrollView::Draw(BRect updateRect)
} }
if (fBorder == B_PLAIN_BORDER) { 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()); StrokeRect(Bounds());
return; return;
} else if (fBorder != B_FANCY_BORDER) } else if (fBorder != B_FANCY_BORDER)
return; return;
BRect bounds = Bounds(); 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)); StrokeRect(bounds.InsetByCopy(1, 1));
if (fHighlighted && Window()->IsActive()) { if (fHighlighted && Window()->IsActive()) {
SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR)); SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR));
StrokeRect(bounds); StrokeRect(bounds);
} else { } 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()); StrokeLine(bounds.LeftBottom(), bounds.LeftTop());
bounds.left++; bounds.left++;
StrokeLine(bounds.LeftTop(), bounds.RightTop()); StrokeLine(bounds.LeftTop(), bounds.RightTop());
@@ -273,6 +226,214 @@ BScrollView::Draw(BRect updateRect)
} }
// #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* BScrollBar*
BScrollView::ScrollBar(orientation posture) const BScrollView::ScrollBar(orientation posture) const
{ {
@@ -432,119 +593,134 @@ BScrollView::Target() const
} }
void // #pragma mark -
BScrollView::MessageReceived(BMessage *message)
BHandler*
BScrollView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier,
int32 form, const char* property)
{ {
switch (message->what) { return BView::ResolveSpecifier(msg, index, specifier, form, property);
default: }
BView::MessageReceived(message);
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;
} }
} }
return BView::Perform(code, _data);
}
// #pragma mark -
void void
BScrollView::MouseDown(BPoint point) BScrollView::_Init(bool horizontal, bool vertical)
{ {
BView::MouseDown(point); 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) {
void fHorizontalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_HSB_",
BScrollView::MouseUp(BPoint point) fTarget, 0, 1000, B_HORIZONTAL);
{ AddChild(fHorizontalScrollBar);
BView::MouseUp(point);
} }
if (vertical) {
void fVerticalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_VSB_",
BScrollView::MouseMoved(BPoint point, uint32 code, const BMessage *dragMessage) fTarget, 0, 1000, B_VERTICAL);
{ AddChild(fVerticalScrollBar);
BView::MouseMoved(point, code, dragMessage);
} }
_AlignScrollBars(horizontal, vertical, targetFrame);
void fPreviousWidth = uint16(Bounds().Width());
BScrollView::FrameMoved(BPoint position) fPreviousHeight = uint16(Bounds().Height());
{
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());
}
void
BScrollView::ResizeToPreferred()
{
if (Window() == NULL)
return;
BView::ResizeToPreferred();
}
void
BScrollView::GetPreferredSize(float *_width, float *_height)
{
BSize size = PreferredSize();
if (_width)
*_width = size.width;
if (_height)
*_height = size.height;
} }
@@ -671,8 +847,8 @@ BScrollView::_ComputeFrame(BRect frame, bool horizontal, bool vertical,
BScrollView::_ComputeFrame(BView *target, bool horizontal, bool vertical, BScrollView::_ComputeFrame(BView *target, bool horizontal, bool vertical,
border_style border) border_style border)
{ {
return _ComputeFrame(target != NULL ? target->Frame() : BRect(0, 0, 16, 16), return _ComputeFrame(target != NULL ? target->Frame()
horizontal, vertical, border); : BRect(0, 0, 16, 16), horizontal, vertical, border);
} }
@@ -705,155 +881,7 @@ BScrollView::_ModifyFlags(int32 flags, border_style border)
} }
void // #pragma mark -
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);
}
BScrollView & 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::_ReservedScrollView1() {}
void BScrollView::_ReservedScrollView2() {} void BScrollView::_ReservedScrollView2() {}
void BScrollView::_ReservedScrollView3() {} void BScrollView::_ReservedScrollView3() {}
+221 -194
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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -29,7 +29,8 @@ static const rgb_color kDefaultBarColor = {50, 150, 255, 255};
BStatusBar::BStatusBar(BRect frame, const char *name, const char *label, BStatusBar::BStatusBar(BRect frame, const char *name, const char *label,
const char *trailingLabel) 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), fLabel(label),
fTrailingLabel(trailingLabel) fTrailingLabel(trailingLabel)
{ {
@@ -39,7 +40,8 @@ BStatusBar::BStatusBar(BRect frame, const char *name, const char *label,
BStatusBar::BStatusBar(const char *name, const char *label, BStatusBar::BStatusBar(const char *name, const char *label,
const char *trailingLabel) 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), B_WILL_DRAW | B_SUPPORTS_LAYOUT),
fLabel(label), fLabel(label),
fTrailingLabel(trailingLabel) fTrailingLabel(trailingLabel)
@@ -49,7 +51,8 @@ BStatusBar::BStatusBar(const char *name, const char *label,
BStatusBar::BStatusBar(BMessage *archive) BStatusBar::BStatusBar(BMessage *archive)
: BView(archive) :
BView(archive)
{ {
_InitObject(); _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 * BArchivable *
BStatusBar::Instantiate(BMessage *archive) BStatusBar::Instantiate(BMessage *archive)
{ {
@@ -139,6 +126,9 @@ BStatusBar::Archive(BMessage *archive, bool deep) const
} }
// #pragma mark -
void void
BStatusBar::AttachedToWindow() BStatusBar::AttachedToWindow()
{ {
@@ -164,42 +154,124 @@ BStatusBar::AttachedToWindow()
void void
BStatusBar::MessageReceived(BMessage *message) BStatusBar::DetachedFromWindow()
{ {
switch(message->what) { BView::DetachedFromWindow();
case B_UPDATE_STATUS_BAR: }
void
BStatusBar::AllAttached()
{ {
float delta; BView::AllAttached();
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:
void
BStatusBar::AllDetached()
{ {
const char *label = NULL, *trailing_label = NULL; BView::AllDetached();
message->FindString("label", &label);
message->FindString("trailing_label", &trailing_label);
Reset(label, trailing_label);
break;
} }
default:
BView::MessageReceived(message); // #pragma mark -
break;
void
BStatusBar::WindowActivated(bool state)
{
BView::WindowActivated(state);
}
void
BStatusBar::MakeFocus(bool state)
{
BView::MakeFocus(state);
}
// #pragma mark -
void
BStatusBar::GetPreferredSize(float* _width, float* _height)
{
if (_width) {
// AttachedToWindow() might not have been called yet
*_width = ceilf(StringWidth(fLabel.String()))
+ ceilf(StringWidth(fTrailingLabel.String()))
+ ceilf(StringWidth(fText.String()))
+ ceilf(StringWidth(fTrailingText.String()))
+ 5;
}
if (_height) {
font_height fontHeight;
GetFontHeight(&fontHeight);
*_height = ceilf(fontHeight.ascent + fontHeight.descent) + 6
+ BarHeight();
} }
} }
BSize
BStatusBar::MinSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height));
}
BSize
BStatusBar::MaxSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
BSize(B_SIZE_UNLIMITED, height));
}
BSize
BStatusBar::PreferredSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height));
}
void
BStatusBar::ResizeToPreferred()
{
BView::ResizeToPreferred();
}
void
BStatusBar::FrameMoved(BPoint newPosition)
{
BView::FrameMoved(newPosition);
}
void
BStatusBar::FrameResized(float newWidth, float newHeight)
{
BView::FrameResized(newWidth, newHeight);
Invalidate();
}
// #pragma mark -
void void
BStatusBar::Draw(BRect updateRect) 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 void
BStatusBar::SetBarColor(rgb_color color) 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 void
BStatusBar::SetTo(float value, const char* text, const char* trailingText) 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 float
BStatusBar::CurrentValue() const BStatusBar::CurrentValue() const
{ {
@@ -509,54 +642,7 @@ BStatusBar::TrailingLabel() const
} }
void // #pragma mark -
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();
}
BHandler * 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 status_t
BStatusBar::GetSupportedSuites(BMessage* data) 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 status_t
BStatusBar::Perform(perform_code code, void* _data) BStatusBar::Perform(perform_code code, void* _data)
{ {
@@ -711,6 +716,9 @@ BStatusBar::Perform(perform_code code, void* _data)
} }
// #pragma mark -
extern "C" void extern "C" void
_ReservedStatusBar1__10BStatusBar(BStatusBar* self, float value, _ReservedStatusBar1__10BStatusBar(BStatusBar* self, float value,
const char* text, const char* trailingText) 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 void
BStatusBar::_SetTextData(BString& text, const char* source, BStatusBar::_SetTextData(BString& text, const char* source,
const BString& combineWith, bool rightAligned) 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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -64,6 +64,12 @@ BStringView::BStringView(BMessage* data)
} }
BStringView::~BStringView()
{
free(fText);
}
BArchivable* BArchivable*
BStringView::Instantiate(BMessage* data) 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 void
BStringView::SetText(const char* text) 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* BHandler*
BStringView::ResolveSpecifier(BMessage* msg, int32 index, BStringView::ResolveSpecifier(BMessage* msg, int32 index,
BMessage* specifier, int32 form, const char* property) 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 status_t
BStringView::GetSupportedSuites(BMessage* message) BStringView::GetSupportedSuites(BMessage* message)
{ {
@@ -303,38 +349,7 @@ BStringView::SetFont(const BFont* font, uint32 mask)
} }
void // #pragma mark -
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());
}
status_t status_t
@@ -406,6 +421,10 @@ BStringView::operator=(const BStringView&)
return *this; return *this;
} }
// #pragma mark -
BSize BSize
BStringView::_ValidatePreferredSize() BStringView::_ValidatePreferredSize()
{ {
+45 -33
View File
@@ -1,6 +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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Marc Flerackers (mflerackers@androme.be) * 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) 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 void
BTabView::AttachedToWindow() BTabView::AttachedToWindow()
{ {
@@ -542,6 +532,13 @@ BTabView::AttachedToWindow()
} }
void
BTabView::DetachedFromWindow()
{
BView::DetachedFromWindow();
}
void void
BTabView::AllAttached() BTabView::AllAttached()
{ {
@@ -556,11 +553,7 @@ BTabView::AllDetached()
} }
void // #pragma mark -
BTabView::DetachedFromWindow()
{
BView::DetachedFromWindow();
}
void 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 void
BTabView::KeyDown(const char *bytes, int32 numBytes) 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 void
BTabView::MakeFocus(bool focused) BTabView::MakeFocus(bool focused)
{ {
@@ -1060,6 +1049,16 @@ BTabView::SetResizingMode(uint32 mode)
} }
// #pragma mark -
void
BTabView::ResizeToPreferred()
{
BView::ResizeToPreferred();
}
void void
BTabView::GetPreferredSize(float *width, float *height) BTabView::GetPreferredSize(float *width, float *height)
{ {
@@ -1104,12 +1103,22 @@ BTabView::PreferredSize()
void 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 * BHandler *
BTabView::ResolveSpecifier(BMessage *message, int32 index, BTabView::ResolveSpecifier(BMessage *message, int32 index,
BMessage *specifier, int32 what, const char *property) BMessage *specifier, int32 what, const char *property)
@@ -1136,6 +1145,9 @@ BTabView::GetSupportedSuites(BMessage *message)
} }
// #pragma mark -
void void
BTabView::AddTab(BView *target, BTab *tab) BTabView::AddTab(BView *target, BTab *tab)
{ {