* 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:
parent
ba1d39e48f
commit
90b5a0b261
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2008, Haiku.
|
||||
* Copyright 2001-2010, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -335,7 +335,7 @@ Decorator::GetFootprint(BRegion *region)
|
||||
click_type
|
||||
Decorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
||||
{
|
||||
return DEC_NONE;
|
||||
return CLICK_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2008, Haiku.
|
||||
* Copyright 2001-2010, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -24,16 +24,16 @@ class BRegion;
|
||||
|
||||
|
||||
enum click_type {
|
||||
DEC_NONE = 0,
|
||||
DEC_ZOOM,
|
||||
DEC_CLOSE,
|
||||
DEC_MINIMIZE,
|
||||
DEC_TAB,
|
||||
DEC_DRAG,
|
||||
DEC_MOVETOBACK,
|
||||
DEC_SLIDETAB,
|
||||
CLICK_NONE = 0,
|
||||
CLICK_ZOOM,
|
||||
CLICK_CLOSE,
|
||||
CLICK_MINIMIZE,
|
||||
CLICK_TAB,
|
||||
CLICK_DRAG,
|
||||
CLICK_MOVE_TO_BACK,
|
||||
CLICK_SLIDE_TAB,
|
||||
|
||||
DEC_RESIZE,
|
||||
CLICK_RESIZE,
|
||||
CLICK_RESIZE_L,
|
||||
CLICK_RESIZE_T,
|
||||
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
|
||||
// rectangles.
|
||||
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(point))
|
||||
return DEC_CLOSE;
|
||||
return CLICK_CLOSE;
|
||||
|
||||
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(point))
|
||||
return DEC_ZOOM;
|
||||
return CLICK_ZOOM;
|
||||
|
||||
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
||||
return DEC_MOVETOBACK;
|
||||
return CLICK_MOVE_TO_BACK;
|
||||
|
||||
if (fLook == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(point))
|
||||
return DEC_RESIZE;
|
||||
return CLICK_RESIZE;
|
||||
|
||||
if (fTabRect.Contains(point)) {
|
||||
// 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
|
||||
// except sliding up-down by moving mouse left-right would look strange
|
||||
if ((modifiers & B_SHIFT_KEY) && (fLook != kLeftTitledWindowLook))
|
||||
return DEC_SLIDETAB;
|
||||
return CLICK_SLIDE_TAB;
|
||||
} else if (fLeftBorder.Contains(point) || fRightBorder.Contains(point)
|
||||
|| fTopBorder.Contains(point) || fBottomBorder.Contains(point)) {
|
||||
// Clicked on border
|
||||
@ -568,17 +568,17 @@ DefaultDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
||||
BRect temp(BPoint(fBottomBorder.right - 22,
|
||||
fBottomBorder.bottom - 22), fBottomBorder.RightBottom());
|
||||
if (temp.Contains(point))
|
||||
return DEC_RESIZE;
|
||||
return CLICK_RESIZE;
|
||||
}
|
||||
} else {
|
||||
// Guess user didn't click anything
|
||||
return DEC_NONE;
|
||||
return CLICK_NONE;
|
||||
}
|
||||
|
||||
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);
|
||||
ServerBitmap* bitmap = fCloseBitmaps[index];
|
||||
if (bitmap == NULL) {
|
||||
bitmap = _GetBitmapForButton(DEC_CLOSE, GetClose(), fButtonFocus,
|
||||
bitmap = _GetBitmapForButton(CLICK_CLOSE, GetClose(), fButtonFocus,
|
||||
rect.IntegerWidth(), rect.IntegerHeight(), this);
|
||||
fCloseBitmaps[index] = bitmap;
|
||||
}
|
||||
@ -1068,7 +1068,7 @@ DefaultDecorator::_DrawZoom(BRect rect)
|
||||
int32 index = (fButtonFocus ? 0 : 1) + (GetZoom() ? 0 : 2);
|
||||
ServerBitmap* bitmap = fZoomBitmaps[index];
|
||||
if (bitmap == NULL) {
|
||||
bitmap = _GetBitmapForButton(DEC_ZOOM, GetZoom(), fButtonFocus,
|
||||
bitmap = _GetBitmapForButton(CLICK_ZOOM, GetZoom(), fButtonFocus,
|
||||
rect.IntegerWidth(), rect.IntegerHeight(), this);
|
||||
fZoomBitmaps[index] = bitmap;
|
||||
}
|
||||
@ -1310,14 +1310,14 @@ DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
|
||||
BRect rect(0, 0, width - 1, height - 1);
|
||||
|
||||
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));
|
||||
switch (item) {
|
||||
case DEC_CLOSE:
|
||||
case CLICK_CLOSE:
|
||||
object->_DrawBlendedRect(sBitmapDrawingEngine, rect, down, focus);
|
||||
break;
|
||||
|
||||
case DEC_ZOOM:
|
||||
case CLICK_ZOOM:
|
||||
{
|
||||
// init the background
|
||||
sBitmapDrawingEngine->FillRect(rect, B_TRANSPARENT_COLOR);
|
||||
|
@ -791,61 +791,61 @@ Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
|
||||
if (windowModifier || inBorderRegion) {
|
||||
// clicking Window visible area
|
||||
|
||||
click_type action = DEC_NONE;
|
||||
click_type action = CLICK_NONE;
|
||||
int32 buttons = _ExtractButtons(message);
|
||||
|
||||
if (inBorderRegion && fDecorator != NULL)
|
||||
action = _ActionFor(message, buttons, modifiers);
|
||||
else {
|
||||
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
||||
action = DEC_MOVETOBACK;
|
||||
action = CLICK_MOVE_TO_BACK;
|
||||
else if ((fFlags & B_NOT_MOVABLE) == 0 && fDecorator != NULL)
|
||||
action = DEC_DRAG;
|
||||
action = CLICK_DRAG;
|
||||
}
|
||||
|
||||
if (!desktopSettings.AcceptFirstClick()) {
|
||||
// ignore clicks on decorator buttons if the
|
||||
// non-floating window doesn't have focus
|
||||
if (!IsFocus() && !IsFloating() && action != DEC_MOVETOBACK
|
||||
&& action != DEC_RESIZE && action != DEC_SLIDETAB)
|
||||
action = DEC_DRAG;
|
||||
if (!IsFocus() && !IsFloating() && action != CLICK_MOVE_TO_BACK
|
||||
&& action != CLICK_RESIZE && action != CLICK_SLIDE_TAB)
|
||||
action = CLICK_DRAG;
|
||||
}
|
||||
|
||||
// set decorator internals
|
||||
switch (action) {
|
||||
case DEC_CLOSE:
|
||||
case CLICK_CLOSE:
|
||||
fIsClosing = true;
|
||||
STRACE_CLICK(("===> DEC_CLOSE\n"));
|
||||
STRACE_CLICK(("===> CLICK_CLOSE\n"));
|
||||
break;
|
||||
|
||||
case DEC_ZOOM:
|
||||
case CLICK_ZOOM:
|
||||
fIsZooming = true;
|
||||
STRACE_CLICK(("===> DEC_ZOOM\n"));
|
||||
STRACE_CLICK(("===> CLICK_ZOOM\n"));
|
||||
break;
|
||||
|
||||
case DEC_MINIMIZE:
|
||||
case CLICK_MINIMIZE:
|
||||
if ((Flags() & B_NOT_MINIMIZABLE) == 0) {
|
||||
fIsMinimizing = true;
|
||||
STRACE_CLICK(("===> DEC_MINIMIZE\n"));
|
||||
STRACE_CLICK(("===> CLICK_MINIMIZE\n"));
|
||||
}
|
||||
break;
|
||||
|
||||
case DEC_DRAG:
|
||||
case CLICK_DRAG:
|
||||
fIsDragging = true;
|
||||
fLastMousePosition = where;
|
||||
STRACE_CLICK(("===> DEC_DRAG\n"));
|
||||
STRACE_CLICK(("===> CLICK_DRAG\n"));
|
||||
break;
|
||||
|
||||
case DEC_RESIZE:
|
||||
case CLICK_RESIZE:
|
||||
fIsResizing = true;
|
||||
fLastMousePosition = where;
|
||||
STRACE_CLICK(("===> DEC_RESIZE\n"));
|
||||
STRACE_CLICK(("===> CLICK_RESIZE\n"));
|
||||
break;
|
||||
|
||||
case DEC_SLIDETAB:
|
||||
case CLICK_SLIDE_TAB:
|
||||
fIsSlidingTab = true;
|
||||
fLastMousePosition = where;
|
||||
STRACE_CLICK(("===> DEC_SLIDETAB\n"));
|
||||
STRACE_CLICK(("===> CLICK_SLIDE_TAB\n"));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -875,7 +875,7 @@ Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
|
||||
fRegionPool.Recycle(visibleBorder);
|
||||
}
|
||||
|
||||
if (action == DEC_MOVETOBACK) {
|
||||
if (action == CLICK_MOVE_TO_BACK) {
|
||||
if (desktopSettings.MouseMode() == B_CLICK_TO_FOCUS_MOUSE) {
|
||||
bool covered = true;
|
||||
BRegion fullRegion;
|
||||
@ -899,7 +899,7 @@ Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
|
||||
else {
|
||||
fDesktop->SetFocusWindow(this);
|
||||
if (desktopSettings.MouseMode() == B_FOCUS_FOLLOWS_MOUSE
|
||||
&& (action == DEC_DRAG || action == DEC_RESIZE)) {
|
||||
&& (action == CLICK_DRAG || action == CLICK_RESIZE)) {
|
||||
fActivateOnMouseUp = true;
|
||||
fMouseMoveDistance = 0.0f;
|
||||
fLastMoveTime = system_time();
|
||||
@ -963,7 +963,7 @@ Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
|
||||
if (fIsZooming) {
|
||||
fIsZooming = false;
|
||||
fDecorator->SetZoom(false);
|
||||
if (action == DEC_ZOOM) {
|
||||
if (action == CLICK_ZOOM) {
|
||||
invalidate = true;
|
||||
fWindow->NotifyZoom();
|
||||
}
|
||||
@ -971,7 +971,7 @@ Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
|
||||
if (fIsClosing) {
|
||||
fIsClosing = false;
|
||||
fDecorator->SetClose(false);
|
||||
if (action == DEC_CLOSE) {
|
||||
if (action == CLICK_CLOSE) {
|
||||
invalidate = true;
|
||||
fWindow->NotifyQuitRequested();
|
||||
}
|
||||
@ -979,7 +979,7 @@ Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
|
||||
if (fIsMinimizing) {
|
||||
fIsMinimizing = false;
|
||||
fDecorator->SetMinimize(false);
|
||||
if (action == DEC_MINIMIZE) {
|
||||
if (action == CLICK_MINIMIZE) {
|
||||
invalidate = true;
|
||||
fWindow->NotifyMinimize(true);
|
||||
}
|
||||
@ -1075,11 +1075,11 @@ Window::MouseMoved(BMessage *message, BPoint where, int32* _viewToken,
|
||||
engine->ConstrainClippingRegion(visibleBorder);
|
||||
|
||||
if (fIsZooming) {
|
||||
fDecorator->SetZoom(_ActionFor(message) == DEC_ZOOM);
|
||||
fDecorator->SetZoom(_ActionFor(message) == CLICK_ZOOM);
|
||||
} else if (fIsClosing) {
|
||||
fDecorator->SetClose(_ActionFor(message) == DEC_CLOSE);
|
||||
fDecorator->SetClose(_ActionFor(message) == CLICK_CLOSE);
|
||||
} else if (fIsMinimizing) {
|
||||
fDecorator->SetMinimize(_ActionFor(message) == DEC_MINIMIZE);
|
||||
fDecorator->SetMinimize(_ActionFor(message) == CLICK_MINIMIZE);
|
||||
}
|
||||
|
||||
engine->UnlockParallelAccess();
|
||||
@ -2240,7 +2240,7 @@ click_type
|
||||
Window::_ActionFor(const BMessage* message) const
|
||||
{
|
||||
if (fDecorator == NULL)
|
||||
return DEC_NONE;
|
||||
return CLICK_NONE;
|
||||
|
||||
int32 buttons = _ExtractButtons(message);
|
||||
int32 modifiers = _ExtractModifiers(message);
|
||||
@ -2253,11 +2253,11 @@ Window::_ActionFor(const BMessage* message, int32 buttons,
|
||||
int32 modifiers) const
|
||||
{
|
||||
if (fDecorator == NULL)
|
||||
return DEC_NONE;
|
||||
return CLICK_NONE;
|
||||
|
||||
BPoint where;
|
||||
if (message->FindPoint("where", &where) != B_OK)
|
||||
return DEC_NONE;
|
||||
return CLICK_NONE;
|
||||
|
||||
return fDecorator->Clicked(where, buttons, modifiers);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user