Tracker: style fixes to Navigator
This commit is contained in:
parent
dbe62cc77f
commit
808af41c2a
|
@ -58,12 +58,16 @@ static const int32 kMaxHistory = 32;
|
||||||
static BPicture sPicture;
|
static BPicture sPicture;
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - BNavigatorButton
|
||||||
|
|
||||||
|
|
||||||
BNavigatorButton::BNavigatorButton(BRect rect, const char* name,
|
BNavigatorButton::BNavigatorButton(BRect rect, const char* name,
|
||||||
BMessage* message, int32 resIDon, int32 resIDoff, int32 resIDdisabled)
|
BMessage* message, int32 resIDon, int32 resIDoff, int32 resIDdisabled)
|
||||||
: BPictureButton(rect, name, &sPicture, &sPicture, message),
|
:
|
||||||
fResIDOn(resIDon),
|
BPictureButton(rect, name, &sPicture, &sPicture, message),
|
||||||
fResIDOff(resIDoff),
|
fResIDOn(resIDon),
|
||||||
fResIDDisabled(resIDdisabled)
|
fResIDOff(resIDoff),
|
||||||
|
fResIDDisabled(resIDdisabled)
|
||||||
{
|
{
|
||||||
// Clear to background color to avoid ugly border on click
|
// Clear to background color to avoid ugly border on click
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
@ -104,7 +108,7 @@ BNavigatorButton::AttachedToWindow()
|
||||||
void
|
void
|
||||||
BNavigatorButton::SetPicture(BBitmap* bitmap, bool enabled, bool on)
|
BNavigatorButton::SetPicture(BBitmap* bitmap, bool enabled, bool on)
|
||||||
{
|
{
|
||||||
if (bitmap) {
|
if (bitmap != NULL) {
|
||||||
BPicture picture;
|
BPicture picture;
|
||||||
BView view(bitmap->Bounds(), "", 0, 0);
|
BView view(bitmap->Bounds(), "", 0, 0);
|
||||||
AddChild(&view);
|
AddChild(&view);
|
||||||
|
@ -116,21 +120,19 @@ BNavigatorButton::SetPicture(BBitmap* bitmap, bool enabled, bool on)
|
||||||
view.EndPicture();
|
view.EndPicture();
|
||||||
RemoveChild(&view);
|
RemoveChild(&view);
|
||||||
if (enabled)
|
if (enabled)
|
||||||
if (on)
|
on ? SetEnabledOn(&picture) : SetEnabledOff(&picture);
|
||||||
SetEnabledOn(&picture);
|
|
||||||
else
|
|
||||||
SetEnabledOff(&picture);
|
|
||||||
else
|
else
|
||||||
if (on)
|
on ? SetDisabledOn(&picture) : SetDisabledOff(&picture);
|
||||||
SetDisabledOn(&picture);
|
|
||||||
else
|
|
||||||
SetDisabledOff(&picture);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - BNavigator
|
||||||
|
|
||||||
|
|
||||||
BNavigator::BNavigator(const Model* model, BRect rect, uint32 resizeMask)
|
BNavigator::BNavigator(const Model* model, BRect rect, uint32 resizeMask)
|
||||||
: BView(rect, "Navigator", resizeMask, B_WILL_DRAW),
|
:
|
||||||
|
BView(rect, "Navigator", resizeMask, B_WILL_DRAW),
|
||||||
fBack(0),
|
fBack(0),
|
||||||
fForw(0),
|
fForw(0),
|
||||||
fUp(0),
|
fUp(0),
|
||||||
|
@ -321,7 +323,7 @@ BNavigator::SendNavigationMessage(NavigationAction action, BEntry* entry,
|
||||||
// so we have to select the item manually
|
// so we have to select the item manually
|
||||||
if (option) {
|
if (option) {
|
||||||
message.what = B_REFS_RECEIVED;
|
message.what = B_REFS_RECEIVED;
|
||||||
if (nodeRef) {
|
if (nodeRef != NULL) {
|
||||||
message.AddData("nodeRefToSelect", B_RAW_TYPE, nodeRef,
|
message.AddData("nodeRefToSelect", B_RAW_TYPE, nodeRef,
|
||||||
sizeof(node_ref));
|
sizeof(node_ref));
|
||||||
}
|
}
|
||||||
|
@ -388,11 +390,13 @@ BNavigator::UpdateLocation(const Model* newmodel, int32 action)
|
||||||
// Modify history according to commands
|
// Modify history according to commands
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case kActionBackward:
|
case kActionBackward:
|
||||||
fForwHistory.AddItem(fBackHistory.RemoveItemAt(fBackHistory.CountItems()-1));
|
fForwHistory.AddItem(fBackHistory.RemoveItemAt(
|
||||||
|
fBackHistory.CountItems() - 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kActionForward:
|
case kActionForward:
|
||||||
fBackHistory.AddItem(fForwHistory.RemoveItemAt(fForwHistory.CountItems()-1));
|
fBackHistory.AddItem(fForwHistory.RemoveItemAt(
|
||||||
|
fForwHistory.CountItems() - 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kActionUpdatePath:
|
case kActionUpdatePath:
|
||||||
|
@ -430,5 +434,5 @@ BNavigator::CalcNavigatorHeight(void)
|
||||||
{
|
{
|
||||||
// Empiric formula from how much space the textview
|
// Empiric formula from how much space the textview
|
||||||
// will take once it is attached (using be_plain_font):
|
// will take once it is attached (using be_plain_font):
|
||||||
return ceilf(11.0f + be_plain_font->Size()*(1.0f + 7.0f / 30.0f));
|
return ceilf(11.0f + be_plain_font->Size() * (1.0f + 7.0f / 30.0f));
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ of Be Incorporated in the United States and other countries. Other brand product
|
||||||
names are registered trademarks or trademarks of their respective holders.
|
names are registered trademarks or trademarks of their respective holders.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
#ifndef _NAVIGATOR_H_
|
#ifndef _NAVIGATOR_H
|
||||||
#define _NAVIGATOR_H_
|
#define _NAVIGATOR_H
|
||||||
|
|
||||||
|
|
||||||
#include "Model.h"
|
#include "Model.h"
|
||||||
|
@ -134,4 +134,5 @@ BNavigator::Window() const
|
||||||
|
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
#endif // _NAVIGATOR_H_
|
|
||||||
|
#endif // _NAVIGATOR_H
|
||||||
|
|
Loading…
Reference in New Issue