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>
|
|
|
|
* Adi Oanca <adioanca@cotty.iren.ro>
|
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
|
|
*/
|
2003-02-14 04:53:53 +03:00
|
|
|
#ifndef _WINBORDER_H_
|
|
|
|
#define _WINBORDER_H_
|
|
|
|
|
|
|
|
#include <Rect.h>
|
|
|
|
#include <String.h>
|
|
|
|
#include "Layer.h"
|
2005-06-17 20:34:22 +04:00
|
|
|
#include "SubWindowList.h"
|
2005-03-11 00:34:04 +03:00
|
|
|
#include "Decorator.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;
|
|
|
|
class DisplayDriver;
|
2004-06-21 00:02:32 +04:00
|
|
|
class Desktop;
|
2003-02-14 04:53:53 +03:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
class WinBorder : public Layer {
|
|
|
|
public:
|
2005-06-28 06:00:48 +04:00
|
|
|
WinBorder(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-06-03 23:50:30 +04:00
|
|
|
DisplayDriver *driver);
|
|
|
|
virtual ~WinBorder();
|
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)
|
|
|
|
{ // 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-06-16 22:58:14 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-06-03 23:50:30 +04:00
|
|
|
virtual void RebuildFullRegion();
|
2005-06-16 22:58:14 +04:00
|
|
|
#endif
|
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-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-10-25 22:42:10 +04:00
|
|
|
virtual void MouseDown(const BMessage *msg);
|
|
|
|
virtual void MouseUp(const BMessage *msg);
|
|
|
|
virtual void MouseMoved(const BMessage *msg);
|
|
|
|
|
|
|
|
// 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-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
|
|
|
virtual bool HasClient() { return false; }
|
|
|
|
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-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);
|
2004-01-21 05:58:39 +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-06-16 00:36:43 +04:00
|
|
|
#ifdef NEW_CLIPPING
|
|
|
|
public:
|
|
|
|
virtual void MovedByHook(float dx, float dy);
|
|
|
|
virtual void ResizedByHook(float dx, float dy, bool automatic);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void set_decorator_region(BRect frame);
|
2005-10-07 20:05:22 +04:00
|
|
|
virtual void _ReserveRegions(BRegion ®);
|
|
|
|
virtual void _GetWantedRegion(BRegion ®);
|
2005-06-16 00:36:43 +04:00
|
|
|
|
|
|
|
BRegion fDecRegion;
|
|
|
|
bool fRebuildDecRegion;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
public:
|
|
|
|
virtual void SetTopLayer(Layer* layer);
|
|
|
|
inline Layer* TopLayer() const
|
|
|
|
{ return fTopLayer; }
|
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
protected:
|
2004-03-28 18:58:19 +04:00
|
|
|
friend class Layer;
|
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-28 06:00:48 +04:00
|
|
|
bool _ResizeBy(float x, float y);
|
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-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;
|
2004-01-21 05:58:39 +03:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
bool fIsDragging;
|
|
|
|
bool fBringToFrontOnRelease;
|
|
|
|
|
|
|
|
bool fIsResizing;
|
|
|
|
|
2005-06-16 16:32:42 +04:00
|
|
|
bool fIsSlidingTab;
|
|
|
|
|
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;
|
2005-04-07 00:52:58 +04:00
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
int cnt; // for debugging
|
2003-02-14 04:53:53 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|