* Added setting for "Ignore Double Click". I assumed it to be the desired
behavior to ignore double clicks in case someone did it out of habbit, but wouldn't expect an app to launch twice because of that. However, some people may want the plain/straight button behavior, as testified in #3800. :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30307 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -29,7 +29,10 @@ static const float kDragBitmapAlphaScale = 0.6;
|
|||||||
|
|
||||||
|
|
||||||
bigtime_t
|
bigtime_t
|
||||||
LaunchButton::fClickSpeed = 0;
|
LaunchButton::sClickSpeed = 0;
|
||||||
|
|
||||||
|
bool
|
||||||
|
LaunchButton::sIgnoreDoubleClick = true;
|
||||||
|
|
||||||
|
|
||||||
LaunchButton::LaunchButton(const char* name, uint32 id, const char* label,
|
LaunchButton::LaunchButton(const char* name, uint32 id, const char* label,
|
||||||
@@ -42,8 +45,8 @@ LaunchButton::LaunchButton(const char* name, uint32 id, const char* label,
|
|||||||
fLastClickTime(0),
|
fLastClickTime(0),
|
||||||
fIconSize(DEFAULT_ICON_SIZE)
|
fIconSize(DEFAULT_ICON_SIZE)
|
||||||
{
|
{
|
||||||
if (fClickSpeed == 0 || get_click_speed(&fClickSpeed) != B_OK)
|
if (sClickSpeed == 0 || get_click_speed(&sClickSpeed) != B_OK)
|
||||||
fClickSpeed = 500000;
|
sClickSpeed = 500000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -159,7 +162,7 @@ LaunchButton::MouseDown(BPoint where)
|
|||||||
{
|
{
|
||||||
bigtime_t now = system_time();
|
bigtime_t now = system_time();
|
||||||
bool callInherited = true;
|
bool callInherited = true;
|
||||||
if (now - fLastClickTime < fClickSpeed)
|
if (sIgnoreDoubleClick && now - fLastClickTime < sClickSpeed)
|
||||||
callInherited = false;
|
callInherited = false;
|
||||||
fLastClickTime = now;
|
fLastClickTime = now;
|
||||||
if (BMessage* message = Window()->CurrentMessage()) {
|
if (BMessage* message = Window()->CurrentMessage()) {
|
||||||
@@ -362,6 +365,13 @@ LaunchButton::SetIconSize(uint32 size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LaunchButton::SetIgnoreDoubleClick(bool refuse)
|
||||||
|
{
|
||||||
|
sIgnoreDoubleClick = refuse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ public:
|
|||||||
uint32 IconSize() const
|
uint32 IconSize() const
|
||||||
{ return fIconSize; }
|
{ return fIconSize; }
|
||||||
|
|
||||||
|
static void SetIgnoreDoubleClick(bool refuse);
|
||||||
|
static bool IgnoreDoubleClick()
|
||||||
|
{ return sIgnoreDoubleClick; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _UpdateToolTip();
|
void _UpdateToolTip();
|
||||||
void _UpdateIcon(const entry_ref* ref);
|
void _UpdateIcon(const entry_ref* ref);
|
||||||
@@ -69,7 +73,8 @@ public:
|
|||||||
|
|
||||||
uint32 fIconSize;
|
uint32 fIconSize;
|
||||||
|
|
||||||
static bigtime_t fClickSpeed;
|
static bigtime_t sClickSpeed;
|
||||||
|
static bool sIgnoreDoubleClick;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LAUNCH_BUTTON_H
|
#endif // LAUNCH_BUTTON_H
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2008, Haiku Inc. All rights reserved.
|
* Copyright 2006 - 2009, Stephan Aßmus <[email protected]>.
|
||||||
* Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
@@ -26,19 +23,20 @@
|
|||||||
#include "NamePanel.h"
|
#include "NamePanel.h"
|
||||||
#include "PadView.h"
|
#include "PadView.h"
|
||||||
|
|
||||||
// constructor
|
|
||||||
MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons)
|
MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons)
|
||||||
: BWindow(frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
:
|
||||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
BWindow(frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||||
| B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION
|
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
||||||
| B_AUTO_UPDATE_SIZE_LIMITS | B_SAME_POSITION_IN_ALL_WORKSPACES,
|
| B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION
|
||||||
B_ALL_WORKSPACES),
|
| B_AUTO_UPDATE_SIZE_LIMITS | B_SAME_POSITION_IN_ALL_WORKSPACES,
|
||||||
fSettings(new BMessage('sett')),
|
B_ALL_WORKSPACES),
|
||||||
fPadView(new PadView("pad view")),
|
fSettings(new BMessage('sett')),
|
||||||
fLastID(0),
|
fPadView(new PadView("pad view")),
|
||||||
fNamePanelFrame(-1000.0, -1000.0, -800.0, -900.0),
|
fLastID(0),
|
||||||
fAutoRaise(false),
|
fNamePanelFrame(-1000.0, -1000.0, -800.0, -900.0),
|
||||||
fShowOnAllWorkspaces(true)
|
fAutoRaise(false),
|
||||||
|
fShowOnAllWorkspaces(true)
|
||||||
{
|
{
|
||||||
bool buttonsAdded = false;
|
bool buttonsAdded = false;
|
||||||
if (load_settings(fSettings, "main_settings", "LaunchBox") >= B_OK)
|
if (load_settings(fSettings, "main_settings", "LaunchBox") >= B_OK)
|
||||||
@@ -54,20 +52,21 @@ MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons)
|
|||||||
AddChild(fPadView);
|
AddChild(fPadView);
|
||||||
}
|
}
|
||||||
|
|
||||||
// constructor
|
|
||||||
MainWindow::MainWindow(const char* name, BRect frame, BMessage* settings)
|
MainWindow::MainWindow(const char* name, BRect frame, BMessage* settings)
|
||||||
: BWindow(frame, name,
|
:
|
||||||
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
BWindow(frame, name,
|
||||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||||
| B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION
|
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
||||||
| B_AUTO_UPDATE_SIZE_LIMITS | B_SAME_POSITION_IN_ALL_WORKSPACES,
|
| B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION
|
||||||
B_ALL_WORKSPACES),
|
| B_AUTO_UPDATE_SIZE_LIMITS | B_SAME_POSITION_IN_ALL_WORKSPACES,
|
||||||
fSettings(settings),
|
B_ALL_WORKSPACES),
|
||||||
fPadView(new PadView("pad view")),
|
fSettings(settings),
|
||||||
fLastID(0),
|
fPadView(new PadView("pad view")),
|
||||||
fNamePanelFrame(-1000.0, -1000.0, -900.0, -900.0),
|
fLastID(0),
|
||||||
fAutoRaise(false),
|
fNamePanelFrame(-1000.0, -1000.0, -900.0, -900.0),
|
||||||
fShowOnAllWorkspaces(true)
|
fAutoRaise(false),
|
||||||
|
fShowOnAllWorkspaces(true)
|
||||||
{
|
{
|
||||||
if (!LoadSettings(settings))
|
if (!LoadSettings(settings))
|
||||||
_AddEmptyButtons();
|
_AddEmptyButtons();
|
||||||
@@ -77,13 +76,12 @@ MainWindow::MainWindow(const char* name, BRect frame, BMessage* settings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// destructor
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
delete fSettings;
|
delete fSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
// QuitRequested
|
|
||||||
bool
|
bool
|
||||||
MainWindow::QuitRequested()
|
MainWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
@@ -105,7 +103,7 @@ MainWindow::QuitRequested()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessageReceived
|
|
||||||
void
|
void
|
||||||
MainWindow::MessageReceived(BMessage* message)
|
MainWindow::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -257,7 +255,7 @@ MainWindow::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show
|
|
||||||
void
|
void
|
||||||
MainWindow::Show()
|
MainWindow::Show()
|
||||||
{
|
{
|
||||||
@@ -265,14 +263,14 @@ MainWindow::Show()
|
|||||||
_GetLocation();
|
_GetLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScreenChanged
|
|
||||||
void
|
void
|
||||||
MainWindow::ScreenChanged(BRect frame, color_space format)
|
MainWindow::ScreenChanged(BRect frame, color_space format)
|
||||||
{
|
{
|
||||||
_AdjustLocation(Frame());
|
_AdjustLocation(Frame());
|
||||||
}
|
}
|
||||||
|
|
||||||
// WorkspaceActivated
|
|
||||||
void
|
void
|
||||||
MainWindow::WorkspaceActivated(int32 workspace, bool active)
|
MainWindow::WorkspaceActivated(int32 workspace, bool active)
|
||||||
{
|
{
|
||||||
@@ -284,7 +282,7 @@ MainWindow::WorkspaceActivated(int32 workspace, bool active)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FrameMoved
|
|
||||||
void
|
void
|
||||||
MainWindow::FrameMoved(BPoint origin)
|
MainWindow::FrameMoved(BPoint origin)
|
||||||
{
|
{
|
||||||
@@ -292,7 +290,7 @@ MainWindow::FrameMoved(BPoint origin)
|
|||||||
_GetLocation();
|
_GetLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FrameResized
|
|
||||||
void
|
void
|
||||||
MainWindow::FrameResized(float width, float height)
|
MainWindow::FrameResized(float width, float height)
|
||||||
{
|
{
|
||||||
@@ -301,7 +299,7 @@ MainWindow::FrameResized(float width, float height)
|
|||||||
BWindow::FrameResized(width, height);
|
BWindow::FrameResized(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToggleAutoRaise
|
|
||||||
void
|
void
|
||||||
MainWindow::ToggleAutoRaise()
|
MainWindow::ToggleAutoRaise()
|
||||||
{
|
{
|
||||||
@@ -312,7 +310,7 @@ MainWindow::ToggleAutoRaise()
|
|||||||
fPadView->SetEventMask(0);
|
fPadView->SetEventMask(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadSettings
|
|
||||||
bool
|
bool
|
||||||
MainWindow::LoadSettings(const BMessage* message)
|
MainWindow::LoadSettings(const BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -362,6 +360,11 @@ MainWindow::LoadSettings(const BMessage* message)
|
|||||||
if (message->FindInt32("icon size", &iconSize) == B_OK)
|
if (message->FindInt32("icon size", &iconSize) == B_OK)
|
||||||
fPadView->SetIconSize(iconSize);
|
fPadView->SetIconSize(iconSize);
|
||||||
|
|
||||||
|
// restore ignore double click
|
||||||
|
bool ignoreDoubleClick;
|
||||||
|
if (message->FindBool("ignore double click", &ignoreDoubleClick) == B_OK)
|
||||||
|
fPadView->SetIgnoreDoubleClick(ignoreDoubleClick);
|
||||||
|
|
||||||
// restore buttons
|
// restore buttons
|
||||||
const char* path;
|
const char* path;
|
||||||
bool buttonAdded = false;
|
bool buttonAdded = false;
|
||||||
@@ -406,7 +409,7 @@ MainWindow::LoadSettings(const BMessage* message)
|
|||||||
return buttonAdded;
|
return buttonAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveSettings
|
|
||||||
void
|
void
|
||||||
MainWindow::SaveSettings(BMessage* message)
|
MainWindow::SaveSettings(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -439,6 +442,12 @@ MainWindow::SaveSettings(BMessage* message)
|
|||||||
if (message->ReplaceInt32("icon size", fPadView->IconSize()) != B_OK)
|
if (message->ReplaceInt32("icon size", fPadView->IconSize()) != B_OK)
|
||||||
message->AddInt32("icon size", fPadView->IconSize());
|
message->AddInt32("icon size", fPadView->IconSize());
|
||||||
|
|
||||||
|
// store ignore double click
|
||||||
|
if (message->ReplaceBool("ignore double click",
|
||||||
|
fPadView->IgnoreDoubleClick()) != B_OK) {
|
||||||
|
message->AddBool("ignore double click", fPadView->IgnoreDoubleClick());
|
||||||
|
}
|
||||||
|
|
||||||
// store buttons
|
// store buttons
|
||||||
message->RemoveName("path");
|
message->RemoveName("path");
|
||||||
message->RemoveName("description");
|
message->RemoveName("description");
|
||||||
@@ -468,7 +477,7 @@ MainWindow::SaveSettings(BMessage* message)
|
|||||||
message->AddInt32("workspaces", Workspaces());
|
message->AddInt32("workspaces", Workspaces());
|
||||||
}
|
}
|
||||||
|
|
||||||
// _GetLocation
|
|
||||||
void
|
void
|
||||||
MainWindow::_GetLocation()
|
MainWindow::_GetLocation()
|
||||||
{
|
{
|
||||||
@@ -495,7 +504,7 @@ MainWindow::_GetLocation()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// _AdjustLocation
|
|
||||||
void
|
void
|
||||||
MainWindow::_AdjustLocation(BRect frame)
|
MainWindow::_AdjustLocation(BRect frame)
|
||||||
{
|
{
|
||||||
@@ -532,7 +541,7 @@ MainWindow::_AdjustLocation(BRect frame)
|
|||||||
ResizeTo(frame.Width(), frame.Height());
|
ResizeTo(frame.Width(), frame.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
// _AddDefaultButtons
|
|
||||||
void
|
void
|
||||||
MainWindow::_AddDefaultButtons()
|
MainWindow::_AddDefaultButtons()
|
||||||
{
|
{
|
||||||
@@ -573,7 +582,7 @@ MainWindow::_AddDefaultButtons()
|
|||||||
button->SetTo("application/x-vnd.Haiku-Terminal", true);
|
button->SetTo("application/x-vnd.Haiku-Terminal", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _AddEmptyButtons
|
|
||||||
void
|
void
|
||||||
MainWindow::_AddEmptyButtons()
|
MainWindow::_AddEmptyButtons()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006, Haiku.
|
* Copyright 2006 - 2009, Stephan Aßmus <[email protected]>.
|
||||||
* Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAIN_WINDOW_H
|
#ifndef MAIN_WINDOW_H
|
||||||
#define MAIN_WINDOW_H
|
#define MAIN_WINDOW_H
|
||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
class PadView;
|
class PadView;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -25,8 +22,9 @@ enum {
|
|||||||
MSG_ADD_WINDOW = 'addw',
|
MSG_ADD_WINDOW = 'addw',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class MainWindow : public BWindow {
|
class MainWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
MainWindow(const char* name, BRect frame,
|
MainWindow(const char* name, BRect frame,
|
||||||
bool addDefaultButtons = false);
|
bool addDefaultButtons = false);
|
||||||
MainWindow(const char* name, BRect frame,
|
MainWindow(const char* name, BRect frame,
|
||||||
@@ -41,8 +39,7 @@ class MainWindow : public BWindow {
|
|||||||
virtual void ScreenChanged(BRect frame, color_space format);
|
virtual void ScreenChanged(BRect frame, color_space format);
|
||||||
virtual void WorkspaceActivated(int32 workspace, bool active);
|
virtual void WorkspaceActivated(int32 workspace, bool active);
|
||||||
virtual void FrameMoved(BPoint origin);
|
virtual void FrameMoved(BPoint origin);
|
||||||
virtual void FrameResized(float width,
|
virtual void FrameResized(float width, float height);
|
||||||
float height);
|
|
||||||
|
|
||||||
// MainWindow
|
// MainWindow
|
||||||
void ToggleAutoRaise();
|
void ToggleAutoRaise();
|
||||||
@@ -59,23 +56,24 @@ class MainWindow : public BWindow {
|
|||||||
BMessage* Settings() const
|
BMessage* Settings() const
|
||||||
{ return fSettings; }
|
{ return fSettings; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _GetLocation();
|
void _GetLocation();
|
||||||
void _AdjustLocation(BRect frame);
|
void _AdjustLocation(BRect frame);
|
||||||
void _AddDefaultButtons();
|
void _AddDefaultButtons();
|
||||||
void _AddEmptyButtons();
|
void _AddEmptyButtons();
|
||||||
|
|
||||||
BMessage* fSettings;
|
BMessage* fSettings;
|
||||||
PadView* fPadView;
|
PadView* fPadView;
|
||||||
int32 fLastID;
|
int32 fLastID;
|
||||||
|
|
||||||
float fBorderDist;
|
float fBorderDist;
|
||||||
BPoint fScreenPosition; // not really the position, 0...1 = left...right
|
BPoint fScreenPosition;
|
||||||
|
// not really the position, 0...1 = left...right
|
||||||
|
|
||||||
BRect fNamePanelFrame;
|
BRect fNamePanelFrame;
|
||||||
|
|
||||||
bool fAutoRaise;
|
bool fAutoRaise;
|
||||||
bool fShowOnAllWorkspaces;
|
bool fShowOnAllWorkspaces;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAIN_WINDOW_H
|
#endif // MAIN_WINDOW_H
|
||||||
|
|||||||
@@ -22,15 +22,18 @@
|
|||||||
#include "LaunchButton.h"
|
#include "LaunchButton.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
static bigtime_t sActivationDelay = 40000;
|
static bigtime_t sActivationDelay = 40000;
|
||||||
static const uint32 kIconSizes[] = { 16, 20, 24, 32, 40, 48, 64 };
|
static const uint32 kIconSizes[] = { 16, 20, 24, 32, 40, 48, 64 };
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MSG_TOGGLE_LAYOUT = 'tgll',
|
MSG_TOGGLE_LAYOUT = 'tgll',
|
||||||
MSG_SET_ICON_SIZE = 'stis'
|
MSG_SET_ICON_SIZE = 'stis',
|
||||||
|
MSG_SET_IGNORE_DOUBLECLICK = 'strd'
|
||||||
};
|
};
|
||||||
|
|
||||||
// constructor
|
|
||||||
PadView::PadView(const char* name)
|
PadView::PadView(const char* name)
|
||||||
: BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE, NULL),
|
: BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE, NULL),
|
||||||
fDragging(false),
|
fDragging(false),
|
||||||
@@ -46,12 +49,12 @@ PadView::PadView(const char* name)
|
|||||||
SetLayout(fButtonLayout);
|
SetLayout(fButtonLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
PadView::~PadView()
|
PadView::~PadView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw
|
|
||||||
void
|
void
|
||||||
PadView::Draw(BRect updateRect)
|
PadView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
@@ -127,7 +130,7 @@ PadView::Draw(BRect updateRect)
|
|||||||
FillRect(r, B_SOLID_LOW);
|
FillRect(r, B_SOLID_LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessageReceived
|
|
||||||
void
|
void
|
||||||
PadView::MessageReceived(BMessage* message)
|
PadView::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -141,18 +144,24 @@ PadView::MessageReceived(BMessage* message)
|
|||||||
fButtonLayout->SetOrientation(B_HORIZONTAL);
|
fButtonLayout->SetOrientation(B_HORIZONTAL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSG_SET_ICON_SIZE:
|
case MSG_SET_ICON_SIZE:
|
||||||
uint32 size;
|
uint32 size;
|
||||||
if (message->FindInt32("size", (int32*)&size) == B_OK)
|
if (message->FindInt32("size", (int32*)&size) == B_OK)
|
||||||
SetIconSize(size);
|
SetIconSize(size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MSG_SET_IGNORE_DOUBLECLICK:
|
||||||
|
SetIgnoreDoubleClick(!IgnoreDoubleClick());
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(message);
|
BView::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseDown
|
|
||||||
void
|
void
|
||||||
PadView::MouseDown(BPoint where)
|
PadView::MouseDown(BPoint where)
|
||||||
{
|
{
|
||||||
@@ -205,7 +214,7 @@ PadView::MouseDown(BPoint where)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseUp
|
|
||||||
void
|
void
|
||||||
PadView::MouseUp(BPoint where)
|
PadView::MouseUp(BPoint where)
|
||||||
{
|
{
|
||||||
@@ -220,7 +229,7 @@ PadView::MouseUp(BPoint where)
|
|||||||
fDragging = false;
|
fDragging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseMoved
|
|
||||||
void
|
void
|
||||||
PadView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
PadView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
||||||
{
|
{
|
||||||
@@ -241,7 +250,8 @@ PadView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
|||||||
bool raise = false;
|
bool raise = false;
|
||||||
if (fabs(0.5 - position.x) > fabs(0.5 - position.y)) {
|
if (fabs(0.5 - position.x) > fabs(0.5 - position.y)) {
|
||||||
// left or right border
|
// left or right border
|
||||||
if (where.y >= windowFrame.top && where.y <= windowFrame.bottom) {
|
if (where.y >= windowFrame.top
|
||||||
|
&& where.y <= windowFrame.bottom) {
|
||||||
if (position.x < 0.5 && where.x == frame.left)
|
if (position.x < 0.5 && where.x == frame.left)
|
||||||
raise = true;
|
raise = true;
|
||||||
else if (position.x > 0.5 && where.x == frame.right)
|
else if (position.x > 0.5 && where.x == frame.right)
|
||||||
@@ -262,7 +272,7 @@ PadView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddButton
|
|
||||||
void
|
void
|
||||||
PadView::AddButton(LaunchButton* button, LaunchButton* beforeButton)
|
PadView::AddButton(LaunchButton* button, LaunchButton* beforeButton)
|
||||||
{
|
{
|
||||||
@@ -274,21 +284,21 @@ PadView::AddButton(LaunchButton* button, LaunchButton* beforeButton)
|
|||||||
fButtonLayout->AddView(button);
|
fButtonLayout->AddView(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveButton
|
|
||||||
bool
|
bool
|
||||||
PadView::RemoveButton(LaunchButton* button)
|
PadView::RemoveButton(LaunchButton* button)
|
||||||
{
|
{
|
||||||
return fButtonLayout->RemoveView(button);
|
return fButtonLayout->RemoveView(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ButtonAt
|
|
||||||
LaunchButton*
|
LaunchButton*
|
||||||
PadView::ButtonAt(int32 index) const
|
PadView::ButtonAt(int32 index) const
|
||||||
{
|
{
|
||||||
return dynamic_cast<LaunchButton*>(ChildAt(index));
|
return dynamic_cast<LaunchButton*>(ChildAt(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisplayMenu
|
|
||||||
void
|
void
|
||||||
PadView::DisplayMenu(BPoint where, LaunchButton* button) const
|
PadView::DisplayMenu(BPoint where, LaunchButton* button) const
|
||||||
{
|
{
|
||||||
@@ -362,6 +372,12 @@ PadView::DisplayMenu(BPoint where, LaunchButton* button) const
|
|||||||
}
|
}
|
||||||
settingsM->AddItem(iconSizeM);
|
settingsM->AddItem(iconSizeM);
|
||||||
|
|
||||||
|
item = new BMenuItem("Ignore Double-click",
|
||||||
|
new BMessage(MSG_SET_IGNORE_DOUBLECLICK));
|
||||||
|
item->SetTarget(this);
|
||||||
|
item->SetMarked(IgnoreDoubleClick());
|
||||||
|
settingsM->AddItem(item);
|
||||||
|
|
||||||
uint32 what = window->Look() == B_BORDERED_WINDOW_LOOK ? MSG_SHOW_BORDER : MSG_HIDE_BORDER;
|
uint32 what = window->Look() == B_BORDERED_WINDOW_LOOK ? MSG_SHOW_BORDER : MSG_HIDE_BORDER;
|
||||||
item = new BMenuItem("Show Window Border", new BMessage(what));
|
item = new BMenuItem("Show Window Border", new BMessage(what));
|
||||||
item->SetTarget(window);
|
item->SetTarget(window);
|
||||||
@@ -420,7 +436,7 @@ PadView::DisplayMenu(BPoint where, LaunchButton* button) const
|
|||||||
menu->Go(where, true, false, mouseRect, true);
|
menu->Go(where, true, false, mouseRect, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetOrientation
|
|
||||||
void
|
void
|
||||||
PadView::SetOrientation(enum orientation orientation)
|
PadView::SetOrientation(enum orientation orientation)
|
||||||
{
|
{
|
||||||
@@ -433,14 +449,14 @@ PadView::SetOrientation(enum orientation orientation)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Orientation
|
|
||||||
enum orientation
|
enum orientation
|
||||||
PadView::Orientation() const
|
PadView::Orientation() const
|
||||||
{
|
{
|
||||||
return fButtonLayout->Orientation();
|
return fButtonLayout->Orientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetIconSize
|
|
||||||
void
|
void
|
||||||
PadView::SetIconSize(uint32 size)
|
PadView::SetIconSize(uint32 size)
|
||||||
{
|
{
|
||||||
@@ -453,7 +469,7 @@ PadView::SetIconSize(uint32 size)
|
|||||||
button->SetIconSize(fIconSize);
|
button->SetIconSize(fIconSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IconSize
|
|
||||||
uint32
|
uint32
|
||||||
PadView::IconSize() const
|
PadView::IconSize() const
|
||||||
{
|
{
|
||||||
@@ -461,3 +477,17 @@ PadView::IconSize() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PadView::SetIgnoreDoubleClick(bool refuse)
|
||||||
|
{
|
||||||
|
LaunchButton::SetIgnoreDoubleClick(refuse);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
PadView::IgnoreDoubleClick() const
|
||||||
|
{
|
||||||
|
return LaunchButton::IgnoreDoubleClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ public:
|
|||||||
void SetIconSize(uint32 size);
|
void SetIconSize(uint32 size);
|
||||||
uint32 IconSize() const;
|
uint32 IconSize() const;
|
||||||
|
|
||||||
|
void SetIgnoreDoubleClick(bool refuse);
|
||||||
|
bool IgnoreDoubleClick() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BPoint fDragOffset;
|
BPoint fDragOffset;
|
||||||
bool fDragging;
|
bool fDragging;
|
||||||
|
|||||||
Reference in New Issue
Block a user