* B_NOT_H_RESIZABLE/B_NOT_V_RESIZABLE are now correctly supported by the decorators.

* Introduced methods WindowLayer::IsModal() and IsFloating().
* Invalid flags for the current feel are now filtered out, like B_AVOID_FOCUS for
  modal windows.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15280 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-12-02 10:35:01 +00:00
parent a825e4034c
commit fc21e33e46
3 changed files with 70 additions and 3 deletions

View File

@ -104,6 +104,14 @@ Decorator::SetDriver(DrawingEngine *driver)
void
Decorator::SetFlags(uint32 flags, BRegion* updateRegion)
{
// we're nice to our subclasses - we make sure B_NOT_{H|V|}_RESIZABLE are in sync
// (it's only a semantical simplification, not a necessity)
if ((flags & (B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE))
== (B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE))
flags |= B_NOT_RESIZABLE;
if (flags & B_NOT_RESIZABLE)
flags |= B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE;
fFlags = flags;
}

View File

@ -548,6 +548,11 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
}
if (fIsResizing) {
BPoint delta = where - fLastMousePosition;
if (WindowFlags() & B_NOT_V_RESIZABLE)
delta.y = 0;
if (WindowFlags() & B_NOT_H_RESIZABLE)
delta.x = 0;
Window()->Desktop()->ResizeWindowBy(this, delta.x, delta.y);
}
if (fIsSlidingTab) {
@ -706,6 +711,10 @@ WindowLayer::SetFeel(window_feel feel)
{
fFeel = feel;
// having modal windows with B_AVOID_FRONT or B_AVOID_FOCUS doesn't
// make that much sense, so we filter those flags out on demand
fWindowFlags &= ~ValidWindowFlags(fFeel);
// TODO: this shouldn't be necessary, but we'll see :)
// floating and modal windows must appear in every workspace where
@ -732,7 +741,7 @@ WindowLayer::SetFeel(window_feel feel)
void
WindowLayer::SetWindowFlags(uint32 flags, BRegion* updateRegion)
{
fWindowFlags = flags;
fWindowFlags = flags & ~ValidWindowFlags(fFeel);
if (fDecorator == NULL)
return;
@ -745,6 +754,20 @@ WindowLayer::SetWindowFlags(uint32 flags, BRegion* updateRegion)
}
bool
WindowLayer::IsModal() const
{
return IsModalFeel(fFeel);
}
bool
WindowLayer::IsFloating() const
{
return IsFloatingFeel(fFeel);
}
click_type
WindowLayer::_ActionFor(const BMessage *msg) const
{
@ -893,6 +916,26 @@ WindowLayer::IsValidFeel(window_feel feel)
}
/*static*/
bool
WindowLayer::IsModalFeel(window_feel feel)
{
return feel == B_MODAL_SUBSET_WINDOW_FEEL
|| feel == B_MODAL_APP_WINDOW_FEEL
|| feel == B_MODAL_ALL_WINDOW_FEEL;
}
/*static*/
bool
WindowLayer::IsFloatingFeel(window_feel feel)
{
return feel == B_FLOATING_SUBSET_WINDOW_FEEL
|| feel == B_FLOATING_APP_WINDOW_FEEL
|| feel == B_FLOATING_ALL_WINDOW_FEEL;
}
/*static*/
uint32
WindowLayer::ValidWindowFlags()
@ -910,3 +953,15 @@ WindowLayer::ValidWindowFlags()
| kWindowScreenFlag;
}
/*static*/
uint32
WindowLayer::ValidWindowFlags(window_feel feel)
{
uint32 flags = ValidWindowFlags();
if (IsModalFeel(feel))
return flags & ~(B_AVOID_FOCUS | B_AVOID_FRONT);
return flags;
}

View File

@ -12,7 +12,6 @@
#include "Decorator.h"
#include "Layer.h"
#include "SubWindowList.h"
#include <Rect.h>
#include <String.h>
@ -111,7 +110,8 @@ class WindowLayer : public Layer {
void HighlightDecorator(bool active);
SubWindowList fSubWindowList;
bool IsModal() const;
bool IsFloating() const;
void RequestClientRedraw(const BRegion& invalid);
@ -121,7 +121,11 @@ class WindowLayer : public Layer {
static bool IsValidLook(window_look look);
static bool IsValidFeel(window_feel feel);
static bool IsModalFeel(window_feel feel);
static bool IsFloatingFeel(window_feel feel);
static uint32 ValidWindowFlags();
static uint32 ValidWindowFlags(window_feel feel);
protected:
virtual void _AllRedraw(const BRegion& invalid);