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 (erik@cgsoftware.com)
*/ */
#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
+74 -70
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
@@ -16,92 +16,96 @@ class BWindow;
class BMenuItem : public BArchivable, public BInvoker { 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,
BMenuItem(BMessage* data); BMessage* message = NULL);
virtual ~BMenuItem(); BMenuItem(BMessage* data);
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);
virtual void SetMarked(bool marked); virtual void SetMarked(bool marked);
virtual void SetTrigger(char trigger); virtual void SetTrigger(char trigger);
virtual void SetShortcut(char shortcut, uint32 modifiers); virtual void SetShortcut(char shortcut, uint32 modifiers);
const char* Label() const; const char* Label() const;
bool IsEnabled() const; bool IsEnabled() const;
bool IsMarked() const; bool IsMarked() const;
char Trigger() const; char Trigger() const;
char Shortcut(uint32* _modifiers = NULL) const; char Shortcut(uint32* _modifiers = NULL) const;
BMenu* Submenu() const; BMenu* Submenu() const;
BMenu* Menu() const; BMenu* Menu() const;
BRect Frame() const; BRect Frame() const;
protected: protected:
virtual void GetContentSize(float* _width, float* _height); virtual void GetContentSize(float* _width, float* _height);
virtual void TruncateLabel(float maxWidth, char* newLabel); virtual void TruncateLabel(float maxWidth, char* newLabel);
virtual void DrawContent(); virtual void DrawContent();
virtual void Draw(); virtual void Draw();
virtual void Highlight(bool enabled); virtual void Highlight(bool enabled);
bool IsSelected() const; bool IsSelected() const;
BPoint ContentLocation() const; BPoint ContentLocation() const;
private: private:
friend class BMenu; friend class BMenu;
friend class BPopUpMenu; friend class BPopUpMenu;
friend class BMenuBar; friend class BMenuBar;
virtual void _ReservedMenuItem1(); virtual void _ReservedMenuItem1();
virtual void _ReservedMenuItem2(); virtual void _ReservedMenuItem2();
virtual void _ReservedMenuItem3(); virtual void _ReservedMenuItem3();
virtual void _ReservedMenuItem4(); virtual void _ReservedMenuItem4();
void Install(BWindow* window); void Install(BWindow* window);
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);
BMenuItem& operator=(const BMenuItem& other); BMenuItem& operator=(const BMenuItem& other);
void _InitData(); void _InitData();
void _InitMenuData(BMenu* menu); void _InitMenuData(BMenu* menu);
void _DrawMarkSymbol(rgb_color backgroundColor); void _DrawMarkSymbol(rgb_color backgroundColor);
void _DrawShortcutSymbol(); void _DrawShortcutSymbol();
void _DrawSubmenuSymbol(rgb_color backgroundColor); void _DrawSubmenuSymbol(rgb_color backgroundColor);
void _DrawControlChar(char shortcut, BPoint where); void _DrawControlChar(char shortcut, BPoint where);
char* fLabel; private:
BMenu* fSubmenu; char* fLabel;
BWindow* fWindow; BMenu* fSubmenu;
BMenu* fSuper; BWindow* fWindow;
BRect fBounds; BMenu* fSuper;
uint32 fModifiers; BRect fBounds;
float fCachedWidth; uint32 fModifiers;
int16 fTriggerIndex; float fCachedWidth;
char fUserTrigger; int16 fTriggerIndex;
char fShortcutChar; char fUserTrigger;
bool fMark; char fShortcutChar;
bool fEnabled; bool fMark;
bool fSelected; bool fEnabled;
uint32 fTrigger; bool fSelected;
uint32 fTrigger;
uint32 _reserved[3]; uint32 _reserved[3];
}; };
// BSeparatorItem now has its own declaration file, but for source // BSeparatorItem now has its own declaration file, but for source
// 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
+38 -37
View File
@@ -1,87 +1,88 @@
/* /*
* Copyright 2001-2007, Haiku, Inc. All Rights Reserved. * Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * 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;
}; };
extern const BPoint B_ORIGIN; extern const BPoint B_ORIGIN;
// returns (0,0) // returns (0, 0)
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
+62 -64
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>
@@ -17,77 +13,79 @@
class BRect { class BRect {
public: public:
float left; float left;
float top; float top;
float right; float right;
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, BSize size); BRect(BPoint leftTop, BPoint rightBottom);
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;
BPoint LeftTop() const; BPoint LeftTop() const;
BPoint RightBottom() const; BPoint RightBottom() const;
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;
bool IsValid() const; bool IsValid() const;
float Width() const; float Width() const;
int32 IntegerWidth() const; int32 IntegerWidth() const;
float Height() const; float Height() const;
int32 IntegerHeight() const; int32 IntegerHeight() const;
BSize Size() const; BSize Size() const;
bool Intersects(BRect r) const; bool Intersects(BRect r) const;
bool Contains(BPoint p) const; bool Contains(BPoint p) const;
bool Contains(BRect r) const; bool Contains(BRect r) const;
}; };
// inline definitions ---------------------------------------------------------- // #pragma mark - inline definitions
inline BPoint inline BPoint
BRect::LeftTop() const BRect::LeftTop() const
@@ -136,7 +134,7 @@ BRect::BRect(float l, float t, float r, float b)
inline inline
BRect::BRect(const BRect &r) BRect::BRect(const BRect& r)
{ {
left = r.left; left = r.left;
top = r.top; top = r.top;
@@ -165,7 +163,7 @@ BRect::BRect(BPoint leftTop, BSize size)
} }
inline BRect & inline BRect&
BRect::operator=(const BRect& from) BRect::operator=(const BRect& from)
{ {
left = from.left; left = from.left;
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007, Haiku. All rights reserved. * Copyright 2007, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
+67 -55
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,71 +19,83 @@ 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);
BScreen(BWindow* window); BScreen(BWindow* window);
~BScreen(); ~BScreen();
bool IsValid(); bool IsValid();
status_t SetToNext(); status_t SetToNext();
color_space ColorSpace(); color_space ColorSpace();
BRect Frame(); BRect Frame();
screen_id ID(); screen_id ID();
status_t WaitForRetrace(); status_t WaitForRetrace();
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,
BRect* frame = NULL); bool drawCursor = true,
status_t ReadBitmap(BBitmap* bitmap, bool drawCursor = true, BRect* frame = NULL);
BRect* frame = NULL); status_t ReadBitmap(BBitmap* bitmap,
bool drawCursor = true,
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* high); const display_mode* low,
status_t GetModeList(display_mode** _modeList, uint32* _count); const display_mode* high);
status_t GetMode(display_mode* mode); status_t GetModeList(display_mode** _modeList,
status_t GetMode(uint32 workspace, display_mode* mode); uint32* _count);
status_t SetMode(display_mode* mode, bool makeDefault = false); status_t GetMode(display_mode* _mode);
status_t SetMode(uint32 workspace, display_mode* mode, status_t GetMode(uint32 workspace,
bool makeDefault = false); display_mode* _mode);
status_t GetDeviceInfo(accelerant_device_info* info); status_t SetMode(display_mode* mode,
status_t GetMonitorInfo(monitor_info* info); bool makeDefault = false);
status_t GetPixelClockLimits(display_mode* mode, uint32* low, status_t SetMode(uint32 workspace,
uint32* high); display_mode* mode,
status_t GetTimingConstraints( bool makeDefault = false);
display_timing_constraints* timingConstraints); status_t GetDeviceInfo(accelerant_device_info* info);
status_t SetDPMS(uint32 state); status_t GetMonitorInfo(monitor_info* info);
uint32 DPMSState(); status_t GetPixelClockLimits(display_mode* mode,
uint32 DPMSCapabilites(); uint32* low, uint32* high);
status_t GetTimingConstraints(
display_timing_constraints*
timingConstraints);
status_t SetDPMS(uint32 state);
uint32 DPMSState();
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* low, const display_mode* high); const display_mode* high);
void* BaseAddress(); void* BaseAddress();
uint32 BytesPerRow(); uint32 BytesPerRow();
BPrivate::BPrivateScreen* fScreen; private:
BPrivate::BPrivateScreen* fScreen;
}; };
@@ -93,4 +105,4 @@ BScreen::IndexForColor(rgb_color color)
return IndexForColor(color.red, color.green, color.blue, color.alpha); return IndexForColor(color.red, color.green, color.blue, color.alpha);
} }
#endif // _SCREEN_H #endif // _SCREEN_H
+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 (mflerackers@androme.be)
* DarkWyrm (bpmagic@columbus.rr.com)
* Stefano Ceccherini (burton666@libero.it)
* Stephan Aßmus <superstippi@gmx.de>
*/ */
#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;
+82 -77
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
@@ -14,104 +14,109 @@
*/ */
class BScrollView : public BView { class BScrollView : public BView {
public: public:
BScrollView(const char* name, BView* target, BScrollView(const char* name, BView* target,
uint32 resizingMode uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP, = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = 0, bool horizontal = false, uint32 flags = 0, bool horizontal = false,
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
BScrollView(BMessage* archive); = B_FANCY_BORDER);
virtual ~BScrollView(); BScrollView(BMessage* archive);
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 Draw(BRect updateRect); virtual void AttachedToWindow();
virtual void AttachedToWindow(); virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
BScrollBar* ScrollBar(orientation posture) const; virtual void Draw(BRect updateRect);
virtual void SetBorder(border_style border); virtual void WindowActivated(bool active);
border_style Border() const; virtual void MakeFocus(bool state = true);
virtual status_t SetBorderHighlighted(bool state); virtual void GetPreferredSize(float* _width,
bool IsBorderHighlighted() const; float* _height);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void ResizeToPreferred();
void SetTarget(BView* target); virtual void InvalidateLayout(bool descendants = false);
BView* Target() const; virtual void DoLayout();
virtual void FrameMoved(BPoint position);
virtual void FrameResized(float width, float height);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint point);
virtual void WindowActivated(bool active); virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point); virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 code, virtual void MouseMoved(BPoint point, uint32 code,
const BMessage* dragMessage); const BMessage* dragMessage);
virtual void DetachedFromWindow(); // BScrollView
virtual void AllAttached(); BScrollBar* ScrollBar(orientation posture) const;
virtual void AllDetached();
virtual void FrameMoved(BPoint position); virtual void SetBorder(border_style border);
virtual void FrameResized(float width, float height); border_style Border() const;
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, virtual status_t SetBorderHighlighted(bool state);
BMessage* specifier, int32 form, bool IsBorderHighlighted() const;
const char* property);
virtual void ResizeToPreferred(); void SetTarget(BView* target);
virtual void GetPreferredSize(float* _width, float* _height); BView* Target() const;
virtual void MakeFocus(bool state = true);
virtual status_t GetSupportedSuites(BMessage* data);
virtual BSize MinSize(); // Scripting
virtual BSize MaxSize(); virtual BHandler* ResolveSpecifier(BMessage* message,
virtual BSize PreferredSize(); int32 index, BMessage* specifier,
int32 form, const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual void InvalidateLayout(bool descendants = false); virtual status_t Perform(perform_code d, void* arg);
virtual void DoLayout();
// private or reserved methods are following private:
// FBC padding and forbidden methods
virtual void _ReservedScrollView1();
virtual void _ReservedScrollView2();
virtual void _ReservedScrollView3();
virtual void _ReservedScrollView4();
virtual status_t Perform(perform_code d, void* arg); BScrollView& operator=(const BScrollView& other);
private: private:
friend class BView; friend class BView;
virtual void _ReservedScrollView1(); void _Init(bool horizontal, bool vertical);
virtual void _ReservedScrollView2(); float _BorderSize() const;
virtual void _ReservedScrollView3(); BRect _InnerFrame() const;
virtual void _ReservedScrollView4(); BSize _ComputeSize(BSize targetSize) const;
BRect _ComputeFrame(BRect targetRect) const;
void _AlignScrollBars(bool horizontal,
bool vertical, BRect targetFrame);
BScrollView& operator=(const BScrollView& other); static BRect _ComputeFrame(BRect frame, bool horizontal,
bool vertical, border_style border);
static BRect _ComputeFrame(BView* target, bool horizontal,
bool vertical, border_style border);
static float _BorderSize(border_style border);
static int32 _ModifyFlags(int32 flags, border_style border);
void _Init(bool horizontal, bool vertical); private:
float _BorderSize() const; BView* fTarget;
BRect _InnerFrame() const; BScrollBar* fHorizontalScrollBar;
BSize _ComputeSize(BSize targetSize) const; BScrollBar* fVerticalScrollBar;
BRect _ComputeFrame(BRect targetRect) const; border_style fBorder;
void _AlignScrollBars(bool horizontal, bool vertical, uint16 fPreviousWidth;
BRect targetFrame); uint16 fPreviousHeight;
bool fHighlighted;
static BRect _ComputeFrame(BRect frame, bool horizontal, uint32 _reserved[3];
bool vertical, border_style border);
static BRect _ComputeFrame(BView* target, bool horizontal,
bool vertical, border_style border);
static float _BorderSize(border_style border);
static int32 _ModifyFlags(int32 flags, border_style border);
BView* fTarget;
BScrollBar* fHorizontalScrollBar;
BScrollBar* fVerticalScrollBar;
border_style fBorder;
uint16 fPreviousWidth;
uint16 fPreviousHeight;
bool fHighlighted;
uint32 _reserved[3];
}; };
#endif /* _SCROLL_VIEW_H */ #endif // _SCROLL_VIEW_H
+20 -16
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 void SetEnabled(bool state); virtual status_t Archive(BMessage* archive,
bool deep = true) const;
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:
virtual void _ReservedSeparatorItem1(); // FBC padding, reserved and forbidden
virtual void _ReservedSeparatorItem2(); virtual void _ReservedSeparatorItem1();
virtual void _ReservedSeparatorItem2();
BSeparatorItem &operator=(const BSeparatorItem &); BSeparatorItem& operator=(const BSeparatorItem& other);
uint32 _reserved[1]; uint32 _reserved[1];
}; };
#endif /* _SEPARATOR_ITEM_H */ #endif // _SEPARATOR_ITEM_H
+6 -4
View File
@@ -1,11 +1,11 @@
/* /*
* Copyright 2001-2009, Stephan Aßmus <superstippi@gmx.de> * Copyright 2009, Haiku, Inc. All rights reserved.
* Copyright 2001-2009, Ingo Weinhold <ingo_weinhold@gmx.de> * 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;
+51 -41
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
@@ -21,70 +21,80 @@ namespace BPrivate {
class BShapeIterator { class BShapeIterator {
public: public:
BShapeIterator(); BShapeIterator();
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 IterateClose(); virtual status_t IterateBezierTo(int32 bezierCount,
BPoint* bezierPts);
virtual status_t IterateClose();
status_t Iterate(BShape *shape); status_t Iterate(BShape* shape);
private: private:
virtual void _ReservedShapeIterator1(); virtual void _ReservedShapeIterator1();
virtual void _ReservedShapeIterator2(); virtual void _ReservedShapeIterator2();
virtual void _ReservedShapeIterator3(); virtual void _ReservedShapeIterator3();
virtual void _ReservedShapeIterator4(); virtual void _ReservedShapeIterator4();
uint32 reserved[4]; uint32 reserved[4];
}; };
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;
status_t AddShape(const BShape *other); status_t AddShape(const BShape* other);
status_t MoveTo(BPoint point); status_t MoveTo(BPoint point);
status_t LineTo(BPoint linePoint); status_t LineTo(BPoint linePoint);
status_t BezierTo(BPoint controlPoints[3]); status_t BezierTo(BPoint controlPoints[3]);
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 InitData(); void SetData(int32 opCount, int32 ptCount,
bool AllocatePts(int32 count); const uint32* opList,
bool AllocateOps(int32 count); const BPoint* ptList);
void InitData();
bool AllocatePts(int32 count);
bool AllocateOps(int32 count);
uint32 fState; private:
uint32 fBuildingOp; uint32 fState;
void* fPrivateData; uint32 fBuildingOp;
uint32 reserved[4]; void* fPrivateData;
uint32 reserved[4];
}; };
#endif // _SHAPE_H #endif // _SHAPE_H
+106 -87
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;
@@ -24,106 +26,123 @@ 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(const entry_ref* ref, BView* view,
BShelf(BDataIO* stream, BView* view, bool allowDrags = true, bool allowDrags = true,
const char* shelfType = NULL); const char* shelfType = NULL);
BShelf(BMessage *data); BShelf(BDataIO* stream, BView* view,
virtual ~BShelf(); bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BMessage* archive);
virtual ~BShelf();
virtual status_t Archive(BMessage* data, bool deep = true) const; static BArchivable* Instantiate(BMessage* archive);
static BArchivable* Instantiate(BMessage* archive); virtual status_t Archive(BMessage* archive,
bool deep = true) const;
virtual void MessageReceived(BMessage *msg); 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;
void SetAllowsDragging(bool state);
bool AllowsZombies() const;
void SetAllowsZombies(bool state);
bool DisplaysZombies() const;
void SetDisplaysZombies(bool state);
bool IsTypeEnforced() const;
void SetTypeEnforced(bool state);
status_t SetSaveLocation(BDataIO *data_io); bool AllowsDragging() const;
status_t SetSaveLocation(const entry_ref *ref); void SetAllowsDragging(bool state);
BDataIO* SaveLocation(entry_ref *ref) const; bool AllowsZombies() const;
void SetAllowsZombies(bool state);
bool DisplaysZombies() const;
void SetDisplaysZombies(bool state);
bool IsTypeEnforced() const;
void SetTypeEnforced(bool state);
status_t AddReplicant(BMessage *data, BPoint location); status_t SetSaveLocation(BDataIO* stream);
status_t DeleteReplicant(BView *replicant); status_t SetSaveLocation(const entry_ref* ref);
status_t DeleteReplicant(BMessage *data); BDataIO* SaveLocation(entry_ref* ref) const;
status_t DeleteReplicant(int32 index);
int32 CountReplicants() const;
BMessage* ReplicantAt(int32 index,
BView **view = NULL,
uint32 *uid = NULL,
status_t *perr = NULL) const;
int32 IndexOf(const BView *replicantView) const;
int32 IndexOf(const BMessage *archive) const;
int32 IndexOf(uint32 id) const;
protected: status_t AddReplicant(BMessage* archive,
virtual bool CanAcceptReplicantMessage(BMessage*) const; BPoint location);
virtual bool CanAcceptReplicantView(BRect, BView*, BMessage*) const; status_t DeleteReplicant(BView* replicant);
virtual BPoint AdjustReplicantBy(BRect, BMessage*) const; status_t DeleteReplicant(BMessage* archive);
status_t DeleteReplicant(int32 index);
int32 CountReplicants() const;
BMessage* ReplicantAt(int32 index, BView** view = NULL,
uint32* uid = NULL,
status_t* perr = NULL) const;
int32 IndexOf(const BView* replicantView) const;
int32 IndexOf(const BMessage* archive) const;
int32 IndexOf(uint32 id) const;
virtual void ReplicantDeleted(int32 index, const BMessage *archive, protected:
const BView *replicant); virtual bool CanAcceptReplicantMessage(
BMessage* archive) const;
virtual bool CanAcceptReplicantView(BRect,
BView*, BMessage*) const;
virtual BPoint AdjustReplicantBy(BRect, BMessage*) const;
private: virtual void ReplicantDeleted(int32 index,
friend class BPrivate::ShelfContainerViewFilter; const BMessage* archive,
const BView *replicant);
virtual void _ReservedShelf2(); private:
virtual void _ReservedShelf3(); // FBC padding and forbidden methods
virtual void _ReservedShelf4(); virtual void _ReservedShelf2();
virtual void _ReservedShelf5(); virtual void _ReservedShelf3();
virtual void _ReservedShelf6(); virtual void _ReservedShelf4();
virtual void _ReservedShelf7(); virtual void _ReservedShelf5();
virtual void _ReservedShelf8(); virtual void _ReservedShelf6();
virtual void _ReservedShelf7();
virtual void _ReservedShelf8();
BShelf(const BShelf& other); BShelf(const BShelf& other);
BShelf& operator=(const BShelf& other); BShelf& operator=(const BShelf& other);
status_t _Archive(BMessage* data) const; private:
void _InitData(BEntry* entry, BDataIO* stream, friend class BPrivate::ShelfContainerViewFilter;
BView* view, bool allowDrags);
status_t _DeleteReplicant(BPrivate::replicant_data* replicant);
status_t _AddReplicant(BMessage* data,
BPoint* location, uint32 uniqueID);
BView *_GetReplicant(BMessage *data, BView *view, const BPoint &point,
BDragger *&dragger, BDragger::relation &relation);
_BZombieReplicantView_ *_CreateZombie(BMessage *data, BDragger *&dragger);
status_t _GetProperty(BMessage* message, BMessage* reply);
static void _GetReplicantData(BMessage *message, BView *view, BView *&replicant,
BDragger *&dragger, BDragger::relation &relation);
static BArchivable* _InstantiateObject(BMessage *archive, image_id *image);
private: status_t _Archive(BMessage* data) const;
BView* fContainerView; void _InitData(BEntry* entry, BDataIO* stream,
BDataIO* fStream; BView* view, bool allowDrags);
BEntry* fEntry; status_t _DeleteReplicant(
BList fReplicants; BPrivate::replicant_data* replicant);
BPrivate::ShelfContainerViewFilter* fFilter; status_t _AddReplicant(BMessage* data,
uint32 fGenCount; BPoint* location, uint32 uniqueID);
bool fAllowDragging; BView* _GetReplicant(BMessage* data, BView* view,
bool fDirty; const BPoint& point, BDragger*& dragger,
bool fDisplayZombies; BDragger::relation& relation);
bool fAllowZombies; _BZombieReplicantView_* _CreateZombie(BMessage *data,
bool fTypeEnforced; BDragger *&dragger);
status_t _GetProperty(BMessage* message,
BMessage* reply);
static void _GetReplicantData(BMessage* message,
BView* view, BView*& replicant,
BDragger*& dragger,
BDragger::relation& relation);
static BArchivable* _InstantiateObject(BMessage* archive,
image_id* image);
uint32 _reserved[8]; private:
BView* fContainerView;
BDataIO* fStream;
BEntry* fEntry;
BList fReplicants;
BPrivate::ShelfContainerViewFilter* fFilter;
uint32 fGenCount;
bool fAllowDragging;
bool fDirty;
bool fDisplayZombies;
bool fAllowZombies;
bool fTypeEnforced;
uint32 _reserved[8];
}; };
#endif /* _SHELF_H */ #endif /* _SHELF_H */
+2 -17
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)
{ {
@@ -170,4 +155,4 @@ BSize::operator=(const BSize& other)
return *this; return *this;
} }
#endif // _SIZE_H #endif // _SIZE_H
+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 (mflerackers@androme.be)
*/ */
#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();
+24 -20
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
@@ -11,33 +11,37 @@
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,
BStringItem(BMessage* archive); bool expanded = true);
virtual ~BStringItem(); BStringItem(BMessage* archive);
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);
virtual void SetText(const char* text); virtual void SetText(const char* text);
const char* Text() const; const char* Text() const;
virtual void Update(BView* owner, const BFont* font); virtual void Update(BView* owner, const BFont* font);
virtual status_t Perform(perform_code code, void* arg); virtual status_t Perform(perform_code code, void* arg);
private: private:
virtual void _ReservedStringItem1(); // FBC padding and forbidden methods
virtual void _ReservedStringItem2(); virtual void _ReservedStringItem1();
virtual void _ReservedStringItem2();
BStringItem(const BStringItem& item); BStringItem(const BStringItem& item);
BStringItem& operator=(const BStringItem& item); BStringItem& operator=(const BStringItem& item);
char* fText; private:
float fBaselineOffset; char* fText;
uint32 _reserved[2]; float fBaselineOffset;
uint32 _reserved[2];
}; };
#endif // _STRING_ITEM_H #endif // _STRING_ITEM_H
+62 -57
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
@@ -14,70 +11,78 @@
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;
void SetAlignment(alignment flag); void SetAlignment(alignment flag);
alignment Alignment() const; alignment Alignment() const;
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void Draw(BRect bounds); virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void MessageReceived(BMessage* message); virtual void MakeFocus(bool state = true);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit,
const BMessage* dragMessage);
virtual void DetachedFromWindow();
virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float newWidth, float newHeight);
virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, virtual void GetPreferredSize(float* _width,
BMessage* specifier, int32 form, float* _height);
const char* property); virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void InvalidateLayout(bool descendants = false);
virtual void ResizeToPreferred();
virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float newWidth, float newHeight);
virtual void ResizeToPreferred(); virtual void Draw(BRect bounds);
virtual void GetPreferredSize(float* _width, float* _height);
virtual void MakeFocus(bool state = true);
virtual void AllAttached();
virtual void AllDetached();
virtual status_t GetSupportedSuites(BMessage* data);
virtual void SetFont(const BFont* font, virtual void MessageReceived(BMessage* message);
uint32 mask = B_FONT_ALL); virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit,
const BMessage* dragMessage);
virtual void InvalidateLayout(bool descendants = false); virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
virtual BSize MinSize(); int32 form, const char* property);
virtual BSize MaxSize(); virtual status_t GetSupportedSuites(BMessage* data);
virtual BSize PreferredSize();
private: virtual void SetFont(const BFont* font,
virtual status_t Perform(perform_code d, void* arg); uint32 mask = B_FONT_ALL);
virtual void _ReservedStringView1();
virtual void _ReservedStringView2();
virtual void _ReservedStringView3();
BSize _ValidatePreferredSize();
BStringView &operator=(const BStringView&); private:
// FBC padding and forbidden methods
virtual status_t Perform(perform_code code, void* data);
char* fText; virtual void _ReservedStringView1();
alignment fAlign; virtual void _ReservedStringView2();
BSize fPreferredSize; virtual void _ReservedStringView3();
uint32 _reserved[1];
BStringView& operator=(const BStringView& other);
private:
BSize _ValidatePreferredSize();
private:
char* fText;
alignment fAlign;
BSize fPreferredSize;
uint32 _reserved[1];
}; };
#endif // _STRING_VIEW_H #endif // _STRING_VIEW_H
+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;
+20 -15
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved. * Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _TEXT_CONTROL_H #ifndef _TEXT_CONTROL_H
@@ -11,9 +11,10 @@
class BLayoutItem; class BLayoutItem;
namespace BPrivate { 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;
+3 -2
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;
@@ -90,4 +91,4 @@ private:
LocalLayouter* fLocalLayouter; LocalLayouter* fLocalLayouter;
}; };
#endif // _TWO_DIMENSIONAL_LAYOUT_H #endif // _TWO_DIMENSIONAL_LAYOUT_H
+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
File diff suppressed because it is too large Load Diff
+259 -251
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
@@ -32,31 +29,31 @@ namespace BPrivate {
enum window_type { enum window_type {
B_UNTYPED_WINDOW = 0, B_UNTYPED_WINDOW = 0,
B_TITLED_WINDOW = 1, B_TITLED_WINDOW = 1,
B_MODAL_WINDOW = 3, B_MODAL_WINDOW = 3,
B_DOCUMENT_WINDOW = 11, B_DOCUMENT_WINDOW = 11,
B_BORDERED_WINDOW = 20, B_BORDERED_WINDOW = 20,
B_FLOATING_WINDOW = 21 B_FLOATING_WINDOW = 21
}; };
enum window_look { enum window_look {
B_BORDERED_WINDOW_LOOK = 20, B_BORDERED_WINDOW_LOOK = 20,
B_NO_BORDER_WINDOW_LOOK = 19, B_NO_BORDER_WINDOW_LOOK = 19,
B_TITLED_WINDOW_LOOK = 1, B_TITLED_WINDOW_LOOK = 1,
B_DOCUMENT_WINDOW_LOOK = 11, B_DOCUMENT_WINDOW_LOOK = 11,
B_MODAL_WINDOW_LOOK = 3, B_MODAL_WINDOW_LOOK = 3,
B_FLOATING_WINDOW_LOOK = 7 B_FLOATING_WINDOW_LOOK = 7
}; };
enum window_feel { enum window_feel {
B_NORMAL_WINDOW_FEEL = 0, B_NORMAL_WINDOW_FEEL = 0,
B_MODAL_SUBSET_WINDOW_FEEL = 2, B_MODAL_SUBSET_WINDOW_FEEL = 2,
B_MODAL_APP_WINDOW_FEEL = 1, B_MODAL_APP_WINDOW_FEEL = 1,
B_MODAL_ALL_WINDOW_FEEL = 3, B_MODAL_ALL_WINDOW_FEEL = 3,
B_FLOATING_SUBSET_WINDOW_FEEL = 5, B_FLOATING_SUBSET_WINDOW_FEEL = 5,
B_FLOATING_APP_WINDOW_FEEL = 4, B_FLOATING_APP_WINDOW_FEEL = 4,
B_FLOATING_ALL_WINDOW_FEEL = 6 B_FLOATING_ALL_WINDOW_FEEL = 6
}; };
enum window_alignment { enum window_alignment {
@@ -87,177 +84,198 @@ enum {
B_NO_SERVER_SIDE_WINDOW_MODIFIERS = 0x00000200 B_NO_SERVER_SIDE_WINDOW_MODIFIERS = 0x00000200
}; };
#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:
BWindow(BRect frame, const char* title, BWindow(BRect frame, const char* title,
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
virtual ~BWindow(); = B_CURRENT_WORKSPACE);
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(); }
void AddChild(BView* child, BView* before = NULL); void AddChild(BView* child, BView* before = NULL);
bool RemoveChild(BView* child); bool RemoveChild(BView* child);
int32 CountChildren() const; int32 CountChildren() const;
BView* ChildAt(int32 index) const; BView* ChildAt(int32 index) const;
virtual void DispatchMessage(BMessage* message, virtual void DispatchMessage(BMessage* message,
BHandler* handler); BHandler* handler);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
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,
virtual void FrameResized(float newWidth, float newHeight); bool state);
virtual void Minimize(bool minimize); virtual void FrameResized(float newWidth, float newHeight);
virtual void Zoom(BPoint origin, float width, float height); virtual void Minimize(bool minimize);
void Zoom(); virtual void Zoom(BPoint origin, float width, float height);
void SetZoomLimits(float maxWidth, float maxHeight); void Zoom();
virtual void ScreenChanged(BRect screenSize, color_space format); void SetZoomLimits(float maxWidth, float maxHeight);
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;
void AddShortcut(uint32 key, uint32 modifiers, void AddShortcut(uint32 key, uint32 modifiers,
BMessage* message); BMessage* message);
void AddShortcut(uint32 key, uint32 modifiers, void AddShortcut(uint32 key, uint32 modifiers,
BMessage* message, BHandler* target); BMessage* message, BHandler* target);
void RemoveShortcut(uint32 key, uint32 modifiers); void RemoveShortcut(uint32 key, uint32 modifiers);
void SetDefaultButton(BButton* button); void SetDefaultButton(BButton* button);
BButton* DefaultButton() const; BButton* DefaultButton() const;
virtual void MenusBeginning(); virtual void MenusBeginning();
virtual void MenusEnded(); virtual void MenusEnded();
bool NeedsUpdate() const; bool NeedsUpdate() const;
void UpdateIfNeeded(); void UpdateIfNeeded();
BView* FindView(const char* viewName) const; BView* FindView(const char* viewName) const;
BView* FindView(BPoint) const; BView* FindView(BPoint) const;
BView* CurrentFocus() const; BView* CurrentFocus() const;
void Activate(bool = true); void Activate(bool = true);
virtual void WindowActivated(bool state); virtual void WindowActivated(bool state);
void ConvertToScreen(BPoint* point) const; void ConvertToScreen(BPoint* point) const;
BPoint ConvertToScreen(BPoint point) const; BPoint ConvertToScreen(BPoint point) const;
void ConvertFromScreen(BPoint* point) const; void ConvertFromScreen(BPoint* point) const;
BPoint ConvertFromScreen(BPoint point) const; BPoint ConvertFromScreen(BPoint point) const;
void ConvertToScreen(BRect* rect) const; void ConvertToScreen(BRect* rect) const;
BRect ConvertToScreen(BRect rect) const; BRect ConvertToScreen(BRect rect) const;
void ConvertFromScreen(BRect* rect) const; void ConvertFromScreen(BRect* rect) const;
BRect ConvertFromScreen(BRect rect) const; BRect ConvertFromScreen(BRect rect) const;
void MoveBy(float dx, float dy); void MoveBy(float dx, float dy);
void MoveTo(BPoint); void MoveTo(BPoint);
void MoveTo(float x, float y); void MoveTo(float x, float y);
void ResizeBy(float dx, float dy); void ResizeBy(float dx, float dy);
void ResizeTo(float width, float height); void ResizeTo(float width, float height);
void CenterIn(const BRect& rect); void CenterIn(const BRect& rect);
void CenterOnScreen(); void CenterOnScreen();
virtual void Show(); virtual void Show();
virtual void Hide(); virtual void Hide();
bool IsHidden() const; bool IsHidden() const;
bool IsMinimized() const; bool IsMinimized() const;
void Flush() const; void Flush() const;
void Sync() const; void Sync() const;
status_t SendBehind(const BWindow* window); status_t SendBehind(const BWindow* window);
void DisableUpdates(); void DisableUpdates();
void EnableUpdates(); void EnableUpdates();
void BeginViewTransaction(); void BeginViewTransaction();
// referred as OpenViewTransaction() in BeBook // referred as OpenViewTransaction()
void EndViewTransaction(); // in BeBook
// referred as CommitViewTransaction() in BeBook void EndViewTransaction();
// referred as CommitViewTransaction()
// in BeBook
BRect Bounds() const; BRect Bounds() const;
BRect Frame() const; BRect Frame() const;
BRect DecoratorFrame() const; BRect DecoratorFrame() const;
BSize Size() const; BSize Size() const;
const char* Title() const; const char* Title() const;
void SetTitle(const char* title); void SetTitle(const char* title);
bool IsFront() const; bool IsFront() const;
bool IsActive() const; bool IsActive() const;
void SetKeyMenuBar(BMenuBar* bar); void SetKeyMenuBar(BMenuBar* bar);
BMenuBar* KeyMenuBar() const; BMenuBar* KeyMenuBar() const;
void SetSizeLimits(float minWidth, float maxWidth, void SetSizeLimits(float minWidth, float maxWidth,
float minHeight, float maxHeight); float minHeight, float maxHeight);
void GetSizeLimits(float* minWidth, float* maxWidth, void GetSizeLimits(float* minWidth, float* maxWidth,
float* minHeight, float* maxHeight); float* minHeight, float* maxHeight);
status_t SetDecoratorSettings(const BMessage& settings); status_t SetDecoratorSettings(const BMessage& settings);
status_t GetDecoratorSettings(BMessage* settings) const; status_t GetDecoratorSettings(BMessage* settings) const;
uint32 Workspaces() const; uint32 Workspaces() const;
void SetWorkspaces(uint32); void SetWorkspaces(uint32);
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;
status_t SetLook(window_look look); status_t SetLook(window_look look);
window_look Look() const; window_look Look() const;
status_t SetFeel(window_feel feel); status_t SetFeel(window_feel feel);
window_feel Feel() const; window_feel Feel() const;
status_t SetFlags(uint32); status_t SetFlags(uint32);
uint32 Flags() const; uint32 Flags() const;
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(
int32* h = NULL, int32* hOffset = NULL, window_alignment* mode = NULL,
int32* width = NULL, int32* widthOffset = NULL, int32* h = NULL, int32* hOffset = NULL,
int32* v = NULL, int32* vOffset = NULL, int32* width = NULL,
int32* height = NULL, int32* widthOffset = NULL,
int32* heightOffset = NULL) const; int32* v = NULL, int32* vOffset = NULL,
int32* height = NULL,
int32* heightOffset = NULL) const;
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual thread_id Run(); virtual thread_id Run();
virtual void SetLayout(BLayout* layout); virtual void SetLayout(BLayout* layout);
BLayout* GetLayout() const; BLayout* GetLayout() const;
void InvalidateLayout(bool descendants = false); void InvalidateLayout(bool descendants = false);
private:
// FBC padding and forbidden methods
virtual void _ReservedWindow2();
virtual void _ReservedWindow3();
virtual void _ReservedWindow4();
virtual void _ReservedWindow5();
virtual void _ReservedWindow6();
virtual void _ReservedWindow7();
virtual void _ReservedWindow8();
BWindow();
BWindow(BWindow&);
BWindow& operator=(BWindow&);
private: private:
typedef BLooper inherited; typedef BLooper inherited;
@@ -275,118 +293,108 @@ 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(); BWindow(BRect frame, int32 bitmapToken);
virtual void _ReservedWindow3(); void _InitData(BRect frame, const char* title,
virtual void _ReservedWindow4(); window_look look, window_feel feel,
virtual void _ReservedWindow5(); uint32 flags, uint32 workspace,
virtual void _ReservedWindow6(); int32 bitmapToken = -1);
virtual void _ReservedWindow7();
virtual void _ReservedWindow8();
BWindow(); virtual void task_looper();
BWindow(BWindow&);
BWindow& operator=(BWindow&);
BWindow(BRect frame, int32 bitmapToken); virtual BMessage* ConvertToMessage(void* raw, int32 code);
void _InitData(BRect frame, const char* title,
window_look look, window_feel feel,
uint32 flags, uint32 workspace,
int32 bitmapToken = -1);
virtual void task_looper(); void AddShortcut(uint32 key, uint32 modifiers,
BMenuItem* item);
BHandler* _DetermineTarget(BMessage* message,
BHandler* target);
bool _IsFocusMessage(BMessage* message);
bool _UnpackMessage(unpack_cookie& state,
BMessage** _message, BHandler** _target,
bool* _usePreferred);
void _SanitizeMessage(BMessage* message,
BHandler* target, bool usePreferred);
bool _StealMouseMessage(BMessage* message,
bool& deleteMessage);
uint32 _TransitForMouseMoved(BView* view,
BView* viewUnderMouse) const;
virtual BMessage* ConvertToMessage(void* raw, int32 code); bool InUpdate();
void _DequeueAll();
window_type _ComposeType(window_look look,
window_feel feel) const;
void _DecomposeType(window_type type,
window_look* look,
window_feel* feel) const;
void AddShortcut(uint32 key, uint32 modifiers, void SetIsFilePanel(bool yes);
BMenuItem* item); bool IsFilePanel() const;
BHandler* _DetermineTarget(BMessage* message,
BHandler* target);
bool _IsFocusMessage(BMessage* message);
bool _UnpackMessage(unpack_cookie& state,
BMessage** _message, BHandler** _target,
bool* _usePreferred);
void _SanitizeMessage(BMessage* message,
BHandler* target, bool usePreferred);
bool _StealMouseMessage(BMessage* message,
bool& deleteMessage);
uint32 _TransitForMouseMoved(BView* view,
BView* viewUnderMouse) const;
bool InUpdate(); void _CreateTopView();
void _DequeueAll(); void _AdoptResize();
window_type _ComposeType(window_look look, void _SetFocus(BView* focusView,
window_feel feel) const; bool notifyIputServer = false);
void _DecomposeType(window_type type, window_look* look, void _SetName(const char* title);
window_feel* feel) const;
void SetIsFilePanel(bool yes); Shortcut* _FindShortcut(uint32 key, uint32 modifiers);
bool IsFilePanel() const; BView* _FindView(BView* view, BPoint point) const;
BView* _FindView(int32 token);
BView* _LastViewChild(BView* parent);
void _CreateTopView(); BView* _FindNextNavigable(BView* focus, uint32 flags);
void _AdoptResize(); BView* _FindPreviousNavigable(BView* focus,
void _SetFocus(BView* focusView, uint32 flags);
bool notifyIputServer = false); void _Switcher(int32 rawKey, uint32 modifiers,
void _SetName(const char* title); bool repeat);
bool _HandleKeyDown(BMessage* event);
bool _HandleUnmappedKeyDown(BMessage* event);
void _KeyboardNavigation();
Shortcut* _FindShortcut(uint32 key, uint32 modifiers); void _GetDecoratorSize(float* _borderWidth,
BView* _FindView(BView* view, BPoint point) const; float* _tabHeight) const;
BView* _FindView(int32 token);
BView* _LastViewChild(BView* parent);
BView* _FindNextNavigable(BView *focus, uint32 flags); void _CheckSizeLimits();
BView* _FindPreviousNavigable(BView *focus, uint32 flags);
void _Switcher(int32 rawKey, uint32 modifiers,
bool repeat);
bool _HandleKeyDown(BMessage* event);
bool _HandleUnmappedKeyDown(BMessage* event);
void _KeyboardNavigation();
void _GetDecoratorSize(float* _borderWidth,
float* _tabHeight) const;
void _CheckSizeLimits();
private: private:
char* fTitle; char* fTitle;
int32 _unused0; int32 _unused0;
bool fInTransaction; bool fInTransaction;
bool fActive; bool fActive;
short fShowLevel; short fShowLevel;
uint32 fFlags; uint32 fFlags;
BView* fTopView; BView* fTopView;
BView* fFocus; BView* fFocus;
BView* fLastMouseMovedView; BView* fLastMouseMovedView;
BMessageRunner* fIdleMouseRunner; BMessageRunner* fIdleMouseRunner;
BMenuBar* fKeyMenuBar; BMenuBar* fKeyMenuBar;
BButton* fDefaultButton; BButton* fDefaultButton;
BList fShortcuts; BList fShortcuts;
int32 fTopViewToken; int32 fTopViewToken;
bool fUpdateRequested; bool fUpdateRequested;
bool fOffscreen; bool fOffscreen;
bool fIsFilePanel; bool fIsFilePanel;
bool _unused4; bool _unused4;
bigtime_t fPulseRate; bigtime_t fPulseRate;
bool _unused5; bool _unused5;
bool fMinimized; bool fMinimized;
bool fNoQuitShortcut; bool fNoQuitShortcut;
bool _unused6; bool _unused6;
sem_id fMenuSem; sem_id fMenuSem;
float fMaxZoomHeight; float fMaxZoomHeight;
float fMaxZoomWidth; float fMaxZoomWidth;
float fMinHeight; float fMinHeight;
float fMinWidth; float fMinWidth;
float fMaxHeight; float fMaxHeight;
float fMaxWidth; float fMaxWidth;
BRect fFrame; BRect fFrame;
window_look fLook; window_look fLook;
window_feel fFeel; window_feel fFeel;
int32 fLastViewToken; int32 fLastViewToken;
BPrivate::PortLink* fLink; BPrivate::PortLink* fLink;
BMessageRunner* fPulseRunner; BMessageRunner* fPulseRunner;
BRect fPreviousFrame; BRect fPreviousFrame;
uint32 _reserved[9]; uint32 _reserved[9];
}; };
#endif // _WINDOW_H #endif // _WINDOW_H
+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,61 +85,11 @@ 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*
BScrollView::Instantiate(BMessage *archive) BScrollView::Instantiate(BMessage* archive)
{ {
if (validate_instantiation(archive, "BScrollView")) if (validate_instantiation(archive, "BScrollView"))
return new BScrollView(archive); return new BScrollView(archive);
@@ -149,7 +99,7 @@ BScrollView::Instantiate(BMessage *archive)
status_t status_t
BScrollView::Archive(BMessage *archive, bool deep) const BScrollView::Archive(BMessage* archive, bool deep) const
{ {
status_t status = BView::Archive(archive, deep); status_t status = BView::Archive(archive, deep);
if (status != B_OK) if (status != B_OK)
@@ -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,7 +226,215 @@ BScrollView::Draw(BRect updateRect)
} }
BScrollBar * // #pragma mark -
void
BScrollView::WindowActivated(bool active)
{
if (fHighlighted)
Invalidate();
BView::WindowActivated(active);
}
void
BScrollView::MakeFocus(bool state)
{
BView::MakeFocus(state);
}
// #pragma mark -
void
BScrollView::GetPreferredSize(float *_width, float *_height)
{
BSize size = PreferredSize();
if (_width)
*_width = size.width;
if (_height)
*_height = size.height;
}
BSize
BScrollView::MinSize()
{
BSize size = _ComputeSize(fTarget != NULL ? fTarget->MinSize()
: BSize(16, 16));
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
}
BSize
BScrollView::MaxSize()
{
BSize size = _ComputeSize(fTarget != NULL ? fTarget->MaxSize()
: BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
}
BSize
BScrollView::PreferredSize()
{
BSize size = _ComputeSize(fTarget != NULL ? fTarget->PreferredSize()
: BSize(32, 32));
return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size);
}
void
BScrollView::ResizeToPreferred()
{
if (Window() == NULL)
return;
BView::ResizeToPreferred();
}
void
BScrollView::InvalidateLayout(bool descendants)
{
BView::InvalidateLayout(descendants);
}
void
BScrollView::DoLayout()
{
if (!(Flags() & B_SUPPORTS_LAYOUT))
return;
// If the user set a layout, we let the base class version call its hook.
if (GetLayout()) {
BView::DoLayout();
return;
}
BRect innerFrame = _InnerFrame();
if (fTarget != NULL) {
fTarget->MoveTo(innerFrame.left, innerFrame.top);
fTarget->ResizeTo(innerFrame.Width(), innerFrame.Height());
//BLayoutUtils::AlignInFrame(fTarget, fTarget->Bounds());
}
_AlignScrollBars(fHorizontalScrollBar != NULL, fVerticalScrollBar != NULL,
innerFrame);
}
void
BScrollView::FrameMoved(BPoint position)
{
BView::FrameMoved(position);
}
void
BScrollView::FrameResized(float width, float height)
{
BView::FrameResized(width, height);
if (fBorder == B_NO_BORDER)
return;
BRect bounds = Bounds();
float border = _BorderSize() - 1;
if (be_control_look && fHorizontalScrollBar && fVerticalScrollBar) {
BRect scrollCorner(bounds);
scrollCorner.left = min_c(
fPreviousWidth - fVerticalScrollBar->Frame().Height(),
fHorizontalScrollBar->Frame().right + 1);
scrollCorner.top = min_c(
fPreviousHeight - fHorizontalScrollBar->Frame().Width(),
fVerticalScrollBar->Frame().bottom + 1);
Invalidate(scrollCorner);
}
// changes in width
if (bounds.Width() > fPreviousWidth) {
// invalidate the region between the old and the new right border
BRect rect = bounds;
rect.left += fPreviousWidth - border;
rect.right--;
Invalidate(rect);
} else if (bounds.Width() < fPreviousWidth) {
// invalidate the region of the new right border
BRect rect = bounds;
rect.left = rect.right - border;
Invalidate(rect);
}
// changes in height
if (bounds.Height() > fPreviousHeight) {
// invalidate the region between the old and the new bottom border
BRect rect = bounds;
rect.top += fPreviousHeight - border;
rect.bottom--;
Invalidate(rect);
} else if (bounds.Height() < fPreviousHeight) {
// invalidate the region of the new bottom border
BRect rect = bounds;
rect.top = rect.bottom - border;
Invalidate(rect);
}
fPreviousWidth = uint16(bounds.Width());
fPreviousHeight = uint16(bounds.Height());
}
// #pragma mark -
void
BScrollView::MessageReceived(BMessage* message)
{
switch (message->what) {
default:
BView::MessageReceived(message);
}
}
void
BScrollView::MouseDown(BPoint point)
{
BView::MouseDown(point);
}
void
BScrollView::MouseUp(BPoint point)
{
BView::MouseUp(point);
}
void
BScrollView::MouseMoved(BPoint point, uint32 code, const BMessage *dragMessage)
{
BView::MouseMoved(point, code, dragMessage);
}
// #pragma mark -
BScrollBar*
BScrollView::ScrollBar(orientation posture) const BScrollView::ScrollBar(orientation posture) const
{ {
if (posture == B_HORIZONTAL) if (posture == B_HORIZONTAL)
@@ -425,126 +586,141 @@ BScrollView::SetTarget(BView *target)
} }
BView * BView*
BScrollView::Target() const BScrollView::Target() const
{ {
return fTarget; return fTarget;
} }
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);
}
} }
void status_t
BScrollView::MouseDown(BPoint point) BScrollView::GetSupportedSuites(BMessage *data)
{ {
BView::MouseDown(point); return BView::GetSupportedSuites(data);
} }
void status_t
BScrollView::MouseUp(BPoint point) BScrollView::Perform(perform_code code, void* _data)
{ {
BView::MouseUp(point); switch (code) {
} case PERFORM_CODE_MIN_SIZE:
((perform_data_min_size*)_data)->return_value
= BScrollView::MinSize();
void return B_OK;
BScrollView::MouseMoved(BPoint point, uint32 code, const BMessage *dragMessage) case PERFORM_CODE_MAX_SIZE:
{ ((perform_data_max_size*)_data)->return_value
BView::MouseMoved(point, code, dragMessage); = BScrollView::MaxSize();
} return B_OK;
case PERFORM_CODE_PREFERRED_SIZE:
((perform_data_preferred_size*)_data)->return_value
void = BScrollView::PreferredSize();
BScrollView::FrameMoved(BPoint position) return B_OK;
{ case PERFORM_CODE_LAYOUT_ALIGNMENT:
BView::FrameMoved(position); ((perform_data_layout_alignment*)_data)->return_value
} = BScrollView::LayoutAlignment();
return B_OK;
case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
void ((perform_data_has_height_for_width*)_data)->return_value
BScrollView::FrameResized(float width, float height) = BScrollView::HasHeightForWidth();
{ return B_OK;
BView::FrameResized(width, height); case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
{
if (fBorder == B_NO_BORDER) perform_data_get_height_for_width* data
return; = (perform_data_get_height_for_width*)_data;
BScrollView::GetHeightForWidth(data->width, &data->min, &data->max,
BRect bounds = Bounds(); &data->preferred);
float border = _BorderSize() - 1; return B_OK;
}
if (be_control_look && fHorizontalScrollBar && fVerticalScrollBar) { case PERFORM_CODE_SET_LAYOUT:
BRect scrollCorner(bounds); {
scrollCorner.left = min_c( perform_data_set_layout* data = (perform_data_set_layout*)_data;
fPreviousWidth - fVerticalScrollBar->Frame().Height(), BScrollView::SetLayout(data->layout);
fHorizontalScrollBar->Frame().right + 1); return B_OK;
scrollCorner.top = min_c( }
fPreviousHeight - fHorizontalScrollBar->Frame().Width(), case PERFORM_CODE_INVALIDATE_LAYOUT:
fVerticalScrollBar->Frame().bottom + 1); {
Invalidate(scrollCorner); perform_data_invalidate_layout* data
= (perform_data_invalidate_layout*)_data;
BScrollView::InvalidateLayout(data->descendants);
return B_OK;
}
case PERFORM_CODE_DO_LAYOUT:
{
BScrollView::DoLayout();
return B_OK;
}
} }
// changes in width return BView::Perform(code, _data);
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 // #pragma mark -
BScrollView::ResizeToPreferred()
{
if (Window() == NULL)
return;
BView::ResizeToPreferred();
}
void void
BScrollView::GetPreferredSize(float *_width, float *_height) BScrollView::_Init(bool horizontal, bool vertical)
{ {
BSize size = PreferredSize(); fHorizontalScrollBar = NULL;
fVerticalScrollBar = NULL;
fHighlighted = false;
if (_width) if (be_control_look != NULL)
*_width = size.width; SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
if (_height)
*_height = size.height; BRect targetFrame;
if (fTarget) {
// layout target and add it
fTarget->TargetedByScrollView(this);
fTarget->MoveTo(B_ORIGIN);
if (fBorder != B_NO_BORDER)
fTarget->MoveBy(_BorderSize(), _BorderSize());
AddChild(fTarget);
targetFrame = fTarget->Frame();
} else {
// no target specified
targetFrame = Bounds();
if (horizontal)
targetFrame.bottom -= B_H_SCROLL_BAR_HEIGHT + 1;
if (vertical)
targetFrame.right -= B_V_SCROLL_BAR_WIDTH + 1;
if (fBorder == B_FANCY_BORDER) {
targetFrame.bottom--;
targetFrame.right--;
}
}
if (horizontal) {
fHorizontalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_HSB_",
fTarget, 0, 1000, B_HORIZONTAL);
AddChild(fHorizontalScrollBar);
}
if (vertical) {
fVerticalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_VSB_",
fTarget, 0, 1000, B_VERTICAL);
AddChild(fVerticalScrollBar);
}
_AlignScrollBars(horizontal, vertical, targetFrame);
fPreviousWidth = uint16(Bounds().Width());
fPreviousHeight = uint16(Bounds().Height());
} }
@@ -671,8 +847,8 @@ BScrollView::_ComputeFrame(BRect frame, bool horizontal, bool vertical,
BScrollView::_ComputeFrame(BView *target, bool horizontal, bool vertical, 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() {}
+223 -196
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:
@@ -28,8 +28,9 @@ 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)
{ {
@@ -38,9 +39,10 @@ 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, :
B_WILL_DRAW | B_SUPPORTS_LAYOUT), BView(BRect(0, 0, -1, -1), name, B_FOLLOW_LEFT | B_FOLLOW_TOP,
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: }
{
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); void
BStatusBar::AllAttached()
{
BView::AllAttached();
}
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); // #pragma mark -
break;
}
default: void
BView::MessageReceived(message); BStatusBar::WindowActivated(bool state)
break; {
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)
{ {
@@ -686,7 +691,7 @@ BStatusBar::Perform(perform_code code, void* _data)
BStatusBar::GetHeightForWidth(data->width, &data->min, &data->max, BStatusBar::GetHeightForWidth(data->width, &data->min, &data->max,
&data->preferred); &data->preferred);
return B_OK; return B_OK;
} }
case PERFORM_CODE_SET_LAYOUT: case PERFORM_CODE_SET_LAYOUT:
{ {
perform_data_set_layout* data = (perform_data_set_layout*)_data; perform_data_set_layout* data = (perform_data_set_layout*)_data;
@@ -711,6 +716,9 @@ BStatusBar::Perform(perform_code code, void* _data)
} }
// #pragma mark -
extern "C" void 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)
{ {