Fixed one of the reported bugs by using the default flags of the bounding
box instead of manually defining them (and forgetting about B_NAVIGABLE_JUMP). Many style updates - more to come, though. Moved the revert and default button variables into private. It now has an extra SetRevertable() method to hide them. Added newline to the end of file :) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5944 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -30,9 +30,9 @@
|
||||
#include "MouseMessages.h"
|
||||
#include "MouseBitmap.h"
|
||||
|
||||
|
||||
BoxView::BoxView(BRect rect, MouseView *mouseView)
|
||||
: BBox(rect, "mouse_box",
|
||||
B_FOLLOW_LEFT, B_WILL_DRAW,B_FANCY_BORDER),
|
||||
: BBox(rect, "mouse_box"),
|
||||
fMouseView(mouseView)
|
||||
{
|
||||
}
|
||||
@@ -41,7 +41,6 @@ BoxView::BoxView(BRect rect, MouseView *mouseView)
|
||||
void
|
||||
BoxView::MouseDown(BPoint where)
|
||||
{
|
||||
|
||||
int32 index = fMouseView->mouseTypeMenu->IndexOf(fMouseView->mouseTypeMenu->FindMarked());
|
||||
|
||||
fMouseView->fCurrentButton = -1;
|
||||
@@ -76,16 +75,14 @@ BoxView::MouseDown(BPoint where)
|
||||
|
||||
|
||||
MouseView::MouseView(BRect rect)
|
||||
: BBox(rect, "mouse_view",
|
||||
B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP | B_PULSE_NEEDED,
|
||||
B_PLAIN_BORDER),
|
||||
: BView(rect, "mouse_view", B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED),
|
||||
fCurrentButton(-1),
|
||||
fButtons(0),
|
||||
fOldButtons(0)
|
||||
{
|
||||
BRect frame;
|
||||
BTextControl *textcontrol;
|
||||
BMenuField *menufield;
|
||||
BRect frame;
|
||||
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
@@ -218,7 +215,7 @@ MouseView::AttachedToWindow()
|
||||
get_mouse_map(&fCurrentMouseMap);
|
||||
Init();
|
||||
|
||||
mouseMapMenu->SetTargetForItems( this->Window() );
|
||||
mouseMapMenu->SetTargetForItems(Window());
|
||||
}
|
||||
|
||||
|
||||
@@ -229,6 +226,7 @@ MouseView::Pulse()
|
||||
GetMouse(&point, &fButtons, true);
|
||||
|
||||
if (fOldButtons != fButtons) {
|
||||
printf("buttons: old = %ld, new = %ld\n", fOldButtons, fButtons);
|
||||
Invalidate();
|
||||
fOldButtons = fButtons;
|
||||
}
|
||||
@@ -239,6 +237,7 @@ void
|
||||
MouseView::Draw(BRect updateFrame)
|
||||
{
|
||||
inherited::Draw(updateFrame);
|
||||
|
||||
fBox->SetHighColor(120,120,120);
|
||||
fBox->SetLowColor(255,255,255);
|
||||
// Line above the test area
|
||||
@@ -404,3 +403,11 @@ MouseView::Init()
|
||||
printf("click_speed : %lli, mouse_speed : %li, mouse_acc : %li, mouse_type : %li\n",
|
||||
fClickSpeed, fMouseSpeed, fMouseAcc, fMouseType);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MouseView::SetRevertable(bool revertable)
|
||||
{
|
||||
revertButton->SetEnabled(revertable);
|
||||
}
|
||||
|
||||
|
||||
+13
-10
@@ -15,24 +15,25 @@
|
||||
#ifndef MOUSE_VIEW_H
|
||||
#define MOUSE_VIEW_H
|
||||
|
||||
|
||||
#include <Box.h>
|
||||
#include <Bitmap.h>
|
||||
#include <Button.h>
|
||||
#include <Slider.h>
|
||||
#include <PopUpMenu.h>
|
||||
|
||||
class MouseView : public BBox
|
||||
{
|
||||
public:
|
||||
typedef BBox inherited;
|
||||
|
||||
class MouseView : public BView {
|
||||
public:
|
||||
MouseView(BRect frame);
|
||||
void AttachedToWindow();
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void Draw(BRect frame);
|
||||
virtual void Pulse();
|
||||
void Init();
|
||||
|
||||
BButton *defaultButton, *revertButton;
|
||||
void Init();
|
||||
void SetRevertable(bool revertable);
|
||||
|
||||
BSlider *dcSpeedSlider, *mouseSpeedSlider, *mouseAccSlider;
|
||||
BPopUpMenu *mouseTypeMenu, *focusMenu, *mouseMapMenu;
|
||||
|
||||
@@ -47,21 +48,23 @@ public:
|
||||
uint32 fOldButtons;
|
||||
|
||||
private:
|
||||
typedef BView inherited;
|
||||
|
||||
BBox *fBox;
|
||||
|
||||
BBitmap *fDoubleClickBitmap, *fSpeedBitmap, *fAccelerationBitmap;
|
||||
BBitmap *fMouseBitmap, *fMouseDownBitmap;
|
||||
|
||||
BButton *defaultButton, *revertButton;
|
||||
};
|
||||
|
||||
class BoxView : public BBox
|
||||
{
|
||||
class BoxView : public BBox {
|
||||
public:
|
||||
BoxView(BRect frame, MouseView *mouseView);
|
||||
void MouseDown(BPoint where);
|
||||
|
||||
private:
|
||||
MouseView *fMouseView;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user