* Renamed all DEC_* constants to CLICK_*.
* Renamed DEC_MOVETOBACK to CLICK_MOVE_TO_BACK, and DEC_SLIDETAB to CLICK_SLIDE_TAB. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35259 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2008, Haiku.
|
* Copyright 2001-2010, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -335,7 +335,7 @@ Decorator::GetFootprint(BRegion *region)
|
|||||||
click_type
|
click_type
|
||||||
Decorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
Decorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
||||||
{
|
{
|
||||||
return DEC_NONE;
|
return CLICK_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2008, Haiku.
|
* Copyright 2001-2010, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -24,16 +24,16 @@ class BRegion;
|
|||||||
|
|
||||||
|
|
||||||
enum click_type {
|
enum click_type {
|
||||||
DEC_NONE = 0,
|
CLICK_NONE = 0,
|
||||||
DEC_ZOOM,
|
CLICK_ZOOM,
|
||||||
DEC_CLOSE,
|
CLICK_CLOSE,
|
||||||
DEC_MINIMIZE,
|
CLICK_MINIMIZE,
|
||||||
DEC_TAB,
|
CLICK_TAB,
|
||||||
DEC_DRAG,
|
CLICK_DRAG,
|
||||||
DEC_MOVETOBACK,
|
CLICK_MOVE_TO_BACK,
|
||||||
DEC_SLIDETAB,
|
CLICK_SLIDE_TAB,
|
||||||
|
|
||||||
DEC_RESIZE,
|
CLICK_RESIZE,
|
||||||
CLICK_RESIZE_L,
|
CLICK_RESIZE_L,
|
||||||
CLICK_RESIZE_T,
|
CLICK_RESIZE_T,
|
||||||
CLICK_RESIZE_R,
|
CLICK_RESIZE_R,
|
||||||
|
|||||||
@@ -537,16 +537,16 @@ DefaultDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
|||||||
// the user might be clicking on and gradually work our way out into larger
|
// the user might be clicking on and gradually work our way out into larger
|
||||||
// rectangles.
|
// rectangles.
|
||||||
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(point))
|
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(point))
|
||||||
return DEC_CLOSE;
|
return CLICK_CLOSE;
|
||||||
|
|
||||||
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(point))
|
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(point))
|
||||||
return DEC_ZOOM;
|
return CLICK_ZOOM;
|
||||||
|
|
||||||
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
||||||
return DEC_MOVETOBACK;
|
return CLICK_MOVE_TO_BACK;
|
||||||
|
|
||||||
if (fLook == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(point))
|
if (fLook == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(point))
|
||||||
return DEC_RESIZE;
|
return CLICK_RESIZE;
|
||||||
|
|
||||||
if (fTabRect.Contains(point)) {
|
if (fTabRect.Contains(point)) {
|
||||||
// Clicked in the tab
|
// Clicked in the tab
|
||||||
@@ -554,7 +554,7 @@ DefaultDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
|||||||
// tab sliding in any case if either shift key is held down
|
// tab sliding in any case if either shift key is held down
|
||||||
// except sliding up-down by moving mouse left-right would look strange
|
// except sliding up-down by moving mouse left-right would look strange
|
||||||
if ((modifiers & B_SHIFT_KEY) && (fLook != kLeftTitledWindowLook))
|
if ((modifiers & B_SHIFT_KEY) && (fLook != kLeftTitledWindowLook))
|
||||||
return DEC_SLIDETAB;
|
return CLICK_SLIDE_TAB;
|
||||||
} else if (fLeftBorder.Contains(point) || fRightBorder.Contains(point)
|
} else if (fLeftBorder.Contains(point) || fRightBorder.Contains(point)
|
||||||
|| fTopBorder.Contains(point) || fBottomBorder.Contains(point)) {
|
|| fTopBorder.Contains(point) || fBottomBorder.Contains(point)) {
|
||||||
// Clicked on border
|
// Clicked on border
|
||||||
@@ -568,17 +568,17 @@ DefaultDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
|||||||
BRect temp(BPoint(fBottomBorder.right - 22,
|
BRect temp(BPoint(fBottomBorder.right - 22,
|
||||||
fBottomBorder.bottom - 22), fBottomBorder.RightBottom());
|
fBottomBorder.bottom - 22), fBottomBorder.RightBottom());
|
||||||
if (temp.Contains(point))
|
if (temp.Contains(point))
|
||||||
return DEC_RESIZE;
|
return CLICK_RESIZE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Guess user didn't click anything
|
// Guess user didn't click anything
|
||||||
return DEC_NONE;
|
return CLICK_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fWasDoubleClick && !(fFlags & B_NOT_MINIMIZABLE))
|
if (fWasDoubleClick && !(fFlags & B_NOT_MINIMIZABLE))
|
||||||
return DEC_MINIMIZE;
|
return CLICK_MINIMIZE;
|
||||||
|
|
||||||
return DEC_DRAG;
|
return CLICK_DRAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1015,7 +1015,7 @@ DefaultDecorator::_DrawClose(BRect rect)
|
|||||||
int32 index = (fButtonFocus ? 0 : 1) + (GetClose() ? 0 : 2);
|
int32 index = (fButtonFocus ? 0 : 1) + (GetClose() ? 0 : 2);
|
||||||
ServerBitmap* bitmap = fCloseBitmaps[index];
|
ServerBitmap* bitmap = fCloseBitmaps[index];
|
||||||
if (bitmap == NULL) {
|
if (bitmap == NULL) {
|
||||||
bitmap = _GetBitmapForButton(DEC_CLOSE, GetClose(), fButtonFocus,
|
bitmap = _GetBitmapForButton(CLICK_CLOSE, GetClose(), fButtonFocus,
|
||||||
rect.IntegerWidth(), rect.IntegerHeight(), this);
|
rect.IntegerWidth(), rect.IntegerHeight(), this);
|
||||||
fCloseBitmaps[index] = bitmap;
|
fCloseBitmaps[index] = bitmap;
|
||||||
}
|
}
|
||||||
@@ -1068,7 +1068,7 @@ DefaultDecorator::_DrawZoom(BRect rect)
|
|||||||
int32 index = (fButtonFocus ? 0 : 1) + (GetZoom() ? 0 : 2);
|
int32 index = (fButtonFocus ? 0 : 1) + (GetZoom() ? 0 : 2);
|
||||||
ServerBitmap* bitmap = fZoomBitmaps[index];
|
ServerBitmap* bitmap = fZoomBitmaps[index];
|
||||||
if (bitmap == NULL) {
|
if (bitmap == NULL) {
|
||||||
bitmap = _GetBitmapForButton(DEC_ZOOM, GetZoom(), fButtonFocus,
|
bitmap = _GetBitmapForButton(CLICK_ZOOM, GetZoom(), fButtonFocus,
|
||||||
rect.IntegerWidth(), rect.IntegerHeight(), this);
|
rect.IntegerWidth(), rect.IntegerHeight(), this);
|
||||||
fZoomBitmaps[index] = bitmap;
|
fZoomBitmaps[index] = bitmap;
|
||||||
}
|
}
|
||||||
@@ -1310,14 +1310,14 @@ DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
|
|||||||
BRect rect(0, 0, width - 1, height - 1);
|
BRect rect(0, 0, width - 1, height - 1);
|
||||||
|
|
||||||
STRACE(("DefaultDecorator creating bitmap for %s %sfocus %s at size %ldx%ld\n",
|
STRACE(("DefaultDecorator creating bitmap for %s %sfocus %s at size %ldx%ld\n",
|
||||||
item == DEC_CLOSE ? "close" : "zoom", focus ? "" : "non-",
|
item == CLICK_CLOSE ? "close" : "zoom", focus ? "" : "non-",
|
||||||
down ? "down" : "up", width, height));
|
down ? "down" : "up", width, height));
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case DEC_CLOSE:
|
case CLICK_CLOSE:
|
||||||
object->_DrawBlendedRect(sBitmapDrawingEngine, rect, down, focus);
|
object->_DrawBlendedRect(sBitmapDrawingEngine, rect, down, focus);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEC_ZOOM:
|
case CLICK_ZOOM:
|
||||||
{
|
{
|
||||||
// init the background
|
// init the background
|
||||||
sBitmapDrawingEngine->FillRect(rect, B_TRANSPARENT_COLOR);
|
sBitmapDrawingEngine->FillRect(rect, B_TRANSPARENT_COLOR);
|
||||||
|
|||||||
+29
-29
@@ -791,61 +791,61 @@ Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
|
|||||||
if (windowModifier || inBorderRegion) {
|
if (windowModifier || inBorderRegion) {
|
||||||
// clicking Window visible area
|
// clicking Window visible area
|
||||||
|
|
||||||
click_type action = DEC_NONE;
|
click_type action = CLICK_NONE;
|
||||||
int32 buttons = _ExtractButtons(message);
|
int32 buttons = _ExtractButtons(message);
|
||||||
|
|
||||||
if (inBorderRegion && fDecorator != NULL)
|
if (inBorderRegion && fDecorator != NULL)
|
||||||
action = _ActionFor(message, buttons, modifiers);
|
action = _ActionFor(message, buttons, modifiers);
|
||||||
else {
|
else {
|
||||||
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
||||||
action = DEC_MOVETOBACK;
|
action = CLICK_MOVE_TO_BACK;
|
||||||
else if ((fFlags & B_NOT_MOVABLE) == 0 && fDecorator != NULL)
|
else if ((fFlags & B_NOT_MOVABLE) == 0 && fDecorator != NULL)
|
||||||
action = DEC_DRAG;
|
action = CLICK_DRAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!desktopSettings.AcceptFirstClick()) {
|
if (!desktopSettings.AcceptFirstClick()) {
|
||||||
// ignore clicks on decorator buttons if the
|
// ignore clicks on decorator buttons if the
|
||||||
// non-floating window doesn't have focus
|
// non-floating window doesn't have focus
|
||||||
if (!IsFocus() && !IsFloating() && action != DEC_MOVETOBACK
|
if (!IsFocus() && !IsFloating() && action != CLICK_MOVE_TO_BACK
|
||||||
&& action != DEC_RESIZE && action != DEC_SLIDETAB)
|
&& action != CLICK_RESIZE && action != CLICK_SLIDE_TAB)
|
||||||
action = DEC_DRAG;
|
action = CLICK_DRAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set decorator internals
|
// set decorator internals
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case DEC_CLOSE:
|
case CLICK_CLOSE:
|
||||||
fIsClosing = true;
|
fIsClosing = true;
|
||||||
STRACE_CLICK(("===> DEC_CLOSE\n"));
|
STRACE_CLICK(("===> CLICK_CLOSE\n"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEC_ZOOM:
|
case CLICK_ZOOM:
|
||||||
fIsZooming = true;
|
fIsZooming = true;
|
||||||
STRACE_CLICK(("===> DEC_ZOOM\n"));
|
STRACE_CLICK(("===> CLICK_ZOOM\n"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEC_MINIMIZE:
|
case CLICK_MINIMIZE:
|
||||||
if ((Flags() & B_NOT_MINIMIZABLE) == 0) {
|
if ((Flags() & B_NOT_MINIMIZABLE) == 0) {
|
||||||
fIsMinimizing = true;
|
fIsMinimizing = true;
|
||||||
STRACE_CLICK(("===> DEC_MINIMIZE\n"));
|
STRACE_CLICK(("===> CLICK_MINIMIZE\n"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEC_DRAG:
|
case CLICK_DRAG:
|
||||||
fIsDragging = true;
|
fIsDragging = true;
|
||||||
fLastMousePosition = where;
|
fLastMousePosition = where;
|
||||||
STRACE_CLICK(("===> DEC_DRAG\n"));
|
STRACE_CLICK(("===> CLICK_DRAG\n"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEC_RESIZE:
|
case CLICK_RESIZE:
|
||||||
fIsResizing = true;
|
fIsResizing = true;
|
||||||
fLastMousePosition = where;
|
fLastMousePosition = where;
|
||||||
STRACE_CLICK(("===> DEC_RESIZE\n"));
|
STRACE_CLICK(("===> CLICK_RESIZE\n"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEC_SLIDETAB:
|
case CLICK_SLIDE_TAB:
|
||||||
fIsSlidingTab = true;
|
fIsSlidingTab = true;
|
||||||
fLastMousePosition = where;
|
fLastMousePosition = where;
|
||||||
STRACE_CLICK(("===> DEC_SLIDETAB\n"));
|
STRACE_CLICK(("===> CLICK_SLIDE_TAB\n"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -875,7 +875,7 @@ Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
|
|||||||
fRegionPool.Recycle(visibleBorder);
|
fRegionPool.Recycle(visibleBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == DEC_MOVETOBACK) {
|
if (action == CLICK_MOVE_TO_BACK) {
|
||||||
if (desktopSettings.MouseMode() == B_CLICK_TO_FOCUS_MOUSE) {
|
if (desktopSettings.MouseMode() == B_CLICK_TO_FOCUS_MOUSE) {
|
||||||
bool covered = true;
|
bool covered = true;
|
||||||
BRegion fullRegion;
|
BRegion fullRegion;
|
||||||
@@ -899,7 +899,7 @@ Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
|
|||||||
else {
|
else {
|
||||||
fDesktop->SetFocusWindow(this);
|
fDesktop->SetFocusWindow(this);
|
||||||
if (desktopSettings.MouseMode() == B_FOCUS_FOLLOWS_MOUSE
|
if (desktopSettings.MouseMode() == B_FOCUS_FOLLOWS_MOUSE
|
||||||
&& (action == DEC_DRAG || action == DEC_RESIZE)) {
|
&& (action == CLICK_DRAG || action == CLICK_RESIZE)) {
|
||||||
fActivateOnMouseUp = true;
|
fActivateOnMouseUp = true;
|
||||||
fMouseMoveDistance = 0.0f;
|
fMouseMoveDistance = 0.0f;
|
||||||
fLastMoveTime = system_time();
|
fLastMoveTime = system_time();
|
||||||
@@ -963,7 +963,7 @@ Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
|
|||||||
if (fIsZooming) {
|
if (fIsZooming) {
|
||||||
fIsZooming = false;
|
fIsZooming = false;
|
||||||
fDecorator->SetZoom(false);
|
fDecorator->SetZoom(false);
|
||||||
if (action == DEC_ZOOM) {
|
if (action == CLICK_ZOOM) {
|
||||||
invalidate = true;
|
invalidate = true;
|
||||||
fWindow->NotifyZoom();
|
fWindow->NotifyZoom();
|
||||||
}
|
}
|
||||||
@@ -971,7 +971,7 @@ Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
|
|||||||
if (fIsClosing) {
|
if (fIsClosing) {
|
||||||
fIsClosing = false;
|
fIsClosing = false;
|
||||||
fDecorator->SetClose(false);
|
fDecorator->SetClose(false);
|
||||||
if (action == DEC_CLOSE) {
|
if (action == CLICK_CLOSE) {
|
||||||
invalidate = true;
|
invalidate = true;
|
||||||
fWindow->NotifyQuitRequested();
|
fWindow->NotifyQuitRequested();
|
||||||
}
|
}
|
||||||
@@ -979,7 +979,7 @@ Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
|
|||||||
if (fIsMinimizing) {
|
if (fIsMinimizing) {
|
||||||
fIsMinimizing = false;
|
fIsMinimizing = false;
|
||||||
fDecorator->SetMinimize(false);
|
fDecorator->SetMinimize(false);
|
||||||
if (action == DEC_MINIMIZE) {
|
if (action == CLICK_MINIMIZE) {
|
||||||
invalidate = true;
|
invalidate = true;
|
||||||
fWindow->NotifyMinimize(true);
|
fWindow->NotifyMinimize(true);
|
||||||
}
|
}
|
||||||
@@ -1075,11 +1075,11 @@ Window::MouseMoved(BMessage *message, BPoint where, int32* _viewToken,
|
|||||||
engine->ConstrainClippingRegion(visibleBorder);
|
engine->ConstrainClippingRegion(visibleBorder);
|
||||||
|
|
||||||
if (fIsZooming) {
|
if (fIsZooming) {
|
||||||
fDecorator->SetZoom(_ActionFor(message) == DEC_ZOOM);
|
fDecorator->SetZoom(_ActionFor(message) == CLICK_ZOOM);
|
||||||
} else if (fIsClosing) {
|
} else if (fIsClosing) {
|
||||||
fDecorator->SetClose(_ActionFor(message) == DEC_CLOSE);
|
fDecorator->SetClose(_ActionFor(message) == CLICK_CLOSE);
|
||||||
} else if (fIsMinimizing) {
|
} else if (fIsMinimizing) {
|
||||||
fDecorator->SetMinimize(_ActionFor(message) == DEC_MINIMIZE);
|
fDecorator->SetMinimize(_ActionFor(message) == CLICK_MINIMIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
engine->UnlockParallelAccess();
|
engine->UnlockParallelAccess();
|
||||||
@@ -2240,7 +2240,7 @@ click_type
|
|||||||
Window::_ActionFor(const BMessage* message) const
|
Window::_ActionFor(const BMessage* message) const
|
||||||
{
|
{
|
||||||
if (fDecorator == NULL)
|
if (fDecorator == NULL)
|
||||||
return DEC_NONE;
|
return CLICK_NONE;
|
||||||
|
|
||||||
int32 buttons = _ExtractButtons(message);
|
int32 buttons = _ExtractButtons(message);
|
||||||
int32 modifiers = _ExtractModifiers(message);
|
int32 modifiers = _ExtractModifiers(message);
|
||||||
@@ -2253,11 +2253,11 @@ Window::_ActionFor(const BMessage* message, int32 buttons,
|
|||||||
int32 modifiers) const
|
int32 modifiers) const
|
||||||
{
|
{
|
||||||
if (fDecorator == NULL)
|
if (fDecorator == NULL)
|
||||||
return DEC_NONE;
|
return CLICK_NONE;
|
||||||
|
|
||||||
BPoint where;
|
BPoint where;
|
||||||
if (message->FindPoint("where", &where) != B_OK)
|
if (message->FindPoint("where", &where) != B_OK)
|
||||||
return DEC_NONE;
|
return CLICK_NONE;
|
||||||
|
|
||||||
return fDecorator->Clicked(where, buttons, modifiers);
|
return fDecorator->Clicked(where, buttons, modifiers);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user