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:
committed by
Augustin Cavalier
parent
a3212ce3e9
commit
7f9368cae5
@@ -1,13 +1,14 @@
|
||||
/*
|
||||
* Copyright 2011-2014 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2011-2015 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* John Scipione, [email protected]
|
||||
* Joseph Groover, [email protected]
|
||||
*
|
||||
* Corresponds to:
|
||||
* headers/os/interface/View.h hrev47274
|
||||
* src/kits/interface/View.cpp hrev47274
|
||||
* headers/os/interface/View.h hrev497**
|
||||
* src/kits/interface/View.cpp hrev497**
|
||||
*/
|
||||
|
||||
|
||||
@@ -523,6 +524,15 @@
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var B_FOLLOW_LEFT_TOP
|
||||
\brief The margins between the left and top sides of the view and the left
|
||||
and top sides of its parent remain constant.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BView
|
||||
\ingroup interface
|
||||
@@ -596,12 +606,13 @@ if (Window()->LockLooper()) {
|
||||
|
||||
Each view has a ViewColor() that fills the frame rectangle before the
|
||||
view does any drawing of its own. The default view color is white, you may
|
||||
change the view color by calling SetViewColor(). A commonly used view color
|
||||
is \c B_PANEL_BACKGROUND_COLOR which is a grey color used as the view color
|
||||
of many Interface Kit classes. If you set the view color to
|
||||
\c B_TRANSPARENT_COLOR then the Application Server won't erase the clipping
|
||||
region of the view before updating, this should only be used if the view
|
||||
erases itself by drawing on every pixel in the clipping region.
|
||||
change the view color by calling SetViewColor() or, as of Haiku R1,
|
||||
SetViewUIColor(). A commonly used view color is \c B_PANEL_BACKGROUND_COLOR
|
||||
which is a user-defined color used as the view color of most applications.
|
||||
If you set the view color to \c B_TRANSPARENT_COLOR then the Application Server
|
||||
won't erase the clipping region of the view before updating, this should only
|
||||
be used if the view erases itself by drawing on every pixel in the clipping
|
||||
region.
|
||||
|
||||
If you want to set the view color of a view to be the same as its parent you
|
||||
need to set it within the AttachedToWindow() method of the view like so:
|
||||
@@ -614,6 +625,7 @@ SetViewColor(Parent()->ViewColor());
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\fn BView::BView(const char* name, uint32 flags, BLayout* layout)
|
||||
\brief Layout constructor.
|
||||
@@ -2057,6 +2069,59 @@ SetViewColor(Parent()->ViewColor());
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BView::HasDefaultColors() const
|
||||
\brief Tests if the view has any colors set.
|
||||
|
||||
\return Boolean value, true if colors are not set.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BView::HasSystemColors() const
|
||||
\brief Tests if the view is using system "panel" colors.
|
||||
B_PANEL_BACKGROUND_COLOR for ViewUIColor()
|
||||
B_PANEL_BACKGROUND_COLOR for LowUIColor()
|
||||
B_PANEL_TEXT_COLOR for HighUIColor()
|
||||
|
||||
\return Boolean value, true if colors are as described.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::AdoptParentColors()
|
||||
\brief Attempts to use the colors of any parent view.
|
||||
Will adopt view, low, and high colors.
|
||||
Should be called in AttachedToWindow() or AllAttached().
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::AdoptSystemColors()
|
||||
\brief Instructs view to use standard system "panel" colors.
|
||||
B_PANEL_BACKGROUND_COLOR for ViewUIColor()
|
||||
B_PANEL_BACKGROUND_COLOR for LowUIColor()
|
||||
B_PANEL_TEXT_COLOR for HighUIColor()
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::AdoptViewColors(BView* view)
|
||||
\brief Attempts to use the colors of a given view.
|
||||
Will adopt view, low, and high colors.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::SetHighColor(rgb_color color)
|
||||
\brief Set the high color of the view.
|
||||
@@ -2081,6 +2146,18 @@ SetViewColor(Parent()->ViewColor());
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::SetHighUIColor(color_which which, float tint)
|
||||
\brief Set the high color of the view to a system constant.
|
||||
The color will update live with user changes.
|
||||
|
||||
\param which The color_which constant to set.
|
||||
\param tint Optional tint value to use.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn rgb_color BView::HighColor() const
|
||||
\brief Return the current high color.
|
||||
@@ -2094,6 +2171,20 @@ SetViewColor(Parent()->ViewColor());
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn color_which BView::HighUIColor(float* tint) const
|
||||
\brief Return the current high color constant being used.
|
||||
|
||||
\param tint Optional float pointer in which to store the tint
|
||||
value used to modify the system color constant.
|
||||
\return The current high color constant.
|
||||
|
||||
\sa SetHighUIColor(color_which, float)
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::SetLowColor(rgb_color color)
|
||||
\brief Set the low color of the view.
|
||||
@@ -2117,6 +2208,18 @@ SetViewColor(Parent()->ViewColor());
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::SetLowUIColor(color_which which, float tint)
|
||||
\brief Set the low color of the view to a system constant.
|
||||
The color will update live with user changes.
|
||||
|
||||
\param which The color_which constant to set.
|
||||
\param tint Optional tint value to use.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn rgb_color BView::LowColor() const
|
||||
\brief Return the current low color.
|
||||
@@ -2130,6 +2233,20 @@ SetViewColor(Parent()->ViewColor());
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn color_which BView::LowUIColor(float* tint) const
|
||||
\brief Return the current low color constant being used.
|
||||
|
||||
\param tint Optional float pointer in which to store the tint
|
||||
value used to modify the system color constant.
|
||||
\return The current low color constant.
|
||||
|
||||
\sa SetLowUIColor(color_which, float)
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::SetViewColor(rgb_color color)
|
||||
\brief Set the view color of the view.
|
||||
@@ -2154,6 +2271,18 @@ SetViewColor(Parent()->ViewColor());
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::SetViewUIColor(color_which which, float tint)
|
||||
\brief Set the view color of the view to a system constant.
|
||||
The color will update live with user changes.
|
||||
|
||||
\param which The color_which constant to set.
|
||||
\param tint Optional tint value to use.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn rgb_color BView::ViewColor() const
|
||||
\brief Return the current view color.
|
||||
@@ -2167,6 +2296,20 @@ SetViewColor(Parent()->ViewColor());
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn color_which BView::ViewUIColor(float* tint) const
|
||||
\brief Return the current view color constant being used.
|
||||
|
||||
\param tint Optional float pointer in which to store the tint
|
||||
value used to modify the system color constant.
|
||||
\return The current view color constant.
|
||||
|
||||
\sa SetViewUIColor(color_which, float)
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::ForceFontAliasing(bool enable)
|
||||
\brief Turn anti-aliasing on and off when printing.
|
||||
@@ -3696,6 +3839,34 @@ SetViewColor(Parent()->ViewColor());
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::DelayedInvalidate(bigtime_t delay)
|
||||
\brief Sends a message to App Server to redraw the entire view after
|
||||
a certain, minimum, delay. Repeated calls to this method may be
|
||||
merged, but the view is guaranteed to be redrawn after the delay
|
||||
given in the first call of this method.
|
||||
|
||||
\param delay The time, in microseconds, to wait until redrawing the view.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::DelayedInvalidate(bigtime_t delay, BRect invalRect)
|
||||
\brief Sends a message to App Server to redraw the portion of the view
|
||||
specified by \a invalRect after a certain, minimum, delay.
|
||||
Repeated calls to this method may be merged, but the invalidated
|
||||
rect is guaranteed to be redrawn after the minimum delay given
|
||||
by the first call of this method.
|
||||
|
||||
\param delay The time, in microseconds, to wait until redrawing the view.
|
||||
\param invalRect The rectangular area of the view to redraw.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BView::InvertRect(BRect rect)
|
||||
\brief Inverts the colors within \a rect.
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/*
|
||||
* Copyright 2011-2014 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2011-2015 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* John Scipione, [email protected]
|
||||
* Joseph Groover, [email protected]
|
||||
*
|
||||
* Corresponds to:
|
||||
* headers/os/interface/Window.h hrev45799
|
||||
* src/kits/interface/Window.cpp hrev45799
|
||||
* headers/os/interface/Window.h hrev497**
|
||||
* src/kits/interface/Window.cpp hrev497**
|
||||
*/
|
||||
|
||||
|
||||
@@ -1967,6 +1968,17 @@
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BWindow::IsOffscreenWindow() const
|
||||
\brief Tests if window is used for drawing into a BBitmap.
|
||||
This is mostly used by the Interface Kit itself.
|
||||
|
||||
\return True if the window is used for drawing into a BBitmap.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BWindow::Show()
|
||||
\brief Shows the window on screen, places it frontmost on the screen, adds
|
||||
|
||||
Reference in New Issue
Block a user