added a way for BWindow to store and restore arbitrary decor settings,
currently those include only the tab location git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17583 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+239
-200
@@ -90,140 +90,172 @@ enum {
|
|||||||
|
|
||||||
class BWindow : public BLooper {
|
class BWindow : public BLooper {
|
||||||
public:
|
public:
|
||||||
BWindow(BRect frame, const char* title,
|
BWindow(BRect frame, const char* title,
|
||||||
window_type type, uint32 flags,
|
window_type type, uint32 flags,
|
||||||
uint32 workspace = B_CURRENT_WORKSPACE);
|
uint32 workspace = B_CURRENT_WORKSPACE);
|
||||||
BWindow(BRect frame, const char* title,
|
BWindow(BRect frame, const char* title,
|
||||||
window_look look, window_feel feel,
|
window_look look, window_feel feel,
|
||||||
uint32 flags,
|
uint32 flags,
|
||||||
uint32 workspace = B_CURRENT_WORKSPACE);
|
uint32 workspace = B_CURRENT_WORKSPACE);
|
||||||
virtual ~BWindow();
|
virtual ~BWindow();
|
||||||
|
|
||||||
BWindow(BMessage* data);
|
BWindow(BMessage* data);
|
||||||
static BArchivable *Instantiate(BMessage* data);
|
|
||||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
|
||||||
|
|
||||||
virtual void Quit();
|
static BArchivable* Instantiate(BMessage* data);
|
||||||
void Close() { Quit(); }
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||||
|
|
||||||
void AddChild(BView* child, BView* before = NULL);
|
virtual void Quit();
|
||||||
bool RemoveChild(BView* child);
|
void Close() { Quit(); }
|
||||||
int32 CountChildren() const;
|
|
||||||
BView *ChildAt(int32 index) const;
|
|
||||||
|
|
||||||
virtual void DispatchMessage(BMessage* message, BHandler* handler);
|
void AddChild(BView* child, BView* before = NULL);
|
||||||
virtual void MessageReceived(BMessage* message);
|
bool RemoveChild(BView* child);
|
||||||
virtual void FrameMoved(BPoint new_position);
|
int32 CountChildren() const;
|
||||||
virtual void WorkspacesChanged(uint32 old_ws, uint32 new_ws);
|
BView* ChildAt(int32 index) const;
|
||||||
virtual void WorkspaceActivated(int32 ws, bool state);
|
|
||||||
virtual void FrameResized(float new_width, float new_height);
|
|
||||||
virtual void Minimize(bool minimize);
|
|
||||||
virtual void Zoom(BPoint origin, float width, float height);
|
|
||||||
void Zoom();
|
|
||||||
void SetZoomLimits(float maxWidth, float maxHeight);
|
|
||||||
virtual void ScreenChanged(BRect screen_size, color_space depth);
|
|
||||||
void SetPulseRate(bigtime_t rate);
|
|
||||||
bigtime_t PulseRate() const;
|
|
||||||
void AddShortcut(uint32 key, uint32 modifiers,
|
|
||||||
BMessage *msg);
|
|
||||||
void AddShortcut(uint32 key, uint32 modifiers,
|
|
||||||
BMessage *msg, BHandler *target);
|
|
||||||
void RemoveShortcut(uint32 key, uint32 modifiers);
|
|
||||||
void SetDefaultButton(BButton* button);
|
|
||||||
BButton *DefaultButton() const;
|
|
||||||
virtual void MenusBeginning();
|
|
||||||
virtual void MenusEnded();
|
|
||||||
bool NeedsUpdate() const;
|
|
||||||
void UpdateIfNeeded();
|
|
||||||
BView *FindView(const char *viewName) const;
|
|
||||||
BView *FindView(BPoint) const;
|
|
||||||
BView *CurrentFocus() const;
|
|
||||||
void Activate(bool = true);
|
|
||||||
virtual void WindowActivated(bool state);
|
|
||||||
|
|
||||||
void ConvertToScreen(BPoint* pt) const;
|
virtual void DispatchMessage(BMessage* message,
|
||||||
BPoint ConvertToScreen(BPoint pt) const;
|
BHandler* handler);
|
||||||
void ConvertFromScreen(BPoint* pt) const;
|
virtual void MessageReceived(BMessage* message);
|
||||||
BPoint ConvertFromScreen(BPoint pt) const;
|
virtual void FrameMoved(BPoint new_position);
|
||||||
void ConvertToScreen(BRect* rect) const;
|
virtual void WorkspacesChanged(uint32 oldWorkspaces,
|
||||||
BRect ConvertToScreen(BRect rect) const;
|
uint32 newWorkspaces);
|
||||||
void ConvertFromScreen(BRect* rect) const;
|
virtual void WorkspaceActivated(int32 workspace,
|
||||||
BRect ConvertFromScreen(BRect rect) const;
|
bool state);
|
||||||
|
virtual void FrameResized(float newWidth, float newHeight);
|
||||||
|
virtual void Minimize(bool minimize);
|
||||||
|
virtual void Zoom(BPoint origin, float width, float height);
|
||||||
|
void Zoom();
|
||||||
|
void SetZoomLimits(float maxWidth, float maxHeight);
|
||||||
|
virtual void ScreenChanged(BRect screenSize,
|
||||||
|
color_space format);
|
||||||
|
|
||||||
void MoveBy(float dx, float dy);
|
void SetPulseRate(bigtime_t rate);
|
||||||
void MoveTo(BPoint);
|
bigtime_t PulseRate() const;
|
||||||
void MoveTo(float x, float y);
|
|
||||||
void ResizeBy(float dx, float dy);
|
|
||||||
void ResizeTo(float width, float height);
|
|
||||||
|
|
||||||
virtual void Show();
|
void AddShortcut(uint32 key, uint32 modifiers,
|
||||||
virtual void Hide();
|
BMessage *message);
|
||||||
bool IsHidden() const;
|
void AddShortcut(uint32 key, uint32 modifiers,
|
||||||
bool IsMinimized() const;
|
BMessage *message,
|
||||||
|
BHandler *target);
|
||||||
|
void RemoveShortcut(uint32 key, uint32 modifiers);
|
||||||
|
|
||||||
void Flush() const;
|
void SetDefaultButton(BButton* button);
|
||||||
void Sync() const;
|
BButton* DefaultButton() const;
|
||||||
|
|
||||||
status_t SendBehind(const BWindow* window);
|
virtual void MenusBeginning();
|
||||||
|
virtual void MenusEnded();
|
||||||
|
|
||||||
void DisableUpdates();
|
bool NeedsUpdate() const;
|
||||||
void EnableUpdates();
|
void UpdateIfNeeded();
|
||||||
|
|
||||||
void BeginViewTransaction(); // referred as OpenViewTransaction() in BeBook
|
BView* FindView(const char* viewName) const;
|
||||||
void EndViewTransaction(); // referred as CommitViewTransaction() in BeBook
|
BView* FindView(BPoint) const;
|
||||||
|
BView* CurrentFocus() const;
|
||||||
|
|
||||||
BRect Bounds() const;
|
void Activate(bool = true);
|
||||||
BRect Frame() const;
|
virtual void WindowActivated(bool state);
|
||||||
const char *Title() const;
|
|
||||||
void SetTitle(const char* title);
|
|
||||||
bool IsFront() const;
|
|
||||||
bool IsActive() const;
|
|
||||||
void SetKeyMenuBar(BMenuBar* bar);
|
|
||||||
BMenuBar *KeyMenuBar() const;
|
|
||||||
void SetSizeLimits(float minWidth, float maxWidth,
|
|
||||||
float minHeight, float maxHeight);
|
|
||||||
void GetSizeLimits(float *minWidth, float *maxWidth,
|
|
||||||
float *minHeight, float *maxHeight);
|
|
||||||
uint32 Workspaces() const;
|
|
||||||
void SetWorkspaces(uint32);
|
|
||||||
BView *LastMouseMovedView() const;
|
|
||||||
|
|
||||||
virtual BHandler *ResolveSpecifier(BMessage* msg, int32 index,
|
void ConvertToScreen(BPoint* point) const;
|
||||||
BMessage* specifier, int32 form, const char* property);
|
BPoint ConvertToScreen(BPoint point) const;
|
||||||
virtual status_t GetSupportedSuites(BMessage* data);
|
void ConvertFromScreen(BPoint* point) const;
|
||||||
|
BPoint ConvertFromScreen(BPoint point) const;
|
||||||
|
void ConvertToScreen(BRect* rect) const;
|
||||||
|
BRect ConvertToScreen(BRect rect) const;
|
||||||
|
void ConvertFromScreen(BRect* rect) const;
|
||||||
|
BRect ConvertFromScreen(BRect rect) const;
|
||||||
|
|
||||||
status_t AddToSubset(BWindow* window);
|
void MoveBy(float dx, float dy);
|
||||||
status_t RemoveFromSubset(BWindow* window);
|
void MoveTo(BPoint);
|
||||||
|
void MoveTo(float x, float y);
|
||||||
|
void ResizeBy(float dx, float dy);
|
||||||
|
void ResizeTo(float width, float height);
|
||||||
|
|
||||||
virtual status_t Perform(perform_code d, void* arg);
|
virtual void Show();
|
||||||
|
virtual void Hide();
|
||||||
|
bool IsHidden() const;
|
||||||
|
bool IsMinimized() const;
|
||||||
|
|
||||||
status_t SetType(window_type type);
|
void Flush() const;
|
||||||
window_type Type() const;
|
void Sync() const;
|
||||||
|
|
||||||
status_t SetLook(window_look look);
|
status_t SendBehind(const BWindow* window);
|
||||||
window_look Look() const;
|
|
||||||
|
|
||||||
status_t SetFeel(window_feel feel);
|
void DisableUpdates();
|
||||||
window_feel Feel() const;
|
void EnableUpdates();
|
||||||
|
|
||||||
status_t SetFlags(uint32);
|
void BeginViewTransaction();
|
||||||
uint32 Flags() const;
|
// referred as OpenViewTransaction() in BeBook
|
||||||
|
void EndViewTransaction();
|
||||||
|
// referred as CommitViewTransaction() in BeBook
|
||||||
|
|
||||||
bool IsModal() const;
|
BRect Bounds() const;
|
||||||
bool IsFloating() const;
|
BRect Frame() const;
|
||||||
|
const char* Title() const;
|
||||||
|
void SetTitle(const char* title);
|
||||||
|
bool IsFront() const;
|
||||||
|
bool IsActive() const;
|
||||||
|
|
||||||
status_t SetWindowAlignment(window_alignment mode, int32 h,
|
void SetKeyMenuBar(BMenuBar* bar);
|
||||||
int32 hOffset = 0, int32 width = 0, int32 widthOffset = 0,
|
BMenuBar* KeyMenuBar() const;
|
||||||
int32 v = 0, int32 vOffset = 0, int32 height = 0,
|
|
||||||
int32 heightOffset = 0);
|
|
||||||
status_t GetWindowAlignment(window_alignment* mode = NULL,
|
|
||||||
int32* h = NULL, int32* hOffset = NULL,
|
|
||||||
int32* width = NULL, int32* widthOffset = NULL,
|
|
||||||
int32* v = NULL, int32* vOffset = NULL,
|
|
||||||
int32* height = NULL, int32* heightOffset = NULL) const;
|
|
||||||
|
|
||||||
virtual bool QuitRequested();
|
void SetSizeLimits(float minWidth, float maxWidth,
|
||||||
virtual thread_id Run();
|
float minHeight, float maxHeight);
|
||||||
|
void GetSizeLimits(float* minWidth, float* maxWidth,
|
||||||
|
float* minHeight, float* maxHeight);
|
||||||
|
|
||||||
|
status_t SetDecoratorSettings(const BMessage& settings);
|
||||||
|
status_t GetDecoratorSettings(BMessage* settings);
|
||||||
|
|
||||||
|
uint32 Workspaces() const;
|
||||||
|
void SetWorkspaces(uint32);
|
||||||
|
|
||||||
|
BView* LastMouseMovedView() const;
|
||||||
|
|
||||||
|
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
|
||||||
|
BMessage* specifier, int32 form,
|
||||||
|
const char* property);
|
||||||
|
virtual status_t GetSupportedSuites(BMessage* data);
|
||||||
|
|
||||||
|
status_t AddToSubset(BWindow* window);
|
||||||
|
status_t RemoveFromSubset(BWindow* window);
|
||||||
|
|
||||||
|
virtual status_t Perform(perform_code d, void* arg);
|
||||||
|
|
||||||
|
status_t SetType(window_type type);
|
||||||
|
window_type Type() const;
|
||||||
|
|
||||||
|
status_t SetLook(window_look look);
|
||||||
|
window_look Look() const;
|
||||||
|
|
||||||
|
status_t SetFeel(window_feel feel);
|
||||||
|
window_feel Feel() const;
|
||||||
|
|
||||||
|
status_t SetFlags(uint32);
|
||||||
|
uint32 Flags() const;
|
||||||
|
|
||||||
|
bool IsModal() const;
|
||||||
|
bool IsFloating() const;
|
||||||
|
|
||||||
|
status_t SetWindowAlignment(window_alignment mode,
|
||||||
|
int32 h,
|
||||||
|
int32 hOffset = 0,
|
||||||
|
int32 width = 0,
|
||||||
|
int32 widthOffset = 0,
|
||||||
|
int32 v = 0,
|
||||||
|
int32 vOffset = 0,
|
||||||
|
int32 height = 0,
|
||||||
|
int32 heightOffset = 0);
|
||||||
|
status_t GetWindowAlignment(window_alignment* mode = NULL,
|
||||||
|
int32* h = NULL,
|
||||||
|
int32* hOffset = NULL,
|
||||||
|
int32* width = NULL,
|
||||||
|
int32* widthOffset = NULL,
|
||||||
|
int32* v = NULL,
|
||||||
|
int32* vOffset = NULL,
|
||||||
|
int32* height = NULL,
|
||||||
|
int32* heightOffset = NULL) const;
|
||||||
|
|
||||||
|
virtual bool QuitRequested();
|
||||||
|
virtual thread_id Run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef BLooper inherited;
|
typedef BLooper inherited;
|
||||||
@@ -241,108 +273,115 @@ private:
|
|||||||
friend class BHandler;
|
friend class BHandler;
|
||||||
friend class _BEventMask;
|
friend class _BEventMask;
|
||||||
friend void _set_menu_sem_(BWindow* w, sem_id sem);
|
friend void _set_menu_sem_(BWindow* w, sem_id sem);
|
||||||
friend status_t _safe_get_server_token_(const BLooper* , int32* );
|
friend status_t _safe_get_server_token_(const BLooper*, int32*);
|
||||||
|
|
||||||
virtual void _ReservedWindow1();
|
virtual void _ReservedWindow1();
|
||||||
virtual void _ReservedWindow2();
|
virtual void _ReservedWindow2();
|
||||||
virtual void _ReservedWindow3();
|
virtual void _ReservedWindow3();
|
||||||
virtual void _ReservedWindow4();
|
virtual void _ReservedWindow4();
|
||||||
virtual void _ReservedWindow5();
|
virtual void _ReservedWindow5();
|
||||||
virtual void _ReservedWindow6();
|
virtual void _ReservedWindow6();
|
||||||
virtual void _ReservedWindow7();
|
virtual void _ReservedWindow7();
|
||||||
virtual void _ReservedWindow8();
|
virtual void _ReservedWindow8();
|
||||||
|
|
||||||
BWindow();
|
BWindow();
|
||||||
BWindow(BWindow&);
|
BWindow(BWindow&);
|
||||||
BWindow &operator=(BWindow&);
|
BWindow& operator=(BWindow&);
|
||||||
|
|
||||||
BWindow(BRect frame, int32 bitmapToken);
|
BWindow(BRect frame, int32 bitmapToken);
|
||||||
void _InitData(BRect frame, const char* title,
|
void _InitData(BRect frame, const char* title,
|
||||||
window_look look, window_feel feel,
|
window_look look, window_feel feel,
|
||||||
uint32 flags, uint32 workspace,
|
uint32 flags, uint32 workspace,
|
||||||
int32 bitmapToken = -1);
|
int32 bitmapToken = -1);
|
||||||
void BitmapClose(); // to be implemented
|
|
||||||
virtual void task_looper();
|
|
||||||
|
|
||||||
virtual BMessage *ConvertToMessage(void* raw, int32 code);
|
void BitmapClose(); // to be implemented
|
||||||
|
virtual void task_looper();
|
||||||
|
|
||||||
void AddShortcut(uint32 key, uint32 modifiers,
|
virtual BMessage* ConvertToMessage(void* raw, int32 code);
|
||||||
BMenuItem* item);
|
|
||||||
BHandler* _DetermineTarget(BMessage* message, BHandler* target);
|
|
||||||
bool _UnpackMessage(unpack_cookie& state, BMessage** _message,
|
|
||||||
BHandler** _target, bool* _usePreferred);
|
|
||||||
void _SanitizeMessage(BMessage* message, BHandler* target,
|
|
||||||
bool usePreferred);
|
|
||||||
|
|
||||||
bool InUpdate();
|
void AddShortcut(uint32 key, uint32 modifiers,
|
||||||
void _DequeueAll();
|
BMenuItem* item);
|
||||||
window_type _ComposeType(window_look look,
|
BHandler* _DetermineTarget(BMessage* message,
|
||||||
window_feel feel) const;
|
BHandler* target);
|
||||||
void _DecomposeType(window_type type,
|
bool _UnpackMessage(unpack_cookie& state,
|
||||||
window_look* look,
|
BMessage** _message,
|
||||||
window_feel* feel) const;
|
BHandler** _target,
|
||||||
|
bool* _usePreferred);
|
||||||
|
void _SanitizeMessage(BMessage* message,
|
||||||
|
BHandler* target,
|
||||||
|
bool usePreferred);
|
||||||
|
|
||||||
void SetIsFilePanel(bool yes);
|
bool InUpdate();
|
||||||
bool IsFilePanel() const;
|
void _DequeueAll();
|
||||||
|
window_type _ComposeType(window_look look,
|
||||||
|
window_feel feel) const;
|
||||||
|
void _DecomposeType(window_type type,
|
||||||
|
window_look* look,
|
||||||
|
window_feel* feel) const;
|
||||||
|
|
||||||
void _CreateTopView();
|
void SetIsFilePanel(bool yes);
|
||||||
void _AdoptResize();
|
bool IsFilePanel() const;
|
||||||
void _SetFocus(BView *focusView, bool notifyIputServer = false);
|
|
||||||
|
|
||||||
Shortcut* _FindShortcut(uint32 key, uint32 modifiers);
|
void _CreateTopView();
|
||||||
BView* _FindView(BView* view, BPoint point) const;
|
void _AdoptResize();
|
||||||
BView* _FindView(int32 token);
|
void _SetFocus(BView* focusView,
|
||||||
BView* _LastViewChild(BView *parent);
|
bool notifyIputServer = false);
|
||||||
|
|
||||||
BView* _FindNextNavigable(BView *focus, uint32 flags);
|
Shortcut* _FindShortcut(uint32 key, uint32 modifiers);
|
||||||
BView* _FindPreviousNavigable(BView *focus, uint32 flags);
|
BView* _FindView(BView* view, BPoint point) const;
|
||||||
bool _HandleKeyDown(char key, uint32 modifiers);
|
BView* _FindView(int32 token);
|
||||||
void _KeyboardNavigation();
|
BView* _LastViewChild(BView* parent);
|
||||||
|
|
||||||
|
BView* _FindNextNavigable(BView *focus, uint32 flags);
|
||||||
|
BView* _FindPreviousNavigable(BView *focus,
|
||||||
|
uint32 flags);
|
||||||
|
bool _HandleKeyDown(char key, uint32 modifiers);
|
||||||
|
void _KeyboardNavigation();
|
||||||
|
|
||||||
// Debug (TODO: to be removed)
|
// Debug (TODO: to be removed)
|
||||||
void PrintToStream() const;
|
void PrintToStream() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char *fTitle;
|
char* fTitle;
|
||||||
int32 server_token; // not yet used
|
int32 server_token; // not yet used
|
||||||
bool fInTransaction;
|
bool fInTransaction;
|
||||||
bool fActive;
|
bool fActive;
|
||||||
short fShowLevel;
|
short fShowLevel;
|
||||||
uint32 fFlags;
|
uint32 fFlags;
|
||||||
|
|
||||||
BView *fTopView;
|
BView* fTopView;
|
||||||
BView *fFocus;
|
BView* fFocus;
|
||||||
BView *fLastMouseMovedView;
|
BView* fLastMouseMovedView;
|
||||||
uint32 _unused1;
|
uint32 _unused1;
|
||||||
BMenuBar *fKeyMenuBar;
|
BMenuBar* fKeyMenuBar;
|
||||||
BButton *fDefaultButton;
|
BButton* fDefaultButton;
|
||||||
BList fShortcuts;
|
BList fShortcuts;
|
||||||
int32 fTopViewToken;
|
int32 fTopViewToken;
|
||||||
bool _unused2; // was fPulseEnabled
|
bool _unused2; // was fPulseEnabled
|
||||||
bool fViewsNeedPulse; // not yet used
|
bool fViewsNeedPulse; // not yet used
|
||||||
bool fIsFilePanel;
|
bool fIsFilePanel;
|
||||||
bool fMaskActivated;
|
bool fMaskActivated;
|
||||||
bigtime_t fPulseRate;
|
bigtime_t fPulseRate;
|
||||||
bool fWaitingForMenu;
|
bool fWaitingForMenu;
|
||||||
bool fMinimized;
|
bool fMinimized;
|
||||||
bool fNoQuitShortcut;
|
bool fNoQuitShortcut;
|
||||||
bool _unused3;
|
bool _unused3;
|
||||||
sem_id fMenuSem;
|
sem_id fMenuSem;
|
||||||
float fMaxZoomHeight;
|
float fMaxZoomHeight;
|
||||||
float fMaxZoomWidth;
|
float fMaxZoomWidth;
|
||||||
float fMinHeight;
|
float fMinHeight;
|
||||||
float fMinWidth;
|
float fMinWidth;
|
||||||
float fMaxHeight;
|
float fMaxHeight;
|
||||||
float fMaxWidth;
|
float fMaxWidth;
|
||||||
BRect fFrame;
|
BRect fFrame;
|
||||||
window_look fLook;
|
window_look fLook;
|
||||||
window_feel fFeel;
|
window_feel fFeel;
|
||||||
int32 fLastViewToken;
|
int32 fLastViewToken;
|
||||||
BPrivate::PortLink *fLink;
|
BPrivate::PortLink* fLink;
|
||||||
BMessageRunner *fPulseRunner;
|
BMessageRunner* fPulseRunner;
|
||||||
BRect fPreviousFrame;
|
BRect fPreviousFrame;
|
||||||
|
|
||||||
uint32 _reserved[9];
|
uint32 _reserved[9];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WINDOW_H
|
#endif // _WINDOW_H
|
||||||
|
|||||||
@@ -182,6 +182,8 @@ enum {
|
|||||||
AS_SET_MOUSE_MODE,
|
AS_SET_MOUSE_MODE,
|
||||||
AS_GET_MOUSE_MODE,
|
AS_GET_MOUSE_MODE,
|
||||||
AS_GET_MOUSE,
|
AS_GET_MOUSE,
|
||||||
|
AS_SET_DECORATOR_SETTINGS,
|
||||||
|
AS_GET_DECORATOR_SETTINGS,
|
||||||
|
|
||||||
// Graphics calls
|
// Graphics calls
|
||||||
AS_SET_HIGH_COLOR,
|
AS_SET_HIGH_COLOR,
|
||||||
|
|||||||
@@ -1146,31 +1146,32 @@ BWindow::SetSizeLimits(float minWidth, float maxWidth,
|
|||||||
if (minWidth > maxWidth || minHeight > maxHeight)
|
if (minWidth > maxWidth || minHeight > maxHeight)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Lock()) {
|
if (!Lock())
|
||||||
fLink->StartMessage(AS_SET_SIZE_LIMITS);
|
return;
|
||||||
fLink->Attach<float>(minWidth);
|
|
||||||
fLink->Attach<float>(maxWidth);
|
|
||||||
fLink->Attach<float>(minHeight);
|
|
||||||
fLink->Attach<float>(maxHeight);
|
|
||||||
|
|
||||||
int32 code;
|
fLink->StartMessage(AS_SET_SIZE_LIMITS);
|
||||||
if (fLink->FlushWithReply(code) == B_OK
|
fLink->Attach<float>(minWidth);
|
||||||
&& code == B_OK) {
|
fLink->Attach<float>(maxWidth);
|
||||||
// read the values that were really enforced on
|
fLink->Attach<float>(minHeight);
|
||||||
// the server side (the window frame could have
|
fLink->Attach<float>(maxHeight);
|
||||||
// been changed, too)
|
|
||||||
fLink->Read<BRect>(&fFrame);
|
|
||||||
fLink->Read<float>(&fMinWidth);
|
|
||||||
fLink->Read<float>(&fMaxWidth);
|
|
||||||
fLink->Read<float>(&fMinHeight);
|
|
||||||
fLink->Read<float>(&fMaxHeight);
|
|
||||||
|
|
||||||
_AdoptResize();
|
int32 code;
|
||||||
// TODO: the same has to be done for SetLook() (that can alter
|
if (fLink->FlushWithReply(code) == B_OK
|
||||||
// the size limits, and hence, the size of the window
|
&& code == B_OK) {
|
||||||
}
|
// read the values that were really enforced on
|
||||||
Unlock();
|
// the server side (the window frame could have
|
||||||
|
// been changed, too)
|
||||||
|
fLink->Read<BRect>(&fFrame);
|
||||||
|
fLink->Read<float>(&fMinWidth);
|
||||||
|
fLink->Read<float>(&fMaxWidth);
|
||||||
|
fLink->Read<float>(&fMinHeight);
|
||||||
|
fLink->Read<float>(&fMaxHeight);
|
||||||
|
|
||||||
|
_AdoptResize();
|
||||||
|
// TODO: the same has to be done for SetLook() (that can alter
|
||||||
|
// the size limits, and hence, the size of the window
|
||||||
}
|
}
|
||||||
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1186,6 +1187,76 @@ BWindow::GetSizeLimits(float *minWidth, float *maxWidth,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BWindow::SetDecoratorSettings(const BMessage& settings)
|
||||||
|
{
|
||||||
|
// flatten the given settings into a buffer and send
|
||||||
|
// it to the app_server to apply the settings to the
|
||||||
|
// decorator
|
||||||
|
|
||||||
|
int32 size = settings.FlattenedSize();
|
||||||
|
char buffer[size];
|
||||||
|
status_t ret = settings.Flatten(buffer, size);
|
||||||
|
|
||||||
|
if (ret < B_OK)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (!Lock())
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
ret = fLink->StartMessage(AS_SET_DECORATOR_SETTINGS);
|
||||||
|
|
||||||
|
if (ret == B_OK)
|
||||||
|
ret = fLink->Attach<int32>(size);
|
||||||
|
|
||||||
|
if (ret == B_OK)
|
||||||
|
ret = fLink->Attach(buffer, size);
|
||||||
|
|
||||||
|
if (ret == B_OK)
|
||||||
|
ret = fLink->Flush();
|
||||||
|
|
||||||
|
Unlock();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BWindow::GetDecoratorSettings(BMessage* settings)
|
||||||
|
{
|
||||||
|
// read a flattened settings message from the app_server
|
||||||
|
// and put it into settings
|
||||||
|
|
||||||
|
if (!Lock())
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
status_t ret = fLink->StartMessage(AS_GET_DECORATOR_SETTINGS);
|
||||||
|
|
||||||
|
if (ret == B_OK) {
|
||||||
|
int32 code;
|
||||||
|
ret = fLink->FlushWithReply(code);
|
||||||
|
if (ret == B_OK && code != B_OK)
|
||||||
|
ret = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == B_OK) {
|
||||||
|
int32 size;
|
||||||
|
ret = fLink->Read<int32>(&size);
|
||||||
|
if (ret == B_OK) {
|
||||||
|
char buffer[size];
|
||||||
|
ret = fLink->Read(buffer, size);
|
||||||
|
if (ret == B_OK) {
|
||||||
|
ret = settings->Unflatten(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Unlock();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BWindow::SetZoomLimits(float maxWidth, float maxHeight)
|
BWindow::SetZoomLimits(float maxWidth, float maxHeight)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -399,6 +399,21 @@ Decorator::ResizeBy(float x, float y, BRegion* dirty)
|
|||||||
ResizeBy(BPoint(x, y), dirty);
|
ResizeBy(BPoint(x, y), dirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Decorator::SetSettings(const BMessage& settings, BRegion* updateRegion)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Decorator::GetSettings(BMessage* settings) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Updates the decorator's look in the area r
|
\brief Updates the decorator's look in the area r
|
||||||
\param r The area to update.
|
\param r The area to update.
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ class Decorator {
|
|||||||
virtual float TabLocation() const
|
virtual float TabLocation() const
|
||||||
{ return 0.0; }
|
{ return 0.0; }
|
||||||
|
|
||||||
|
virtual bool SetSettings(const BMessage& settings,
|
||||||
|
BRegion* updateRegion = NULL);
|
||||||
|
virtual bool GetSettings(BMessage* settings) const;
|
||||||
|
|
||||||
virtual void Draw(BRect r);
|
virtual void Draw(BRect r);
|
||||||
virtual void Draw();
|
virtual void Draw();
|
||||||
virtual void DrawClose();
|
virtual void DrawClose();
|
||||||
|
|||||||
@@ -337,6 +337,7 @@ DefaultDecorator::ResizeBy(BPoint pt, BRegion* dirty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DefaultDecorator::SetTabLocation(float location, BRegion* updateRegion)
|
DefaultDecorator::SetTabLocation(float location, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
@@ -367,7 +368,31 @@ DefaultDecorator::SetTabLocation(float location, BRegion* updateRegion)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw
|
|
||||||
|
bool
|
||||||
|
DefaultDecorator::SetSettings(const BMessage& settings, BRegion* updateRegion)
|
||||||
|
{
|
||||||
|
float tabLocation;
|
||||||
|
if (settings.FindFloat("tab location", &tabLocation) == B_OK)
|
||||||
|
return SetTabLocation(tabLocation, updateRegion);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
DefaultDecorator::GetSettings(BMessage* settings) const
|
||||||
|
{
|
||||||
|
if (!_tabrect.IsValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return settings->AddFloat("tab location", (float)fTabOffset) == B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::Draw(BRect update)
|
DefaultDecorator::Draw(BRect update)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,77 +17,92 @@ class Desktop;
|
|||||||
|
|
||||||
|
|
||||||
class DefaultDecorator: public Decorator {
|
class DefaultDecorator: public Decorator {
|
||||||
public:
|
public:
|
||||||
DefaultDecorator(DesktopSettings& settings, BRect frame,
|
DefaultDecorator(DesktopSettings& settings,
|
||||||
window_look look, uint32 flags);
|
BRect frame,
|
||||||
virtual ~DefaultDecorator();
|
window_look look,
|
||||||
|
uint32 flags);
|
||||||
|
virtual ~DefaultDecorator();
|
||||||
|
|
||||||
virtual void SetTitle(const char* string, BRegion* updateRegion = NULL);
|
virtual void SetTitle(const char* string,
|
||||||
virtual void SetLook(DesktopSettings& settings,
|
BRegion* updateRegion = NULL);
|
||||||
window_look look, BRegion* updateRegion = NULL);
|
virtual void SetLook(DesktopSettings& settings,
|
||||||
virtual void SetFlags(uint32 flags, BRegion* updateRegion = NULL);
|
window_look look,
|
||||||
|
BRegion* updateRegion = NULL);
|
||||||
|
virtual void SetFlags(uint32 flags,
|
||||||
|
BRegion* updateRegion = NULL);
|
||||||
|
|
||||||
virtual void MoveBy(BPoint pt);
|
virtual void MoveBy(BPoint offset);
|
||||||
virtual void ResizeBy(BPoint pt, BRegion* dirty);
|
virtual void ResizeBy(BPoint offset, BRegion* dirty);
|
||||||
virtual bool SetTabLocation(float location, BRegion* updateRegion = NULL);
|
|
||||||
virtual float TabLocation() const { return (float)fTabOffset;; }
|
|
||||||
|
|
||||||
virtual void Draw(BRect r);
|
virtual bool SetTabLocation(float location,
|
||||||
virtual void Draw();
|
BRegion* updateRegion = NULL);
|
||||||
|
virtual float TabLocation() const
|
||||||
|
{ return (float)fTabOffset; }
|
||||||
|
|
||||||
virtual void GetSizeLimits(int32* minWidth, int32* minHeight,
|
virtual bool SetSettings(const BMessage& settings,
|
||||||
int32* maxWidth, int32* maxHeight) const;
|
BRegion* updateRegion = NULL);
|
||||||
|
virtual bool GetSettings(BMessage* settings) const;
|
||||||
|
|
||||||
virtual void GetFootprint(BRegion *region);
|
virtual void Draw(BRect updateRect);
|
||||||
|
virtual void Draw();
|
||||||
|
|
||||||
virtual click_type Clicked(BPoint pt, int32 buttons,
|
virtual void GetSizeLimits(int32* minWidth,
|
||||||
int32 modifiers);
|
int32* minHeight,
|
||||||
|
int32* maxWidth,
|
||||||
|
int32* maxHeight) const;
|
||||||
|
|
||||||
protected:
|
virtual void GetFootprint(BRegion* region);
|
||||||
virtual void _DoLayout();
|
|
||||||
|
|
||||||
virtual void _DrawFrame(BRect r);
|
virtual click_type Clicked(BPoint pt, int32 buttons,
|
||||||
virtual void _DrawTab(BRect r);
|
int32 modifiers);
|
||||||
|
|
||||||
virtual void _DrawClose(BRect r);
|
protected:
|
||||||
virtual void _DrawTitle(BRect r);
|
virtual void _DoLayout();
|
||||||
virtual void _DrawZoom(BRect r);
|
|
||||||
|
|
||||||
virtual void _SetFocus();
|
virtual void _DrawFrame(BRect r);
|
||||||
virtual void _SetColors();
|
virtual void _DrawTab(BRect r);
|
||||||
|
|
||||||
private:
|
virtual void _DrawClose(BRect r);
|
||||||
void _DrawBlendedRect(BRect r, bool down);
|
virtual void _DrawTitle(BRect r);
|
||||||
void _GetButtonSizeAndOffset(const BRect& tabRect,
|
virtual void _DrawZoom(BRect r);
|
||||||
float* offset, float*size) const;
|
|
||||||
void _LayoutTabItems(const BRect& tabRect);
|
|
||||||
|
|
||||||
RGBColor fButtonHighColor;
|
virtual void _SetFocus();
|
||||||
RGBColor fButtonLowColor;
|
virtual void _SetColors();
|
||||||
RGBColor fTextColor;
|
|
||||||
RGBColor fTabColor;
|
|
||||||
|
|
||||||
RGBColor* fFrameColors;
|
private:
|
||||||
|
void _DrawBlendedRect(BRect r, bool down);
|
||||||
|
void _GetButtonSizeAndOffset(const BRect& tabRect,
|
||||||
|
float* offset,
|
||||||
|
float*size) const;
|
||||||
|
void _LayoutTabItems(const BRect& tabRect);
|
||||||
|
|
||||||
// Individual rects for handling window frame
|
RGBColor fButtonHighColor;
|
||||||
// rendering the proper way
|
RGBColor fButtonLowColor;
|
||||||
BRect fRightBorder;
|
RGBColor fTextColor;
|
||||||
BRect fLeftBorder;
|
RGBColor fTabColor;
|
||||||
BRect fTopBorder;
|
|
||||||
BRect fBottomBorder;
|
RGBColor* fFrameColors;
|
||||||
|
|
||||||
int32 fBorderWidth;
|
// Individual rects for handling window frame
|
||||||
|
// rendering the proper way
|
||||||
uint32 fTabOffset;
|
BRect fRightBorder;
|
||||||
float fTextOffset;
|
BRect fLeftBorder;
|
||||||
|
BRect fTopBorder;
|
||||||
float fMinTabSize;
|
BRect fBottomBorder;
|
||||||
float fMaxTabSize;
|
|
||||||
BString fTruncatedTitle;
|
int32 fBorderWidth;
|
||||||
int32 fTruncatedTitleLength;
|
|
||||||
|
uint32 fTabOffset;
|
||||||
bigtime_t fLastClicked;
|
float fTextOffset;
|
||||||
bool fWasDoubleClick;
|
|
||||||
|
float fMinTabSize;
|
||||||
|
float fMaxTabSize;
|
||||||
|
BString fTruncatedTitle;
|
||||||
|
int32 fTruncatedTitleLength;
|
||||||
|
|
||||||
|
bigtime_t fLastClicked;
|
||||||
|
bool fWasDoubleClick;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* DEFAULT_DECORATOR_H */
|
#endif // DEFAULT_DECORATOR_H
|
||||||
|
|||||||
@@ -1575,6 +1575,7 @@ Desktop::ResizeWindowBy(WindowLayer* window, float x, float y)
|
|||||||
UnlockAllWindows();
|
UnlockAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Desktop::SetWindowTabLocation(WindowLayer* window, float location)
|
Desktop::SetWindowTabLocation(WindowLayer* window, float location)
|
||||||
{
|
{
|
||||||
@@ -1598,6 +1599,32 @@ Desktop::SetWindowTabLocation(WindowLayer* window, float location)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Desktop::SetWindowDecoratorSettings(WindowLayer* window,
|
||||||
|
const BMessage& settings)
|
||||||
|
{
|
||||||
|
// TODO: almost exact code duplication to above function...
|
||||||
|
|
||||||
|
if (!LockAllWindows())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
BRegion dirty;
|
||||||
|
bool changed = window->SetDecoratorSettings(settings, dirty);
|
||||||
|
|
||||||
|
if (changed && window->IsVisible() && dirty.CountRects() > 0) {
|
||||||
|
BRegion stillAvailableOnScreen;
|
||||||
|
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
||||||
|
_SetBackground(stillAvailableOnScreen);
|
||||||
|
|
||||||
|
_TriggerWindowRedrawing(dirty);
|
||||||
|
}
|
||||||
|
|
||||||
|
UnlockAllWindows();
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Updates the workspaces of all subset windows with regard to the
|
Updates the workspaces of all subset windows with regard to the
|
||||||
specifed window.
|
specifed window.
|
||||||
|
|||||||
@@ -112,6 +112,8 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
int32 workspace = -1);
|
int32 workspace = -1);
|
||||||
void ResizeWindowBy(WindowLayer* window, float x, float y);
|
void ResizeWindowBy(WindowLayer* window, float x, float y);
|
||||||
bool SetWindowTabLocation(WindowLayer* window, float location);
|
bool SetWindowTabLocation(WindowLayer* window, float location);
|
||||||
|
bool SetWindowDecoratorSettings(WindowLayer* window,
|
||||||
|
const BMessage& settings);
|
||||||
|
|
||||||
void SetWindowWorkspaces(WindowLayer* window,
|
void SetWindowWorkspaces(WindowLayer* window,
|
||||||
uint32 workspaces);
|
uint32 workspaces);
|
||||||
|
|||||||
@@ -909,6 +909,50 @@ fDesktop->LockSingleWindow();
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AS_SET_DECORATOR_SETTINGS:
|
||||||
|
{
|
||||||
|
STRACE(("ServerWindow %s: Message AS_SET_DECORATOR_SETTINGS\n"));
|
||||||
|
|
||||||
|
int32 size;
|
||||||
|
if (fWindowLayer && link.Read<int32>(&size) == B_OK) {
|
||||||
|
char buffer[size];
|
||||||
|
if (link.Read(buffer, size) == B_OK) {
|
||||||
|
BMessage settings;
|
||||||
|
if (settings.Unflatten(buffer) == B_OK) {
|
||||||
|
fDesktop->UnlockSingleWindow();
|
||||||
|
fDesktop->SetWindowDecoratorSettings(fWindowLayer, settings);
|
||||||
|
fDesktop->LockSingleWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case AS_GET_DECORATOR_SETTINGS:
|
||||||
|
{
|
||||||
|
STRACE(("ServerWindow %s: Message AS_GET_DECORATOR_SETTINGS\n"));
|
||||||
|
|
||||||
|
bool success = false;
|
||||||
|
|
||||||
|
BMessage settings;
|
||||||
|
if (fWindowLayer->GetDecoratorSettings(&settings)) {
|
||||||
|
int32 size = settings.FlattenedSize();
|
||||||
|
char buffer[size];
|
||||||
|
if (settings.Flatten(buffer, size) == B_OK) {
|
||||||
|
success = true;
|
||||||
|
fLink.StartMessage(B_OK);
|
||||||
|
fLink.Attach<int32>(size);
|
||||||
|
fLink.Attach(buffer, size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!success)
|
||||||
|
fLink.StartMessage(B_ERROR);
|
||||||
|
|
||||||
|
fLink.Flush();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case AS_REDRAW:
|
case AS_REDRAW:
|
||||||
// Nothing to do here - the redraws are actually handled by looking
|
// Nothing to do here - the redraws are actually handled by looking
|
||||||
// at the fRedrawRequested member variable in _MessageLooper().
|
// at the fRedrawRequested member variable in _MessageLooper().
|
||||||
@@ -936,12 +980,12 @@ fDesktop->LockSingleWindow();
|
|||||||
BPoint where;
|
BPoint where;
|
||||||
int32 buttons;
|
int32 buttons;
|
||||||
fDesktop->EventDispatcher().GetMouse(where, buttons);
|
fDesktop->EventDispatcher().GetMouse(where, buttons);
|
||||||
|
fDesktop->LockSingleWindow();
|
||||||
|
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
fLink.Attach<BPoint>(where);
|
fLink.Attach<BPoint>(where);
|
||||||
fLink.Attach<int32>(buttons);
|
fLink.Attach<int32>(buttons);
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
fDesktop->LockSingleWindow();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1220,8 +1220,8 @@ WindowLayer::SetTabLocation(float location, BRegion& dirty)
|
|||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (fDecorator) {
|
if (fDecorator) {
|
||||||
ret = fDecorator->SetTabLocation(location, &dirty);
|
ret = fDecorator->SetTabLocation(location, &dirty);
|
||||||
|
// the border region changed if ret is true
|
||||||
fBorderRegionValid = fBorderRegionValid && !ret;
|
fBorderRegionValid = fBorderRegionValid && !ret;
|
||||||
// the border very likely changed
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -1236,6 +1236,29 @@ WindowLayer::TabLocation() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
WindowLayer::SetDecoratorSettings(const BMessage& settings, BRegion& dirty)
|
||||||
|
{
|
||||||
|
bool ret = false;
|
||||||
|
if (fDecorator) {
|
||||||
|
ret = fDecorator->SetSettings(settings, &dirty);
|
||||||
|
// the border region changed if ret is true
|
||||||
|
fBorderRegionValid = fBorderRegionValid && !ret;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
WindowLayer::GetDecoratorSettings(BMessage* settings)
|
||||||
|
{
|
||||||
|
if (fDecorator)
|
||||||
|
return fDecorator->GetSettings(settings);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetLook(window_look look, BRegion* updateRegion)
|
WindowLayer::SetLook(window_look look, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -172,6 +172,10 @@ class WindowLayer {
|
|||||||
bool SetTabLocation(float location, BRegion& dirty);
|
bool SetTabLocation(float location, BRegion& dirty);
|
||||||
float TabLocation() const;
|
float TabLocation() const;
|
||||||
|
|
||||||
|
bool SetDecoratorSettings(const BMessage& settings,
|
||||||
|
BRegion& dirty);
|
||||||
|
bool GetDecoratorSettings(BMessage* settings);
|
||||||
|
|
||||||
void HighlightDecorator(bool active);
|
void HighlightDecorator(bool active);
|
||||||
|
|
||||||
void SetLook(window_look look, BRegion* updateRegion);
|
void SetLook(window_look look, BRegion* updateRegion);
|
||||||
|
|||||||
Reference in New Issue
Block a user