Improved/fixed the look of file panels. If I feel motivated enough, I may
also fix the font-sensitivity issues. * The CountView can now draw part of the PoseView focus indication. Though I am not convinced anymore that I am approaching this the right way. Maybe scroll views should simply leave room for drawing a frame between child and scroll bars... * ContainerWindow::BackgroundView uses the new BControlLook method to draw the scroll view frame to look just like a regular scroll view. * Some fixes to layout of controls in file panels and minimum window size. There would be much more left to do... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29663 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -65,6 +65,7 @@ All rights reserved.
|
|||||||
#include "BackgroundImage.h"
|
#include "BackgroundImage.h"
|
||||||
#include "Commands.h"
|
#include "Commands.h"
|
||||||
#include "ContainerWindow.h"
|
#include "ContainerWindow.h"
|
||||||
|
#include "CountView.h"
|
||||||
#include "DeskWindow.h"
|
#include "DeskWindow.h"
|
||||||
#include "FavoritesMenu.h"
|
#include "FavoritesMenu.h"
|
||||||
#include "FindPanel.h"
|
#include "FindPanel.h"
|
||||||
@@ -3967,9 +3968,25 @@ BackgroundView::FrameResized(float, float)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundView::PoseViewFocused(bool)
|
BackgroundView::PoseViewFocused(bool focused)
|
||||||
{
|
{
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
|
||||||
|
BContainerWindow* window = dynamic_cast<BContainerWindow*>(Window());
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BScrollBar* hScrollBar = window->PoseView()->HScrollBar();
|
||||||
|
if (hScrollBar != NULL)
|
||||||
|
hScrollBar->SetBorderHighlighted(focused);
|
||||||
|
|
||||||
|
BScrollBar* vScrollBar = window->PoseView()->VScrollBar();
|
||||||
|
if (vScrollBar != NULL)
|
||||||
|
vScrollBar->SetBorderHighlighted(focused);
|
||||||
|
|
||||||
|
BCountView* countView = window->PoseView()->CountView();
|
||||||
|
if (countView != NULL)
|
||||||
|
countView->SetBorderHighlighted(focused);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3981,18 +3998,49 @@ BackgroundView::WindowActivated(bool)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundView::Draw(BRect)
|
BackgroundView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
BContainerWindow *window = dynamic_cast<BContainerWindow *>(Window());
|
BContainerWindow *window = dynamic_cast<BContainerWindow *>(Window());
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BRect frame(window->PoseView()->Frame());
|
BPoseView* poseView = window->PoseView();
|
||||||
|
BRect frame(poseView->Frame());
|
||||||
frame.InsetBy(-1, -1);
|
frame.InsetBy(-1, -1);
|
||||||
frame.top -= kTitleViewHeight;
|
frame.top -= kTitleViewHeight;
|
||||||
frame.bottom += B_H_SCROLL_BAR_HEIGHT;
|
frame.bottom += B_H_SCROLL_BAR_HEIGHT;
|
||||||
frame.right += B_V_SCROLL_BAR_WIDTH;
|
frame.right += B_V_SCROLL_BAR_WIDTH;
|
||||||
|
|
||||||
|
if (be_control_look != NULL) {
|
||||||
|
uint32 flags = 0;
|
||||||
|
if (window->IsActive() && window->PoseView()->IsFocus())
|
||||||
|
flags |= BControlLook::B_FOCUSED;
|
||||||
|
|
||||||
|
frame.top--;
|
||||||
|
frame.InsetBy(-1, -1);
|
||||||
|
BRect rect(frame);
|
||||||
|
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||||
|
|
||||||
|
BScrollBar* hScrollBar = poseView->HScrollBar();
|
||||||
|
BScrollBar* vScrollBar = poseView->VScrollBar();
|
||||||
|
|
||||||
|
BRect verticalScrollBarFrame(0, 0, -1, -1);
|
||||||
|
if (vScrollBar)
|
||||||
|
verticalScrollBarFrame = vScrollBar->Frame();
|
||||||
|
BRect horizontalScrollBarFrame(0, 0, -1, -1);
|
||||||
|
if (hScrollBar) {
|
||||||
|
horizontalScrollBarFrame = hScrollBar->Frame();
|
||||||
|
// CountView extends horizontal scroll bar frame:
|
||||||
|
horizontalScrollBarFrame.left = frame.left + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
be_control_look->DrawScrollViewFrame(this, rect, updateRect,
|
||||||
|
verticalScrollBarFrame, horizontalScrollBarFrame, base,
|
||||||
|
B_FANCY_BORDER, flags);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SetHighColor(100, 100, 100);
|
SetHighColor(100, 100, 100);
|
||||||
StrokeRect(frame);
|
StrokeRect(frame);
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ BCountView::BCountView(BRect bounds, BPoseView* view)
|
|||||||
fLastCount(-1),
|
fLastCount(-1),
|
||||||
fPoseView(view),
|
fPoseView(view),
|
||||||
fShowingBarberPole(false),
|
fShowingBarberPole(false),
|
||||||
|
fBorderHighlighted(false),
|
||||||
fBarberPoleMap(NULL),
|
fBarberPoleMap(NULL),
|
||||||
fLastBarberPoleOffset(5),
|
fLastBarberPoleOffset(5),
|
||||||
fStartSpinningAfter(0),
|
fStartSpinningAfter(0),
|
||||||
@@ -98,6 +99,17 @@ BCountView::Pulse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BCountView::WindowActivated(bool active)
|
||||||
|
{
|
||||||
|
if (fBorderHighlighted) {
|
||||||
|
BRect dirty(Bounds());
|
||||||
|
dirty.bottom = dirty.top;
|
||||||
|
Invalidate(dirty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCountView::EndBarberPole()
|
BCountView::EndBarberPole()
|
||||||
{
|
{
|
||||||
@@ -186,6 +198,9 @@ BCountView::Draw(BRect updateRect)
|
|||||||
|
|
||||||
if (be_control_look != NULL) {
|
if (be_control_look != NULL) {
|
||||||
rgb_color base = ViewColor();
|
rgb_color base = ViewColor();
|
||||||
|
if (fBorderHighlighted && Window()->IsActive())
|
||||||
|
SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
|
||||||
|
else
|
||||||
SetHighColor(tint_color(base, B_DARKEN_2_TINT));
|
SetHighColor(tint_color(base, B_DARKEN_2_TINT));
|
||||||
StrokeLine(bounds.LeftTop(), bounds.RightTop());
|
StrokeLine(bounds.LeftTop(), bounds.RightTop());
|
||||||
bounds.top++;
|
bounds.top++;
|
||||||
@@ -329,3 +344,16 @@ BCountView::IsTypingAhead() const
|
|||||||
{
|
{
|
||||||
return fTypeAheadString.Length() != 0;
|
return fTypeAheadString.Length() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BCountView::SetBorderHighlighted(bool highlighted)
|
||||||
|
{
|
||||||
|
if (fBorderHighlighted == highlighted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fBorderHighlighted = highlighted;
|
||||||
|
BRect dirty(Bounds());
|
||||||
|
dirty.bottom = dirty.top;
|
||||||
|
Invalidate(dirty);
|
||||||
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public:
|
|||||||
virtual void MouseDown(BPoint);
|
virtual void MouseDown(BPoint);
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void Pulse();
|
virtual void Pulse();
|
||||||
|
virtual void WindowActivated(bool active);
|
||||||
|
|
||||||
void CheckCount();
|
void CheckCount();
|
||||||
void StartBarberPole();
|
void StartBarberPole();
|
||||||
@@ -62,6 +63,8 @@ public:
|
|||||||
const char *TypeAhead() const;
|
const char *TypeAhead() const;
|
||||||
bool IsTypingAhead() const;
|
bool IsTypingAhead() const;
|
||||||
|
|
||||||
|
void SetBorderHighlighted(bool highlighted);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BRect BarberPoleInnerRect() const;
|
BRect BarberPoleInnerRect() const;
|
||||||
BRect BarberPoleOuterRect() const;
|
BRect BarberPoleOuterRect() const;
|
||||||
@@ -71,7 +74,8 @@ private:
|
|||||||
|
|
||||||
int32 fLastCount;
|
int32 fLastCount;
|
||||||
BPoseView *fPoseView;
|
BPoseView *fPoseView;
|
||||||
bool fShowingBarberPole;
|
bool fShowingBarberPole : 1;
|
||||||
|
bool fBorderHighlighted : 1;
|
||||||
BBitmap *fBarberPoleMap;
|
BBitmap *fBarberPoleMap;
|
||||||
float fLastBarberPoleOffset;
|
float fLastBarberPoleOffset;
|
||||||
bigtime_t fStartSpinningAfter;
|
bigtime_t fStartSpinningAfter;
|
||||||
|
|||||||
@@ -661,8 +661,8 @@ TFilePanel::Init(const BMessage *)
|
|||||||
float f_height = ht.ascent + ht.descent + ht.leading;
|
float f_height = ht.ascent + ht.descent + ht.leading;
|
||||||
|
|
||||||
BRect rect;
|
BRect rect;
|
||||||
rect.top = fMenuBar->Bounds().Height() + 2;
|
rect.top = fMenuBar->Bounds().Height() + 8;
|
||||||
rect.left = windRect.left + 9;
|
rect.left = windRect.left + 8;
|
||||||
rect.right = rect.left + 300;
|
rect.right = rect.left + 300;
|
||||||
rect.bottom = rect.top + (f_height > 22 ? f_height : 22);
|
rect.bottom = rect.top + (f_height > 22 ? f_height : 22);
|
||||||
|
|
||||||
@@ -687,7 +687,7 @@ TFilePanel::Init(const BMessage *)
|
|||||||
if (fIsSavePanel) {
|
if (fIsSavePanel) {
|
||||||
BRect rect(windRect);
|
BRect rect(windRect);
|
||||||
rect.top = rect.bottom - 35;
|
rect.top = rect.bottom - 35;
|
||||||
rect.left = 9;
|
rect.left = 8;
|
||||||
rect.right = rect.left + 170;
|
rect.right = rect.left + 170;
|
||||||
rect.bottom = rect.top + 13;
|
rect.bottom = rect.top + 13;
|
||||||
|
|
||||||
@@ -704,7 +704,7 @@ TFilePanel::Init(const BMessage *)
|
|||||||
fButtonText = "Open";
|
fButtonText = "Open";
|
||||||
|
|
||||||
rect = windRect;
|
rect = windRect;
|
||||||
rect.OffsetTo(10, fMenuBar->Bounds().Height() * 2 + 16);
|
rect.OffsetTo(10, fDirMenuField->Frame().bottom + 10);
|
||||||
rect.bottom = windRect.bottom - 60;
|
rect.bottom = windRect.bottom - 60;
|
||||||
rect.right -= B_V_SCROLL_BAR_WIDTH + 20;
|
rect.right -= B_V_SCROLL_BAR_WIDTH + 20;
|
||||||
|
|
||||||
@@ -725,6 +725,8 @@ TFilePanel::Init(const BMessage *)
|
|||||||
PoseView()->SetSelectionHandler(this);
|
PoseView()->SetSelectionHandler(this);
|
||||||
PoseView()->SetSelectionChangedHook(true);
|
PoseView()->SetSelectionChangedHook(true);
|
||||||
PoseView()->DisableSaveLocation();
|
PoseView()->DisableSaveLocation();
|
||||||
|
PoseView()->VScrollBar()->MoveBy(0, -1);
|
||||||
|
PoseView()->VScrollBar()->ResizeBy(0, 1);
|
||||||
|
|
||||||
|
|
||||||
AddShortcut('W', B_COMMAND_KEY, new BMessage(kCancelButton));
|
AddShortcut('W', B_COMMAND_KEY, new BMessage(kCancelButton));
|
||||||
@@ -780,7 +782,7 @@ TFilePanel::Init(const BMessage *)
|
|||||||
|
|
||||||
SetTitle(title.String());
|
SetTitle(title.String());
|
||||||
|
|
||||||
SetSizeLimits(360, 10000, 200, 10000);
|
SetSizeLimits(370, 10000, 200, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -189,8 +189,9 @@ class BPoseView : public BView {
|
|||||||
virtual void UpdateScrollRange();
|
virtual void UpdateScrollRange();
|
||||||
virtual void SetScrollBarsTo(BPoint);
|
virtual void SetScrollBarsTo(BPoint);
|
||||||
virtual void AddScrollBars();
|
virtual void AddScrollBars();
|
||||||
BHScrollBar *HScrollBar() const;
|
BHScrollBar* HScrollBar() const;
|
||||||
BScrollBar *VScrollBar() const ;
|
BScrollBar* VScrollBar() const ;
|
||||||
|
BCountView* CountView() const;
|
||||||
void DisableScrollBars();
|
void DisableScrollBars();
|
||||||
void EnableScrollBars();
|
void EnableScrollBars();
|
||||||
|
|
||||||
@@ -786,6 +787,12 @@ BPoseView::VScrollBar() const
|
|||||||
return fVScrollBar;
|
return fVScrollBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline BCountView*
|
||||||
|
BPoseView::CountView() const
|
||||||
|
{
|
||||||
|
return fCountView;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
BPoseView::StateNeedsSaving()
|
BPoseView::StateNeedsSaving()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user