2003-02-15 18:28:22 +03:00
|
|
|
//------------------------------------------------------------------------------
|
2005-06-03 23:50:30 +04:00
|
|
|
// Copyright (c) 2001-2005, Haiku, Inc.
|
2003-02-15 18:28:22 +03:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
//
|
|
|
|
// File Name: WinBorder.h
|
|
|
|
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
2005-06-16 22:58:14 +04:00
|
|
|
// Adi Oanca <adioanca@cotty.iren.ro>
|
2005-06-03 23:50:30 +04:00
|
|
|
// Stephan Aßmus <superstippi@gmx.de>
|
2003-02-15 18:28:22 +03:00
|
|
|
// Description: Layer subclass which handles window management
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
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 PointerEvent {
|
|
|
|
public:
|
|
|
|
int32 code; // B_MOUSE_UP, B_MOUSE_DOWN, B_MOUSE_MOVED,
|
|
|
|
// B_MOUSE_WHEEL_CHANGED
|
|
|
|
bigtime_t when;
|
|
|
|
BPoint where;
|
|
|
|
float wheel_delta_x;
|
|
|
|
float wheel_delta_y;
|
|
|
|
int32 modifiers;
|
|
|
|
int32 buttons; // B_PRIMARY_MOUSE_BUTTON, B_SECONDARY_MOUSE_BUTTON
|
|
|
|
// B_TERTIARY_MOUSE_BUTTON
|
|
|
|
int32 clicks;
|
2004-07-30 19:16:59 +04:00
|
|
|
};
|
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
class WinBorder : public Layer {
|
|
|
|
public:
|
|
|
|
WinBorder(const BRect &r,
|
|
|
|
const char *name,
|
|
|
|
const uint32 wlook,
|
|
|
|
const uint32 wfeel,
|
|
|
|
const uint32 wflags,
|
|
|
|
const uint32 wwksindex,
|
|
|
|
ServerWindow *win,
|
|
|
|
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-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-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-06-03 23:50:30 +04:00
|
|
|
click_type MouseDown(const PointerEvent& evt);
|
|
|
|
void MouseMoved(const PointerEvent& evt);
|
|
|
|
void MouseUp(const PointerEvent& evt);
|
2004-01-21 05:58:39 +03: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
|
|
|
bool HasPoint(const BPoint &pt) const;
|
|
|
|
|
|
|
|
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);
|
|
|
|
virtual bool alter_visible_for_children(BRegion ®ion);
|
|
|
|
virtual void get_user_regions(BRegion ®);
|
|
|
|
|
|
|
|
BRegion fDecRegion;
|
|
|
|
bool fRebuildDecRegion;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
protected:
|
2004-03-28 18:58:19 +04:00
|
|
|
friend class Layer;
|
|
|
|
friend class ServerWindow;
|
2005-01-17 00:35:02 +03:00
|
|
|
friend class RootLayer;
|
2004-03-28 18:58:19 +04:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
click_type _ActionFor(const PointerEvent& evt) const;
|
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
Decorator* fDecorator;
|
|
|
|
Layer* fTopLayer;
|
|
|
|
|
|
|
|
BRegion zUpdateReg;
|
|
|
|
BRegion yUpdateReg;
|
|
|
|
BRegion fUpdateReg;
|
2004-06-21 00:02:32 +04:00
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
int32 fMouseButtons;
|
|
|
|
int32 fKeyModifiers;
|
|
|
|
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
|