Set*UIColor, etc.

The inseparable changes necessary to support live color updating across the
system in a sane, safe, and performant manner.

BView gains:

HasSystemColors()
HasDefaultColors()
AdoptSystemColors()
AdoptParentColors()
AdoptViewColor(BView*)
SetViewUIColor(color_which, float tint)
SetHighUIColor(...
SetLowUIColor(...
ViewUIColor(float* tint)
HighUIColor(...
LowUIColor(...
DelayedInvalidate()

BWindow gains a simple helper method:
IsOffscreenWindow()

BMessage gains:

AddColor()
FindColor()
GetColor()
HasColor()            * allegedly this API is deprecated, but I implemented it anyway
ReplaceColor()
SetColor()

Previous private ColorTools methods are made public and moved into GraphicsDefs:

mix_color, blend_color, disable_color

These are fully compatible with BeOS dan0 R5.1 methods and are just code cleanup
of BeOS example code under the OpenTracker license.

In addition, four new colors are created:
B_LINK_TEXT_COLOR
B_LINK_HOVER_COLOR
B_LINK_ACTIVE_COLOR
B_LINK_VISITED_COLOR

These changes are documented in their proper user documentation files.

In addition, due to a history rewrite, B_FOLLOW_LEFT_TOP has been defined and
used in lieu of B_FOLLOW_TOP | B_FOLLOW_LEFT and is included in this commit.

On the app_server side, the following has changed:

Add DelayedMessage - a system by which messages can be sent at a scheduled time,
and can also be merged according to set rules.  A single thread is used to service the
message queue and multiple recipients can be set for each message.
Desktop gains the ability to add message ports to a DelayedMessage so that
said messages can target either all applications or all windows, as needed.

Desktop maintains a BMessage which is used to queue up all pending color changes
and the delayed messaging system is used to enact these changes after a short
period of time has passed.  This prevents abuse and allows the system to merge
repeated set_ui_color events into one event for client applications, improving
performance drastically.

In addition, B_COLORS_UPDATED is sent to the BApplication, which forwards the message
to each BWindow.  This is done to improve performance over having the app_server
independently informing each window.

Decorator changes are live now, which required some reworking.

Signed-off-by: Augustin Cavalier <[email protected]>
This commit is contained in:
looncraz
2016-01-04 06:48:22 -05:00
committed by Augustin Cavalier
parent a3212ce3e9
commit 7f9368cae5
75 changed files with 2982 additions and 454 deletions
+2 -4
View File
@@ -67,10 +67,8 @@ enum {
B_WORKSPACES_CHANGED = '_WCG',
B_WORKSPACE_ACTIVATED = '_WAC',
B_ZOOM = '_WZM',
_COLORS_UPDATED = '_CLU',
// Currently internal-use only. Later, public as B_COLORS_UPDATED
_FONTS_UPDATED = '_FNU',
// Currently internal-use only. Later, public as B_FONTS_UPDATED
B_COLORS_UPDATED = '_CLU',
B_FONTS_UPDATED = '_FNU',
_APP_MENU_ = '_AMN',
_BROWSER_MENUS_ = '_BRM',
_MENU_EVENT_ = '_MEV',
+16
View File
@@ -29,6 +29,7 @@ class BHandler;
class BString;
class BStringList;
struct entry_ref;
struct rgb_color;
// Name lengths and Scripting specifiers
@@ -154,6 +155,7 @@ public:
status_t AddBool(const char* name, bool value);
status_t AddFloat(const char* name, float value);
status_t AddDouble(const char* name, double value);
status_t AddColor(const char* name, rgb_color value);
status_t AddPointer(const char* name,
const void* pointer);
status_t AddMessenger(const char* name,
@@ -241,6 +243,10 @@ public:
double* value) const;
status_t FindDouble(const char* name, int32 index,
double* value) const;
status_t FindColor(const char* name,
rgb_color* value) const;
status_t FindColor(const char* name, int32 index,
rgb_color* value) const;
status_t FindPointer(const char* name,
void** pointer) const;
status_t FindPointer(const char* name, int32 index,
@@ -324,6 +330,10 @@ public:
status_t ReplaceDouble(const char* name, double value);
status_t ReplaceDouble(const char* name, int32 index,
double value);
status_t ReplaceColor(const char* name,
rgb_color value);
status_t ReplaceColor(const char* name, int32 index,
rgb_color value);
status_t ReplacePointer(const char* name,
const void* pointer);
status_t ReplacePointer(const char* name, int32 index,
@@ -379,6 +389,7 @@ public:
bool HasBool(const char* name, int32 n = 0) const;
bool HasFloat(const char* name, int32 n = 0) const;
bool HasDouble(const char* name, int32 n = 0) const;
bool HasColor(const char* name, int32 n = 0) const;
bool HasPointer(const char* name, int32 n = 0) const;
bool HasMessenger(const char* name,
int32 n = 0) const;
@@ -446,6 +457,10 @@ public:
double defaultValue) const;
double GetDouble(const char* name, int32 index,
double defaultValue) const;
rgb_color GetColor(const char* name,
rgb_color defaultValue) const;
rgb_color GetColor(const char* name, int32 index,
rgb_color defaultValue) const;
const char* GetString(const char* name,
const char* defaultValue = NULL) const;
const char* GetString(const char* name, int32 index,
@@ -477,6 +492,7 @@ public:
status_t SetUInt32(const char* name, uint32 value);
status_t SetInt64(const char* name, int64 value);
status_t SetUInt64(const char* name, uint64 value);
status_t SetColor(const char* name, rgb_color value);
status_t SetPointer(const char* name, const void* value);
status_t SetString(const char* name, const char* string);
status_t SetString(const char* name,
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2005-2013 Haiku, Inc. All Rights Reserved.
* Copyright 2005-2015 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _BOX_H
@@ -12,8 +12,7 @@
class BBox : public BView {
public:
BBox(BRect frame, const char* name = NULL,
uint32 resizingMode = B_FOLLOW_LEFT
| B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
| B_NAVIGABLE_JUMP,
border_style border = B_FANCY_BORDER);
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2014 Haiku, Inc. All rights reserved.
* Copyright 2001-2015 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _BUTTON_H
@@ -20,8 +20,7 @@ public:
public:
BButton(BRect frame, const char* name,
const char* label, BMessage* message,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE
| B_FULL_UPDATE_ON_RESIZE);
BButton(const char* name, const char* label,
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2008-2009, Haiku, Inc. All rights reserved.
* Copyright 2008-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CHANNEL_CONTROL_H
@@ -18,8 +18,7 @@ public:
BChannelControl(BRect frame, const char* name,
const char* label, BMessage* model,
int32 channelCount = 1,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW);
BChannelControl(const char* name,
const char* label, BMessage* model,
+3 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009, Haiku, Inc. All rights reserved.
* Copyright 2009-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CHANNEL_SLIDER_H
@@ -14,15 +14,13 @@ public:
BChannelSlider(BRect area, const char* name,
const char* label, BMessage* message,
int32 channels = 1,
uint32 resizeMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizeMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW);
BChannelSlider(BRect area, const char* name,
const char* label, BMessage* message,
orientation orientation,
int32 channels = 1,
uint32 resizeMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizeMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW);
BChannelSlider(const char* name,
const char* label, BMessage* message,
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2014 Haiku, Inc. All rights reserved.
* Copyright 2001-2015 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CHECK_BOX_H
@@ -13,8 +13,7 @@ class BCheckBox : public BControl {
public:
BCheckBox(BRect frame, const char* name,
const char* label, BMessage* message,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BCheckBox(const char* name, const char* label,
BMessage* message, uint32 flags
+12 -6
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2012, Haiku, Inc. All rights reserved.
* Copyright 2009-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CONTROL_LOOK_H
@@ -85,6 +85,7 @@ public:
B_PARTIALLY_ACTIVATED = 1 << 7, // like B_ACTIVATED, but for tri-state
B_FLAT = 1 << 8, // flat look (e.g. button background)
B_INVALID = 1 << 9, // invalid value, use B_FAILURE_COLOR
B_IS_CONTROL = 1 << 10, // use control colors
B_BLEND_FRAME = 1 << 16,
};
@@ -328,27 +329,32 @@ public:
/*virtual*/ void DrawLabel(BView* view, const char* label,
BRect rect, const BRect& updateRect,
const rgb_color& base, uint32 flags);
const rgb_color& base, uint32 flags,
const rgb_color* textColor = NULL);
virtual void DrawLabel(BView* view, const char* label,
BRect rect, const BRect& updateRect,
const rgb_color& base, uint32 flags,
const BAlignment& alignment);
const BAlignment& alignment,
const rgb_color* textColor = NULL);
// TODO: Would be nice to have a (non-virtual) version of this method
// which takes an array of labels and locations. That would save some
// setup with the view graphics state.
/*virtual*/ void DrawLabel(BView* view, const char* label,
const rgb_color& base, uint32 flags,
const BPoint& where);
const BPoint& where,
const rgb_color* textColor = NULL);
void DrawLabel(BView* view, const char* label,
const BBitmap* icon, BRect rect,
const BRect& updateRect,
const rgb_color& base, uint32 flags);
const rgb_color& base, uint32 flags,
const rgb_color* textColor = NULL);
virtual void DrawLabel(BView* view, const char* label,
const BBitmap* icon, BRect rect,
const BRect& updateRect,
const rgb_color& base, uint32 flags,
const BAlignment& alignment);
const BAlignment& alignment,
const rgb_color* textColor = NULL);
virtual void GetFrameInsets(frame_type frameType,
uint32 flags, float& _left, float& _top,
+8 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2008-2012 Haiku, Inc. All rights reserved.
* Copyright 2008-2015 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRAPHICS_DEFS_H
@@ -57,6 +57,8 @@ typedef struct rgb_color {
return *this;
}
int32 Brightness() const;
inline bool
operator==(const rgb_color& other) const
{
@@ -88,6 +90,11 @@ make_color(uint8 red, uint8 green, uint8 blue, uint8 alpha = 255)
#endif
rgb_color mix_color(rgb_color color1, rgb_color color2, uint8 amount);
rgb_color blend_color(rgb_color color1, rgb_color color2, uint8 amount);
rgb_color disable_color(rgb_color color, rgb_color background);
extern const rgb_color B_TRANSPARENT_COLOR;
extern const uint8 B_TRANSPARENT_MAGIC_CMAP8;
extern const uint16 B_TRANSPARENT_MAGIC_RGBA15;
+10
View File
@@ -11,6 +11,7 @@
class BBitmap;
class BMessage;
class BPoint;
class BRect;
@@ -296,6 +297,7 @@ enum bitmap_drawing_options {
// Default UI Colors
enum color_which {
B_NO_COLOR = 0,
B_PANEL_BACKGROUND_COLOR = 1,
B_PANEL_TEXT_COLOR = 10,
B_DOCUMENT_BACKGROUND_COLOR = 11,
@@ -310,6 +312,11 @@ enum color_which {
B_SHINE_COLOR = 18,
B_SHADOW_COLOR = 19,
B_LINK_TEXT_COLOR = 33,
B_LINK_HOVER_COLOR = 34,
B_LINK_VISITED_COLOR = 35,
B_LINK_ACTIVE_COLOR = 36,
B_MENU_BACKGROUND_COLOR = 2,
B_MENU_SELECTED_BACKGROUND_COLOR = 6,
B_MENU_ITEM_TEXT_COLOR = 7,
@@ -463,7 +470,10 @@ void set_accept_first_click(bool acceptFirstClick);
bool accept_first_click();
rgb_color ui_color(color_which which);
const char* ui_color_name(color_which which);
color_which which_ui_color(const char* name);
void set_ui_color(const color_which& which, const rgb_color& color);
void set_ui_colors(const BMessage* colors);
rgb_color tint_color(rgb_color color, float tint);
extern "C" status_t _init_interface_kit_();
+9 -10
View File
@@ -457,9 +457,7 @@ Group<ParentBuilder>::Group(BWindow* window, orientation orientation,
fLayout(new BGroupLayout(orientation, spacing))
{
window->SetLayout(fLayout);
fLayout->Owner()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// TODO: we get a white background if we don't do this
fLayout->Owner()->AdoptSystemColors();
}
@@ -469,9 +467,11 @@ Group<ParentBuilder>::Group(BView* view, orientation orientation,
:
fLayout(new BGroupLayout(orientation, spacing))
{
if (view->HasDefaultColors())
view->AdoptSystemColors();
view->SetLayout(fLayout);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// TODO: we get a white background if we don't do this
}
@@ -796,9 +796,7 @@ Grid<ParentBuilder>::Grid(BWindow* window, float horizontalSpacing,
fLayout(new BGridLayout(horizontalSpacing, verticalSpacing))
{
window->SetLayout(fLayout);
fLayout->Owner()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// TODO: we get a white background if we don't do this
fLayout->Owner()->AdoptSystemColors();
}
@@ -808,9 +806,10 @@ Grid<ParentBuilder>::Grid(BView* view, float horizontalSpacing,
:
fLayout(new BGridLayout(horizontalSpacing, verticalSpacing))
{
if (view->HasDefaultColors())
view->AdoptSystemColors();
view->SetLayout(fLayout);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// TODO: we get a white background if we don't do this
}
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 Haiku, Inc. All rights reserved.
* Copyright 2002-2015 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _LIST_VIEW_H
@@ -26,8 +26,7 @@ public:
BListView(BRect frame, const char* name,
list_view_type type
= B_SINGLE_SELECTION_LIST,
uint32 resizeMask = B_FOLLOW_LEFT
| B_FOLLOW_TOP,
uint32 resizeMask = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW
| B_FRAME_EVENTS | B_NAVIGABLE);
BListView(const char* name,
+3 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013, Haiku, Inc. All rights reserved.
* Copyright 2006-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MENU_FIELD_H
@@ -17,14 +17,12 @@ class BMenuField : public BView {
public:
BMenuField(BRect frame, const char* name,
const char* label, BMenu* menu,
uint32 resizingMode = B_FOLLOW_LEFT
| B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BMenuField(BRect frame, const char* name,
const char* label, BMenu* menu,
bool fixed_size,
uint32 resizingMode = B_FOLLOW_LEFT
| B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BMenuField(const char* name,
const char* label, BMenu* menu,
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009, Haiku, Inc. All rights reserved.
* Copyright 2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MULTI_CHANNEL_CONTROL_H
@@ -14,8 +14,7 @@ public:
BMultiChannelControl(BRect frame,
const char* name, const char* label,
BMessage* message, int32 channelCount = 1,
uint32 resize = B_FOLLOW_LEFT
| B_FOLLOW_TOP,
uint32 resize = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW);
BMultiChannelControl(BMessage* archive);
virtual ~BMultiChannelControl();
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Copyright 2001-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _OPTION_CONTROL_H
@@ -18,8 +18,7 @@ class BOptionControl : public BControl {
public:
BOptionControl(BRect frame, const char* name,
const char* label, BMessage* message,
uint32 resizeMask = B_FOLLOW_LEFT
| B_FOLLOW_TOP,
uint32 resizeMask = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW);
BOptionControl(const char* name,
const char* label, BMessage* message,
+3 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Copyright 2001-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _OPTION_POP_UP_H
@@ -16,13 +16,12 @@ class BOptionPopUp : public BOptionControl {
public:
BOptionPopUp(BRect frame, const char* name,
const char* label, BMessage* message,
uint32 resizeMask = B_FOLLOW_LEFT
| B_FOLLOW_TOP,
uint32 resizeMask = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW);
BOptionPopUp(BRect frame, const char* name,
const char* label, BMessage* message,
bool fixed, uint32 resizeMask
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
= B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW);
BOptionPopUp(const char* name,
const char* label, BMessage* message,
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013, Haiku, Inc. All rights reserved.
* Copyright 2006-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _OUTLINE_LIST_VIEW_H
@@ -14,8 +14,7 @@ public:
BOutlineListView(BRect frame, const char* name,
list_view_type type
= B_SINGLE_SELECTION_LIST,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW
| B_FRAME_EVENTS | B_NAVIGABLE);
BOutlineListView(const char* name,
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2008, Haiku, Inc. All rights reserved.
* Copyright 2001-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _PICTURE_BUTTON_H
@@ -22,8 +22,7 @@ public:
BPicture* off, BPicture* on,
BMessage* message,
uint32 behavior = B_ONE_STATE_BUTTON,
uint32 resizingMode = B_FOLLOW_LEFT
| B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flgs = B_WILL_DRAW | B_NAVIGABLE);
BPictureButton(BMessage* archive);
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2008, Haiku, Inc. All rights reserved.
* Copyright 2001-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _RADIO_BUTTON_H
@@ -14,8 +14,7 @@ class BRadioButton : public BControl {
public:
BRadioButton(BRect frame, const char* name,
const char* label, BMessage* message,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BRadioButton(const char* name,
const char* label, BMessage* message,
+1 -2
View File
@@ -15,8 +15,7 @@
class BScrollView : public BView {
public:
BScrollView(const char* name, BView* target,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = 0, bool horizontal = false,
bool vertical = false,
border_style border = B_FANCY_BORDER);
+3 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2013, Haiku, Inc. All rights reserved.
* Copyright 2001-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SLIDER_H
@@ -30,8 +30,7 @@ public:
const char* label, BMessage* message,
int32 minValue, int32 maxValue,
thumb_style thumbType = B_BLOCK_THUMB,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_NAVIGABLE | B_WILL_DRAW
| B_FRAME_EVENTS);
@@ -40,8 +39,7 @@ public:
int32 minValue, int32 maxValue,
orientation posture,
thumb_style thumbType = B_BLOCK_THUMB,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_NAVIGABLE | B_WILL_DRAW
| B_FRAME_EVENTS);
+2 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2010, Haiku, Inc. All rights reserved.
* Copyright 2006-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SPLIT_VIEW_H
@@ -61,6 +61,7 @@ public:
bool AddChild(int32 index, BLayoutItem* child,
float weight);
virtual void AttachedToWindow();
virtual void Draw(BRect updateRect);
virtual void DrawAfterChildren(BRect updateRect);
virtual void MouseDown(BPoint where);
+3 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
* Copyright 2006-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _STATUS_BAR_H
@@ -110,8 +110,9 @@ private:
float fTextDivider;
rgb_color fBarColor;
bool fCustomBarHeight;
uint32 fInternalFlags;
uint32 _reserved[5];
uint32 _reserved[4];
};
#endif // _STATUS_BAR_H
+1 -1
View File
@@ -13,7 +13,7 @@ class BStringView : public BView {
public:
BStringView(BRect frame, const char* name,
const char* text, uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
= B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW);
BStringView(const char* name, const char* text,
uint32 flags = B_WILL_DRAW);
+1 -2
View File
@@ -21,8 +21,7 @@ public:
BTextControl(BRect frame, const char* name,
const char* label, const char* initialText,
BMessage* message,
uint32 resizeMask
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizeMask = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BTextControl(const char* name,
const char* label, const char* initialText,
+28 -8
View File
@@ -107,6 +107,7 @@ inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4)
#define B_FOLLOW_TOP_BOTTOM _rule_(_VIEW_TOP_, 0, _VIEW_BOTTOM_, 0)
#define B_FOLLOW_V_CENTER _rule_(_VIEW_CENTER_, 0, _VIEW_CENTER_, 0)
#define B_FOLLOW_LEFT_TOP B_FOLLOW_TOP | B_FOLLOW_LEFT
class BBitmap;
class BCursor;
@@ -242,32 +243,38 @@ public:
void SetViewCursor(const BCursor* cursor,
bool sync = true);
bool HasDefaultColors() const;
bool HasSystemColors() const;
void AdoptParentColors();
void AdoptSystemColors();
void AdoptViewColors(BView* view);
virtual void SetViewColor(rgb_color color);
void SetViewColor(uchar red, uchar green, uchar blue,
uchar alpha = 255);
rgb_color ViewColor() const;
void SetViewUIColor(color_which which,
float tint = B_NO_TINT);
color_which ViewUIColor(float* tint = NULL) const;
void SetViewBitmap(const BBitmap* bitmap,
BRect srcRect, BRect dstRect,
uint32 followFlags
= B_FOLLOW_TOP | B_FOLLOW_LEFT,
uint32 followFlags = B_FOLLOW_LEFT_TOP,
uint32 options = B_TILE_BITMAP);
void SetViewBitmap(const BBitmap* bitmap,
uint32 followFlags
= B_FOLLOW_TOP | B_FOLLOW_LEFT,
uint32 followFlags = B_FOLLOW_LEFT_TOP,
uint32 options = B_TILE_BITMAP);
void ClearViewBitmap();
status_t SetViewOverlay(const BBitmap* overlay,
BRect srcRect, BRect dstRect,
rgb_color* colorKey,
uint32 followFlags
= B_FOLLOW_TOP | B_FOLLOW_LEFT,
uint32 followFlags = B_FOLLOW_LEFT_TOP,
uint32 options = 0);
status_t SetViewOverlay(const BBitmap* overlay,
rgb_color* colorKey,
uint32 followFlags
= B_FOLLOW_TOP | B_FOLLOW_LEFT,
uint32 followFlags = B_FOLLOW_LEFT_TOP,
uint32 options = 0);
void ClearViewOverlay();
@@ -276,11 +283,19 @@ public:
uchar alpha = 255);
rgb_color HighColor() const;
void SetHighUIColor(color_which which,
float tint = B_NO_TINT);
color_which HighUIColor(float* tint = NULL) const;
virtual void SetLowColor(rgb_color color);
void SetLowColor(uchar red, uchar green, uchar blue,
uchar alpha = 255);
rgb_color LowColor() const;
void SetLowUIColor(color_which which,
float tint = B_NO_TINT);
color_which LowUIColor(float* tint = NULL) const;
void SetLineMode(cap_mode lineCap,
join_mode lineJoin,
float miterLimit = B_DEFAULT_MITER_LIMIT);
@@ -495,6 +510,9 @@ public:
void Invalidate(BRect invalRect);
void Invalidate(const BRegion* invalRegion);
void Invalidate();
void DelayedInvalidate(bigtime_t delay);
void DelayedInvalidate(bigtime_t delay,
BRect invalRect);
void SetDiskMode(char* filename, long offset);
@@ -691,9 +709,11 @@ private:
void _Activate(bool state);
void _Attach();
void _ColorsUpdated(BMessage* message);
void _Detach();
void _Draw(BRect screenUpdateRect);
void _DrawAfterChildren(BRect screenUpdateRect);
void _FontsUpdated(BMessage*);
void _Pulse();
void _UpdateStateForRemove();
+1 -1
View File
@@ -272,7 +272,7 @@ public:
void InvalidateLayout(bool descendants = false);
void Layout(bool force);
bool IsOffscreenWindow() const;
private:
// FBC padding and forbidden methods
virtual void _ReservedWindow2();
+11
View File
@@ -293,11 +293,18 @@ enum {
AS_VIEW_SET_PEN_SIZE,
AS_VIEW_GET_PEN_SIZE,
AS_VIEW_SET_HIGH_COLOR,
AS_VIEW_SET_HIGH_UI_COLOR,
AS_VIEW_SET_LOW_COLOR,
AS_VIEW_SET_LOW_UI_COLOR,
AS_VIEW_SET_VIEW_COLOR,
AS_VIEW_SET_VIEW_UI_COLOR,
AS_VIEW_GET_HIGH_COLOR,
AS_VIEW_GET_HIGH_UI_COLOR,
AS_VIEW_GET_LOW_COLOR,
AS_VIEW_GET_LOW_UI_COLOR,
AS_VIEW_GET_VIEW_COLOR,
AS_VIEW_GET_VIEW_UI_COLOR,
AS_VIEW_PRINT_ALIASING,
AS_VIEW_CLIP_TO_PICTURE,
AS_VIEW_GET_CLIP_REGION,
@@ -314,6 +321,7 @@ enum {
AS_VIEW_COPY_BITS,
AS_VIEW_DRAW_PICTURE,
AS_VIEW_INVALIDATE_RECT,
AS_VIEW_DELAYED_INVALIDATE_RECT,
AS_VIEW_INVALIDATE_REGION,
AS_VIEW_INVERT_RECT,
AS_VIEW_MOVE_TO,
@@ -355,6 +363,9 @@ enum {
AS_VIEW_CLIP_TO_RECT,
AS_VIEW_CLIP_TO_SHAPE,
// Internal messages
AS_COLOR_MAP_UPDATED,
AS_LAST_CODE
};
@@ -18,6 +18,10 @@ struct ViewSetStateInfo {
float penSize;
rgb_color highColor;
rgb_color lowColor;
color_which whichHighColor;
color_which whichLowColor;
float whichHighColorTint;
float whichLowColorTint;
::pattern pattern;
drawing_mode drawingMode;
BPoint origin;
+5 -5
View File
@@ -13,11 +13,11 @@
#include <InterfaceDefs.h>
// Update this constant with the largest color constant excluding
// B_SUCCESS_COLOR and B_FAILURE_COLOR.
// If you add a constant with index greater than 100 you'll have to add
// to the second operand.
static const int32 kColorWhichCount = B_SCROLL_BAR_THUMB_COLOR + 3;
// Update kColorWhichLastContinuous with the largest color constant which
// leaves no gaps in the color_which integer values.
static const int32 kColorWhichLastContinuous = B_LINK_ACTIVE_COLOR;
static const int32 kColorWhichCount = kColorWhichLastContinuous + 3;
// + 1 for index-offset, + 2 for B_SUCCESS_COLOR, B_FAILURE_COLOR
struct server_read_only_memory {
+1 -1
View File
@@ -39,7 +39,7 @@ class BAbstractSpinner : public BControl {
public:
BAbstractSpinner(BRect frame, const char* name,
const char* label, BMessage* message,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BAbstractSpinner(const char* name, const char* label,
BMessage* message,
-79
View File
@@ -1,79 +0,0 @@
/*
Open Tracker License
Terms and Conditions
Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice applies to all licensees
and shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
/*******************************************************************************
/
/ File: ColorTools.h
/
/ Description: Additional experimental color manipulation functions.
/
/ Copyright 2000, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#ifndef _COLOR_TOOLS_H
#define _COLOR_TOOLS_H
#include <GraphicsDefs.h>
#if B_BEOS_VERSION <= B_BEOS_VERSION_5
namespace BExperimental {
// Mix two colors together, ignoring their relative alpha channels.
// If amount is 0, the result is color1; if 255, the result is color2;
// if another value, it is somewhere in-between. The resulting alpha
// channel is mixed exactly like the other color channels.
rgb_color mix_color(rgb_color color1, rgb_color color2, uint8 amount);
// Blend two colors together, weighting by their relative alpha channels.
// The resulting color is the same as mix_color(), except that the amount
// used from color1 and color2's color channels is dependent on that color's
// alpha channel. For example, if color1.alpha is 0 and color2.alpha is
// 255, the resulting red, green, and blue values will be the same as those
// in color2, regardless of 'amount'.
rgb_color blend_color(rgb_color color1, rgb_color color2, uint8 amount);
// Return a color that is the disabled representation of 'color' when drawn
// on a solid color 'background'.
rgb_color disable_color(rgb_color color, rgb_color background);
} // namespace BExperimental
using namespace BExperimental;
#endif
#endif
+5 -2
View File
@@ -63,10 +63,10 @@ class RecursiveOutlineIterator;
} // ns BPrivate
class BField;
class BRow;
class BColumn;
class BColumnListView;
class BField;
class BRow;
enum LatchType {
B_NO_LATCH = 0,
@@ -353,6 +353,7 @@ public:
// Appearance (NEW STYLE)
void SetColor(ColumnListViewColor colorIndex,
rgb_color color);
void ResetColors();
void SetFont(ColumnListViewFont fontIndex,
const BFont* font,
uint32 mask = B_FONT_ALL);
@@ -396,12 +397,14 @@ protected:
private:
void _Init();
void _UpdateColors();
void _GetChildViewRects(const BRect& bounds,
BRect& titleRect, BRect& outlineRect,
BRect& vScrollBarRect,
BRect& hScrollBarRect);
rgb_color fColorList[B_COLOR_TOTAL];
bool fCustomColors;
BPrivate::TitleView* fTitleView;
BPrivate::OutlineView* fOutlineView;
BList fColumns;
+1 -1
View File
@@ -16,7 +16,7 @@ class BDecimalSpinner : public BAbstractSpinner {
public:
BDecimalSpinner(BRect frame, const char* name,
const char* label, BMessage* message,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 resizingMode = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BDecimalSpinner(const char* name, const char* label,
BMessage* message,
+13 -1
View File
@@ -42,8 +42,11 @@ enum {
B_VIEW_PATTERN_BIT = 0x00020000,
B_VIEW_TRANSFORM_BIT = 0x00040000,
B_VIEW_FILL_RULE_BIT = 0x00080000,
B_VIEW_WHICH_VIEW_COLOR_BIT = 0x00100000,
B_VIEW_WHICH_LOW_COLOR_BIT = 0x00200000,
B_VIEW_WHICH_HIGH_COLOR_BIT = 0x00400000,
B_VIEW_ALL_BITS = 0x000fffff,
B_VIEW_ALL_BITS = 0x00ffffff,
// these used for archiving only
B_VIEW_RESIZE_BIT = 0x00001000,
@@ -107,6 +110,15 @@ class ViewState {
// This one is not affected by pop state/push state
rgb_color view_color;
color_which which_view_color;
float which_view_color_tint;
// these are cached values
color_which which_low_color;
float which_low_color_tint;
color_which which_high_color;
float which_high_color_tint;
::pattern pattern;
+1 -2
View File
@@ -26,8 +26,7 @@ namespace BPrivate {
class BCalendarView : public BView, public BInvoker {
public:
BCalendarView(BRect frame, const char* name,
uint32 resizeMask = B_FOLLOW_LEFT
| B_FOLLOW_TOP,
uint32 resizeMask = B_FOLLOW_LEFT_TOP,
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
| B_NAVIGABLE);