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-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-06-17 20:34:22 +04:00
|
|
|
#include "SubWindowList.h"
|
2005-11-24 20:45:26 +03:00
|
|
|
|
|
|
|
#include <Rect.h>
|
|
|
|
#include <String.h>
|
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
|
|
|
|
// these are used by window manager to properly place window.
|
|
|
|
enum {
|
2005-06-03 23:50:30 +04:00
|
|
|
B_SYSTEM_LAST = -10L,
|
|
|
|
|
|
|
|
B_FLOATING_APP = 0L,
|
|
|
|
B_MODAL_APP = 1L,
|
|
|
|
B_NORMAL = 2L,
|
|
|
|
B_FLOATING_ALL = 3L,
|
|
|
|
B_MODAL_ALL = 4L,
|
|
|
|
|
|
|
|
B_SYSTEM_FIRST = 10L,
|
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-06-03 23:50:30 +04:00
|
|
|
const char *name,
|
2005-06-28 06:00:48 +04:00
|
|
|
const uint32 look,
|
|
|
|
const uint32 feel,
|
|
|
|
const uint32 flags,
|
|
|
|
const uint32 workspaces,
|
|
|
|
ServerWindow *window,
|
2005-11-04 18:23:54 +03:00
|
|
|
DrawingEngine *driver);
|
2005-11-24 20:45:26 +03:00
|
|
|
virtual ~WindowLayer();
|
2004-01-21 05:58:39 +03:00
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
virtual void Draw(const BRect &r);
|
2004-01-21 05:58:39 +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-11-24 00:52:36 +03:00
|
|
|
virtual void MouseDown(BMessage *msg, BPoint where);
|
|
|
|
virtual void MouseUp(BMessage *msg, BPoint where);
|
|
|
|
virtual void MouseMoved(BMessage *msg, BPoint where);
|
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
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
inline Decorator* GetDecorator() const { return fDecorator; }
|
2005-03-21 23:29:24 +03:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
inline int32 Look() const { return fLook; }
|
|
|
|
inline int32 Feel() const { return fFeel; }
|
2005-04-21 22:57:34 +04:00
|
|
|
inline int32 Level() const { return fLevel; }
|
2005-06-03 23:50:30 +04:00
|
|
|
inline uint32 WindowFlags() const { return fWindowFlags; }
|
|
|
|
inline uint32 Workspaces() const { return fWorkspaces; }
|
2005-11-29 02:36:59 +03:00
|
|
|
void SetWorkspaces(uint32 workspaces)
|
|
|
|
{ fWorkspaces = workspaces; }
|
|
|
|
|
|
|
|
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-04-16 17:30:49 +04:00
|
|
|
inline void QuietlySetWorkspaces(uint32 wks) { fWorkspaces = wks; }
|
2005-04-21 22:57:34 +04:00
|
|
|
void QuietlySetFeel(int32 feel);
|
2005-04-16 17:30:49 +04:00
|
|
|
|
2005-06-17 20:34:22 +04:00
|
|
|
SubWindowList fSubWindowList;
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2005-11-24 20:54:14 +03:00
|
|
|
void RequestClientRedraw(const BRegion& invalid);
|
|
|
|
virtual void _AllRedraw(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-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
|
|
|
|
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-04-16 17:30:49 +04:00
|
|
|
int32 fLook;
|
|
|
|
int32 fFeel;
|
2005-04-21 22:57:34 +04:00
|
|
|
int32 fLevel;
|
2005-04-16 17:30:49 +04:00
|
|
|
int32 fWindowFlags;
|
|
|
|
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
|