2006-04-23 19:55:15 +04:00
|
|
|
/*
|
2015-02-14 00:33:57 +03:00
|
|
|
* Copyright 2003-2015, Haiku.
|
2006-04-23 19:55:15 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Adrian Oanca <adioanca@cotty.iren.ro>
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
|
|
|
#ifndef VIEW_PRIVATE_H
|
|
|
|
#define VIEW_PRIVATE_H
|
|
|
|
|
|
|
|
|
2004-12-23 17:03:28 +03:00
|
|
|
#include <Font.h>
|
2003-08-31 21:22:46 +04:00
|
|
|
#include <InterfaceDefs.h>
|
|
|
|
#include <Point.h>
|
2004-12-23 17:03:28 +03:00
|
|
|
#include <Rect.h>
|
2003-08-31 21:22:46 +04:00
|
|
|
#include <Region.h>
|
2009-04-05 18:59:43 +04:00
|
|
|
#include <ServerProtocolStructs.h>
|
2010-08-17 22:43:41 +04:00
|
|
|
#include <View.h>
|
2004-12-23 17:03:28 +03:00
|
|
|
|
2015-02-14 00:33:57 +03:00
|
|
|
|
2006-07-07 23:16:50 +04:00
|
|
|
const static uint32 kDeleteReplicant = 'JAHA';
|
2004-12-23 17:03:28 +03:00
|
|
|
|
2008-02-24 14:18:52 +03:00
|
|
|
const static uint32 kWorkspacesViewFlag = 0x40000000UL;
|
|
|
|
// was/is _B_RESERVED1_ in View.h
|
|
|
|
|
2003-08-31 21:22:46 +04:00
|
|
|
enum {
|
|
|
|
B_VIEW_FONT_BIT = 0x00000001,
|
2005-06-28 22:56:55 +04:00
|
|
|
B_VIEW_HIGH_COLOR_BIT = 0x00000002,
|
|
|
|
B_VIEW_DRAWING_MODE_BIT = 0x00000004,
|
2003-08-31 21:22:46 +04:00
|
|
|
B_VIEW_CLIP_REGION_BIT = 0x00000008,
|
|
|
|
B_VIEW_LINE_MODES_BIT = 0x00000010,
|
|
|
|
B_VIEW_BLENDING_BIT = 0x00000020,
|
|
|
|
B_VIEW_SCALE_BIT = 0x00000040,
|
|
|
|
B_VIEW_FONT_ALIASING_BIT = 0x00000080,
|
2008-07-07 23:10:39 +04:00
|
|
|
B_VIEW_FRAME_BIT = 0x00000100,
|
|
|
|
B_VIEW_ORIGIN_BIT = 0x00000200,
|
2003-08-31 21:22:46 +04:00
|
|
|
B_VIEW_PEN_SIZE_BIT = 0x00000400,
|
2005-06-28 22:56:55 +04:00
|
|
|
B_VIEW_PEN_LOCATION_BIT = 0x00000800,
|
|
|
|
B_VIEW_LOW_COLOR_BIT = 0x00008000,
|
|
|
|
B_VIEW_VIEW_COLOR_BIT = 0x00010000,
|
|
|
|
B_VIEW_PATTERN_BIT = 0x00020000,
|
2014-02-05 01:46:55 +04:00
|
|
|
B_VIEW_TRANSFORM_BIT = 0x00040000,
|
2014-03-11 20:23:32 +04:00
|
|
|
B_VIEW_FILL_RULE_BIT = 0x00080000,
|
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 <waddlesplash@gmail.com>
2015-12-10 21:52:48 +03:00
|
|
|
B_VIEW_WHICH_VIEW_COLOR_BIT = 0x00100000,
|
|
|
|
B_VIEW_WHICH_LOW_COLOR_BIT = 0x00200000,
|
|
|
|
B_VIEW_WHICH_HIGH_COLOR_BIT = 0x00400000,
|
2022-11-01 23:02:18 +03:00
|
|
|
B_VIEW_PARENT_COMPOSITE_BIT = 0x00800000,
|
2005-06-28 22:56:55 +04:00
|
|
|
|
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 <waddlesplash@gmail.com>
2015-12-10 21:52:48 +03:00
|
|
|
B_VIEW_ALL_BITS = 0x00ffffff,
|
2005-06-29 04:22:01 +04:00
|
|
|
|
2005-06-28 22:56:55 +04:00
|
|
|
// these used for archiving only
|
2003-08-31 21:22:46 +04:00
|
|
|
B_VIEW_RESIZE_BIT = 0x00001000,
|
|
|
|
B_VIEW_FLAGS_BIT = 0x00002000,
|
2005-06-28 22:56:55 +04:00
|
|
|
B_VIEW_EVENT_MASK_BIT = 0x00004000
|
2003-08-31 21:22:46 +04:00
|
|
|
};
|
|
|
|
|
2003-12-08 01:10:52 +03:00
|
|
|
|
2010-08-17 22:43:41 +04:00
|
|
|
class BView::Private {
|
|
|
|
public:
|
2015-02-14 00:33:57 +03:00
|
|
|
Private(BView* view)
|
|
|
|
:
|
|
|
|
fView(view)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int16 ShowLevel()
|
|
|
|
{ return fView->fShowLevel; }
|
|
|
|
|
|
|
|
// defined in View.cpp
|
|
|
|
bool WillLayout();
|
|
|
|
bool MinMaxValid();
|
|
|
|
|
|
|
|
BLayoutItem* LayoutItemAt(int32 index);
|
|
|
|
int32 CountLayoutItems();
|
|
|
|
void RegisterLayoutItem(BLayoutItem* item);
|
|
|
|
void DeregisterLayoutItem(BLayoutItem* item);
|
|
|
|
|
|
|
|
bool RemoveSelf()
|
|
|
|
{ return fView->_RemoveSelf(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
BView* fView;
|
2010-08-17 22:43:41 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-06-28 22:56:55 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
|
2015-02-14 00:33:57 +03:00
|
|
|
|
2008-02-24 14:18:52 +03:00
|
|
|
class PortLink;
|
|
|
|
|
2015-02-14 00:33:57 +03:00
|
|
|
|
2005-06-28 22:56:55 +04:00
|
|
|
class ViewState {
|
|
|
|
public:
|
|
|
|
ViewState();
|
|
|
|
|
2005-06-29 04:22:01 +04:00
|
|
|
inline bool IsValid(uint32 bit) const;
|
|
|
|
inline bool IsAllValid() const;
|
2005-06-28 22:56:55 +04:00
|
|
|
|
|
|
|
void UpdateServerFontState(BPrivate::PortLink &link);
|
|
|
|
void UpdateServerState(BPrivate::PortLink &link);
|
|
|
|
|
2005-06-29 04:22:01 +04:00
|
|
|
void UpdateFrom(BPrivate::PortLink &link);
|
|
|
|
|
2005-06-28 22:56:55 +04:00
|
|
|
public:
|
|
|
|
BPoint pen_location;
|
|
|
|
float pen_size;
|
|
|
|
|
|
|
|
rgb_color high_color;
|
|
|
|
rgb_color low_color;
|
|
|
|
|
|
|
|
// This one is not affected by pop state/push state
|
|
|
|
rgb_color view_color;
|
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 <waddlesplash@gmail.com>
2015-12-10 21:52:48 +03:00
|
|
|
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;
|
2005-06-28 22:56:55 +04:00
|
|
|
|
|
|
|
::pattern pattern;
|
|
|
|
|
|
|
|
::drawing_mode drawing_mode;
|
|
|
|
BRegion clipping_region;
|
2006-03-08 21:57:44 +03:00
|
|
|
bool clipping_region_used;
|
2014-02-05 01:46:55 +04:00
|
|
|
|
|
|
|
// transformation
|
2005-06-28 22:56:55 +04:00
|
|
|
BPoint origin;
|
2014-02-05 01:46:55 +04:00
|
|
|
float scale;
|
|
|
|
BAffineTransform transform;
|
2005-06-28 22:56:55 +04:00
|
|
|
|
2022-11-01 23:02:18 +03:00
|
|
|
// composite transformation stack
|
|
|
|
BPoint parent_composite_origin;
|
|
|
|
float parent_composite_scale;
|
|
|
|
BAffineTransform parent_composite_transform;
|
|
|
|
|
2005-06-28 22:56:55 +04:00
|
|
|
// line modes
|
|
|
|
join_mode line_join;
|
|
|
|
cap_mode line_cap;
|
|
|
|
float miter_limit;
|
|
|
|
|
2014-03-11 20:23:32 +04:00
|
|
|
// fill rule
|
|
|
|
int32 fill_rule;
|
|
|
|
|
2005-06-28 22:56:55 +04:00
|
|
|
// alpha blending
|
|
|
|
source_alpha alpha_source_mode;
|
|
|
|
alpha_function alpha_function_mode;
|
|
|
|
|
|
|
|
// fonts
|
|
|
|
BFont font;
|
|
|
|
uint16 font_flags;
|
|
|
|
bool font_aliasing;
|
|
|
|
// font aliasing. Used for printing only!
|
|
|
|
|
|
|
|
// flags used for synchronization with app_server
|
|
|
|
uint32 valid_flags;
|
|
|
|
// flags used for archiving
|
|
|
|
uint32 archiving_flags;
|
2008-07-07 23:10:39 +04:00
|
|
|
|
|
|
|
// maintain our own rect as seen from the app while printing
|
|
|
|
BRect print_rect;
|
2003-08-31 21:22:46 +04:00
|
|
|
};
|
|
|
|
|
2015-02-14 00:33:57 +03:00
|
|
|
|
2005-06-29 04:22:01 +04:00
|
|
|
inline bool
|
|
|
|
ViewState::IsValid(uint32 bit) const
|
|
|
|
{
|
|
|
|
return valid_flags & bit;
|
|
|
|
}
|
|
|
|
|
2015-02-14 00:33:57 +03:00
|
|
|
|
2005-06-29 04:22:01 +04:00
|
|
|
inline bool
|
|
|
|
ViewState::IsAllValid() const
|
|
|
|
{
|
|
|
|
return (valid_flags & B_VIEW_ALL_BITS & ~B_VIEW_CLIP_REGION_BIT)
|
|
|
|
== (B_VIEW_ALL_BITS & ~B_VIEW_CLIP_REGION_BIT);
|
|
|
|
}
|
|
|
|
|
2015-02-14 00:33:57 +03:00
|
|
|
|
2005-06-28 22:56:55 +04:00
|
|
|
} // namespace BPrivate
|
|
|
|
|
2015-02-14 00:33:57 +03:00
|
|
|
|
2003-08-31 21:22:46 +04:00
|
|
|
struct _array_data_{
|
|
|
|
// the max number of points in the array
|
2009-04-05 18:59:43 +04:00
|
|
|
uint32 maxCount;
|
2008-07-07 23:10:39 +04:00
|
|
|
// the current number of points in the array
|
2009-04-05 18:59:43 +04:00
|
|
|
uint32 count;
|
2003-08-31 21:22:46 +04:00
|
|
|
// the array of points
|
2009-04-05 18:59:43 +04:00
|
|
|
ViewLineArrayInfo* array;
|
2003-08-31 21:22:46 +04:00
|
|
|
};
|
|
|
|
|
2015-02-14 00:33:57 +03:00
|
|
|
|
2006-04-23 19:55:15 +04:00
|
|
|
#endif /* VIEW_PRIVATE_H */
|