2005-06-17 23:10:15 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2001-2005, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT license.
|
|
|
|
*
|
|
|
|
* Author: DarkWyrm <bpmagic@columbus.rr.com>
|
2005-11-07 22:01:12 +03:00
|
|
|
* Adi Oanca <adioanca@gmail.com>
|
2005-06-17 23:10:15 +04:00
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
2005-12-02 18:06:14 +03:00
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
2005-06-17 23:10:15 +04:00
|
|
|
*/
|
2005-11-24 20:45:26 +03:00
|
|
|
#ifndef WINDOW_LAYER_H
|
|
|
|
#define WINDOW_LAYER_H
|
2003-02-14 04:53:53 +03:00
|
|
|
|
2005-11-24 20:45:26 +03:00
|
|
|
|
|
|
|
#include "Decorator.h"
|
2003-02-14 04:53:53 +03:00
|
|
|
#include "Layer.h"
|
2005-11-24 20:45:26 +03:00
|
|
|
|
2005-12-02 18:06:14 +03:00
|
|
|
#include <ObjectList.h>
|
2005-11-24 20:45:26 +03:00
|
|
|
#include <Rect.h>
|
|
|
|
#include <String.h>
|
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2003-02-14 04:53:53 +03:00
|
|
|
class ServerWindow;
|
|
|
|
class Decorator;
|
2005-11-04 18:23:54 +03:00
|
|
|
class DrawingEngine;
|
2004-06-21 00:02:32 +04:00
|
|
|
class Desktop;
|
2003-02-14 04:53:53 +03:00
|
|
|
|
2005-11-24 20:45:26 +03:00
|
|
|
class WindowLayer : public Layer {
|
2005-06-03 23:50:30 +04:00
|
|
|
public:
|
2005-11-24 20:45:26 +03:00
|
|
|
WindowLayer(const BRect &frame,
|
2005-12-01 15:07:28 +03:00
|
|
|
const char *name, window_look look,
|
|
|
|
window_feel feel, uint32 flags,
|
|
|
|
uint32 workspaces, ServerWindow *window,
|
|
|
|
DrawingEngine *driver);
|
2005-11-24 20:45:26 +03:00
|
|
|
virtual ~WindowLayer();
|
2005-12-01 15:07:28 +03:00
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
virtual void Draw(const BRect &r);
|
2005-12-01 15:07:28 +03:00
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
virtual void MoveBy(float x, float y);
|
|
|
|
virtual void ResizeBy(float x, float y);
|
2005-06-28 16:25:32 +04:00
|
|
|
virtual void ScrollBy(float x, float y)
|
2005-11-09 23:14:52 +03:00
|
|
|
{ /* not allowed */ }
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
|
|
|
virtual void SetName(const char* name);
|
|
|
|
|
|
|
|
virtual bool IsOffscreenWindow() const
|
|
|
|
{ return false; }
|
|
|
|
|
2005-11-14 20:50:39 +03:00
|
|
|
virtual void GetOnScreenRegion(BRegion& region);
|
2005-11-07 22:01:12 +03:00
|
|
|
|
2005-06-25 17:09:19 +04:00
|
|
|
void UpdateStart();
|
|
|
|
void UpdateEnd();
|
|
|
|
inline bool InUpdate() const
|
|
|
|
{ return fInUpdate; }
|
|
|
|
inline const BRegion& RegionToBeUpdated() const
|
|
|
|
{ return fInUpdateRegion; }
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
inline const BRegion& CulmulatedUpdateRegion() const
|
|
|
|
{ return fCumulativeRegion; }
|
2005-11-08 00:24:53 +03:00
|
|
|
void EnableUpdateRequests();
|
2005-10-30 14:33:31 +03:00
|
|
|
inline void DisableUpdateRequests()
|
|
|
|
{ fUpdateRequestsEnabled = false; }
|
2005-06-25 17:09:19 +04:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
void SetSizeLimits(float minWidth,
|
|
|
|
float maxWidth,
|
|
|
|
float minHeight,
|
|
|
|
float maxHeight);
|
2004-03-28 18:58:19 +04:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
void GetSizeLimits(float* minWidth,
|
|
|
|
float* maxWidth,
|
|
|
|
float* minHeight,
|
|
|
|
float* maxHeight) const;
|
2004-08-08 00:30:58 +04:00
|
|
|
|
2005-12-01 15:07:28 +03:00
|
|
|
virtual void MouseDown(BMessage* message, BPoint where, int32* _viewToken);
|
|
|
|
virtual void MouseUp(BMessage* message, BPoint where, int32* _viewToken);
|
|
|
|
virtual void MouseMoved(BMessage* message, BPoint where, int32* _viewToken);
|
2005-10-25 22:42:10 +04:00
|
|
|
|
|
|
|
// click_type ActionFor(const BMessage *msg)
|
|
|
|
// { return _ActionFor(evt); }
|
|
|
|
|
2005-09-29 01:12:38 +04:00
|
|
|
virtual void WorkspaceActivated(int32 index, bool active);
|
2005-10-01 14:03:43 +04:00
|
|
|
virtual void WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces);
|
2005-10-29 15:15:47 +04:00
|
|
|
virtual void Activated(bool active);
|
2005-10-11 22:11:25 +04:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
void UpdateColors();
|
|
|
|
void UpdateDecorator();
|
|
|
|
void UpdateFont();
|
|
|
|
void UpdateScreen();
|
2005-06-16 16:32:42 +04:00
|
|
|
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 19:01:41 +03:00
|
|
|
bool IsFocus() const { return fIsFocus; }
|
|
|
|
void SetFocus(bool focus) { fIsFocus = focus; }
|
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
inline Decorator* GetDecorator() const { return fDecorator; }
|
2005-03-21 23:29:24 +03:00
|
|
|
|
2005-12-01 15:07:28 +03:00
|
|
|
window_look Look() const { return fLook; }
|
|
|
|
window_feel Feel() const { return fFeel; }
|
|
|
|
uint32 WindowFlags() const { return fWindowFlags; }
|
2005-11-30 18:47:01 +03:00
|
|
|
|
2005-12-01 16:59:04 +03:00
|
|
|
void SetLook(window_look look, BRegion* updateRegion);
|
|
|
|
void SetFeel(window_feel feel);
|
|
|
|
void SetWindowFlags(uint32 flags, BRegion* updateRegion);
|
|
|
|
|
2005-11-30 18:47:01 +03:00
|
|
|
uint32 Workspaces() const { return fWorkspaces; }
|
2005-11-29 02:36:59 +03:00
|
|
|
void SetWorkspaces(uint32 workspaces)
|
|
|
|
{ fWorkspaces = workspaces; }
|
2005-11-30 18:47:01 +03:00
|
|
|
bool OnWorkspace(int32 index) const
|
|
|
|
{ return (fWorkspaces & (1UL << index)) != 0; }
|
2005-11-29 02:36:59 +03:00
|
|
|
|
|
|
|
bool SupportsFront();
|
2005-04-16 17:30:49 +04:00
|
|
|
|
2005-06-16 16:32:42 +04:00
|
|
|
// 0.0 -> left .... 1.0 -> right
|
|
|
|
void SetTabLocation(float location);
|
|
|
|
float TabLocation() const;
|
|
|
|
|
|
|
|
void HighlightDecorator(bool active);
|
2005-11-24 20:54:14 +03:00
|
|
|
|
2005-12-02 13:35:01 +03:00
|
|
|
bool IsModal() const;
|
|
|
|
bool IsFloating() const;
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2005-12-02 18:06:14 +03:00
|
|
|
WindowLayer* Frontmost(WindowLayer* first = NULL);
|
|
|
|
|
|
|
|
bool AddToSubset(WindowLayer* window);
|
|
|
|
void RemoveFromSubset(WindowLayer* window);
|
|
|
|
bool HasInSubset(WindowLayer* window);
|
|
|
|
|
2005-11-24 20:54:14 +03:00
|
|
|
void RequestClientRedraw(const BRegion& invalid);
|
2005-11-06 20:47:06 +03:00
|
|
|
|
2005-11-24 20:54:14 +03:00
|
|
|
void SetTopLayer(Layer* layer);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
inline Layer* TopLayer() const
|
|
|
|
{ return fTopLayer; }
|
|
|
|
|
2005-12-01 18:58:04 +03:00
|
|
|
static bool IsValidLook(window_look look);
|
|
|
|
static bool IsValidFeel(window_feel feel);
|
2005-12-02 13:35:01 +03:00
|
|
|
static bool IsModalFeel(window_feel feel);
|
|
|
|
static bool IsFloatingFeel(window_feel feel);
|
|
|
|
|
2005-12-01 18:58:04 +03:00
|
|
|
static uint32 ValidWindowFlags();
|
2005-12-02 13:35:01 +03:00
|
|
|
static uint32 ValidWindowFlags(window_feel feel);
|
2005-12-01 18:58:04 +03:00
|
|
|
|
2005-12-01 15:07:28 +03:00
|
|
|
protected:
|
|
|
|
virtual void _AllRedraw(const BRegion& invalid);
|
|
|
|
|
2005-11-07 22:01:12 +03:00
|
|
|
private:
|
|
|
|
void set_decorator_region(BRect frame);
|
|
|
|
virtual void _ReserveRegions(BRegion ®);
|
|
|
|
|
2005-01-17 00:35:02 +03:00
|
|
|
friend class RootLayer;
|
2004-03-28 18:58:19 +04:00
|
|
|
|
2005-10-25 22:42:10 +04:00
|
|
|
click_type _ActionFor(const BMessage *msg) const;
|
2005-06-03 23:50:30 +04:00
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
Decorator* fDecorator;
|
|
|
|
Layer* fTopLayer;
|
|
|
|
|
2005-06-25 17:09:19 +04:00
|
|
|
BRegion fCumulativeRegion;
|
|
|
|
BRegion fInUpdateRegion;
|
2004-06-21 00:02:32 +04:00
|
|
|
|
2005-11-07 22:01:12 +03:00
|
|
|
BRegion fDecRegion;
|
|
|
|
bool fRebuildDecRegion;
|
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
int32 fMouseButtons;
|
|
|
|
BPoint fLastMousePosition;
|
2005-06-03 23:50:30 +04:00
|
|
|
BPoint fResizingClickOffset;
|
2005-03-31 00:06:50 +04:00
|
|
|
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 19:01:41 +03:00
|
|
|
bool fIsFocus;
|
|
|
|
|
2005-12-02 18:06:14 +03:00
|
|
|
BObjectList<WindowLayer> fSubsets;
|
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
bool fIsClosing;
|
|
|
|
bool fIsMinimizing;
|
|
|
|
bool fIsZooming;
|
2005-06-03 23:50:30 +04:00
|
|
|
bool fIsResizing;
|
2005-06-16 16:32:42 +04:00
|
|
|
bool fIsSlidingTab;
|
2005-10-30 14:33:31 +03:00
|
|
|
bool fIsDragging;
|
|
|
|
|
|
|
|
bool fBringToFrontOnRelease;
|
2005-06-16 16:32:42 +04:00
|
|
|
|
2005-10-30 14:33:31 +03:00
|
|
|
bool fUpdateRequestsEnabled;
|
2005-04-16 17:30:49 +04:00
|
|
|
bool fInUpdate;
|
|
|
|
bool fRequestSent;
|
2005-04-06 00:03:07 +04:00
|
|
|
|
2005-12-01 15:07:28 +03:00
|
|
|
window_look fLook;
|
|
|
|
window_feel fFeel;
|
|
|
|
uint32 fWindowFlags;
|
2005-04-16 17:30:49 +04:00
|
|
|
uint32 fWorkspaces;
|
2005-04-07 00:52:58 +04:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
float fMinWidth;
|
|
|
|
float fMaxWidth;
|
|
|
|
float fMinHeight;
|
|
|
|
float fMaxHeight;
|
2003-02-14 04:53:53 +03:00
|
|
|
};
|
|
|
|
|
2005-11-24 20:45:26 +03:00
|
|
|
#endif // WINDOW_LAYER_H
|