haiku/src/servers/app/WindowLayer.h

172 lines
4.4 KiB
C
Raw Normal View History

/*
* Copyright (c) 2001-2005, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Author: DarkWyrm <bpmagic@columbus.rr.com>
* Adi Oanca <adioanca@gmail.com>
* Stephan Aßmus <superstippi@gmx.de>
*/
#ifndef WINDOW_LAYER_H
#define WINDOW_LAYER_H
#include "Decorator.h"
#include "Layer.h"
#include "SubWindowList.h"
#include <Rect.h>
#include <String.h>
class ServerWindow;
class Decorator;
class DrawingEngine;
class Desktop;
class WindowLayer : public Layer {
public:
WindowLayer(const BRect &frame,
const char *name, window_look look,
window_feel feel, uint32 flags,
uint32 workspaces, ServerWindow *window,
DrawingEngine *driver);
virtual ~WindowLayer();
virtual void Draw(const BRect &r);
virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y);
virtual void ScrollBy(float x, float y)
{ /* 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; }
virtual void GetOnScreenRegion(BRegion& region);
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; }
void EnableUpdateRequests();
inline void DisableUpdateRequests()
{ fUpdateRequestsEnabled = false; }
void SetSizeLimits(float minWidth,
float maxWidth,
float minHeight,
float maxHeight);
void GetSizeLimits(float* minWidth,
float* maxWidth,
float* minHeight,
float* maxHeight) const;
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);
// click_type ActionFor(const BMessage *msg)
// { return _ActionFor(evt); }
virtual void WorkspaceActivated(int32 index, bool active);
virtual void WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces);
virtual void Activated(bool active);
void UpdateColors();
void UpdateDecorator();
void UpdateFont();
void UpdateScreen();
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; }
inline Decorator* GetDecorator() const { return fDecorator; }
window_look Look() const { return fLook; }
window_feel Feel() const { return fFeel; }
uint32 WindowFlags() const { return fWindowFlags; }
uint32 Workspaces() const { return fWorkspaces; }
void SetWorkspaces(uint32 workspaces)
{ fWorkspaces = workspaces; }
bool OnWorkspace(int32 index) const
{ return (fWorkspaces & (1UL << index)) != 0; }
bool SupportsFront();
// 0.0 -> left .... 1.0 -> right
void SetTabLocation(float location);
float TabLocation() const;
void HighlightDecorator(bool active);
void SetFeel(window_feel feel);
void SetLook(window_look look);
SubWindowList fSubWindowList;
void RequestClientRedraw(const BRegion& invalid);
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; }
protected:
virtual void _AllRedraw(const BRegion& invalid);
private:
void set_decorator_region(BRect frame);
virtual void _ReserveRegions(BRegion &reg);
friend class RootLayer;
click_type _ActionFor(const BMessage *msg) const;
Decorator* fDecorator;
Layer* fTopLayer;
BRegion fCumulativeRegion;
BRegion fInUpdateRegion;
BRegion fDecRegion;
bool fRebuildDecRegion;
int32 fMouseButtons;
BPoint fLastMousePosition;
BPoint fResizingClickOffset;
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;
bool fIsClosing;
bool fIsMinimizing;
bool fIsZooming;
bool fIsResizing;
bool fIsSlidingTab;
bool fIsDragging;
bool fBringToFrontOnRelease;
bool fUpdateRequestsEnabled;
bool fInUpdate;
bool fRequestSent;
window_look fLook;
window_feel fFeel;
uint32 fWindowFlags;
uint32 fWorkspaces;
float fMinWidth;
float fMaxWidth;
float fMinHeight;
float fMaxHeight;
};
#endif // WINDOW_LAYER_H