Covert Tracker Find window to use ControlLook arrows
Also fix a few style issues and make the MiniMenu control have a nice keyboard focus border.
This commit is contained in:
@@ -34,6 +34,7 @@ All rights reserved.
|
|||||||
|
|
||||||
#include "DialogPane.h"
|
#include "DialogPane.h"
|
||||||
|
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <LayoutUtils.h>
|
#include <LayoutUtils.h>
|
||||||
|
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
@@ -73,7 +74,8 @@ ViewList::AddAll(BView* toParent)
|
|||||||
|
|
||||||
DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, int32 initialMode,
|
DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, int32 initialMode,
|
||||||
const char* name, uint32 followFlags, uint32 flags)
|
const char* name, uint32 followFlags, uint32 flags)
|
||||||
: BView(FrameForMode(initialMode, mode1Frame, mode2Frame, mode2Frame),
|
:
|
||||||
|
BView(FrameForMode(initialMode, mode1Frame, mode2Frame, mode2Frame),
|
||||||
name, followFlags, flags),
|
name, followFlags, flags),
|
||||||
fMode(initialMode),
|
fMode(initialMode),
|
||||||
fMode1Frame(mode1Frame),
|
fMode1Frame(mode1Frame),
|
||||||
@@ -495,103 +497,29 @@ PaneSwitch::Track(BPoint point, uint32)
|
|||||||
void
|
void
|
||||||
PaneSwitch::DrawInState(PaneSwitch::State state)
|
PaneSwitch::DrawInState(PaneSwitch::State state)
|
||||||
{
|
{
|
||||||
BRect rect(0, 0, 10, 10);
|
BRect rect(0, 0, 12, 12);
|
||||||
|
rect.OffsetBy(-1, -1);
|
||||||
|
|
||||||
rgb_color outlineColor = {0, 0, 0, 255};
|
rgb_color arrowColor = state == kPressed ? kHighlightColor : kNormalColor;
|
||||||
rgb_color middleColor = state == kPressed ? kHighlightColor : kNormalColor;
|
int32 arrowDirection = BControlLook::B_RIGHT_ARROW;
|
||||||
|
float tint = IsEnabled() && Window()->IsActive() ? B_DARKEN_3_TINT
|
||||||
SetDrawingMode(B_OP_COPY);
|
: B_DARKEN_1_TINT;
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case kCollapsed:
|
case kCollapsed:
|
||||||
BeginLineArray(6);
|
arrowDirection = BControlLook::B_RIGHT_ARROW;
|
||||||
|
|
||||||
if (fLeftAligned) {
|
|
||||||
AddLine(BPoint(rect.left + 3, rect.top + 1),
|
|
||||||
BPoint(rect.left + 3, rect.bottom - 1), outlineColor);
|
|
||||||
AddLine(BPoint(rect.left + 3, rect.top + 1),
|
|
||||||
BPoint(rect.left + 7, rect.top + 5), outlineColor);
|
|
||||||
AddLine(BPoint(rect.left + 7, rect.top + 5),
|
|
||||||
BPoint(rect.left + 3, rect.bottom - 1), outlineColor);
|
|
||||||
|
|
||||||
AddLine(BPoint(rect.left + 4, rect.top + 3),
|
|
||||||
BPoint(rect.left + 4, rect.bottom - 3), middleColor);
|
|
||||||
AddLine(BPoint(rect.left + 5, rect.top + 4),
|
|
||||||
BPoint(rect.left + 5, rect.bottom - 4), middleColor);
|
|
||||||
AddLine(BPoint(rect.left + 5, rect.top + 5),
|
|
||||||
BPoint(rect.left + 6, rect.top + 5), middleColor);
|
|
||||||
} else {
|
|
||||||
AddLine(BPoint(rect.right - 3, rect.top + 1),
|
|
||||||
BPoint(rect.right - 3, rect.bottom - 1), outlineColor);
|
|
||||||
AddLine(BPoint(rect.right - 3, rect.top + 1),
|
|
||||||
BPoint(rect.right - 7, rect.top + 5), outlineColor);
|
|
||||||
AddLine(BPoint(rect.right - 7, rect.top + 5),
|
|
||||||
BPoint(rect.right - 3, rect.bottom - 1), outlineColor);
|
|
||||||
|
|
||||||
AddLine(BPoint(rect.right - 4, rect.top + 3),
|
|
||||||
BPoint(rect.right - 4, rect.bottom - 3), middleColor);
|
|
||||||
AddLine(BPoint(rect.right - 5, rect.top + 4),
|
|
||||||
BPoint(rect.right - 5, rect.bottom - 4), middleColor);
|
|
||||||
AddLine(BPoint(rect.right - 5, rect.top + 5),
|
|
||||||
BPoint(rect.right - 6, rect.top + 5), middleColor);
|
|
||||||
}
|
|
||||||
EndLineArray();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPressed:
|
case kPressed:
|
||||||
BeginLineArray(7);
|
arrowDirection = BControlLook::B_RIGHT_DOWN_ARROW;
|
||||||
if (fLeftAligned) {
|
|
||||||
AddLine(BPoint(rect.left + 1, rect.top + 7),
|
|
||||||
BPoint(rect.left + 7, rect.top + 7), outlineColor);
|
|
||||||
AddLine(BPoint(rect.left + 7, rect.top + 1),
|
|
||||||
BPoint(rect.left + 7, rect.top + 7), outlineColor);
|
|
||||||
AddLine(BPoint(rect.left + 1, rect.top + 7),
|
|
||||||
BPoint(rect.left + 7, rect.top + 1), outlineColor);
|
|
||||||
|
|
||||||
AddLine(BPoint(rect.left + 3, rect.top + 6),
|
|
||||||
BPoint(rect.left + 6, rect.top + 6), middleColor);
|
|
||||||
AddLine(BPoint(rect.left + 4, rect.top + 5),
|
|
||||||
BPoint(rect.left + 6, rect.top + 5), middleColor);
|
|
||||||
AddLine(BPoint(rect.left + 5, rect.top + 4),
|
|
||||||
BPoint(rect.left + 6, rect.top + 4), middleColor);
|
|
||||||
AddLine(BPoint(rect.left + 6, rect.top + 3),
|
|
||||||
BPoint(rect.left + 6, rect.top + 4), middleColor);
|
|
||||||
} else {
|
|
||||||
AddLine(BPoint(rect.right - 1, rect.top + 7),
|
|
||||||
BPoint(rect.right - 7, rect.top + 7), outlineColor);
|
|
||||||
AddLine(BPoint(rect.right - 7, rect.top + 1),
|
|
||||||
BPoint(rect.right - 7, rect.top + 7), outlineColor);
|
|
||||||
AddLine(BPoint(rect.right - 1, rect.top + 7),
|
|
||||||
BPoint(rect.right - 7, rect.top + 1), outlineColor);
|
|
||||||
|
|
||||||
AddLine(BPoint(rect.right - 3, rect.top + 6),
|
|
||||||
BPoint(rect.right - 6, rect.top + 6), middleColor);
|
|
||||||
AddLine(BPoint(rect.right - 4, rect.top + 5),
|
|
||||||
BPoint(rect.right - 6, rect.top + 5), middleColor);
|
|
||||||
AddLine(BPoint(rect.right - 5, rect.top + 4),
|
|
||||||
BPoint(rect.right - 6, rect.top + 4), middleColor);
|
|
||||||
AddLine(BPoint(rect.right - 6, rect.top + 3),
|
|
||||||
BPoint(rect.right - 6, rect.top + 4), middleColor);
|
|
||||||
}
|
|
||||||
EndLineArray();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kExpanded:
|
case kExpanded:
|
||||||
BeginLineArray(6);
|
arrowDirection = BControlLook::B_DOWN_ARROW;
|
||||||
AddLine(BPoint(rect.left + 1, rect.top + 3),
|
|
||||||
BPoint(rect.right - 1, rect.top + 3), outlineColor);
|
|
||||||
AddLine(BPoint(rect.left + 1, rect.top + 3),
|
|
||||||
BPoint(rect.left + 5, rect.top + 7), outlineColor);
|
|
||||||
AddLine(BPoint(rect.left + 5, rect.top + 7),
|
|
||||||
BPoint(rect.right - 1, rect.top + 3), outlineColor);
|
|
||||||
|
|
||||||
AddLine(BPoint(rect.left + 3, rect.top + 4),
|
|
||||||
BPoint(rect.right - 3, rect.top + 4), middleColor);
|
|
||||||
AddLine(BPoint(rect.left + 4, rect.top + 5),
|
|
||||||
BPoint(rect.right - 4, rect.top + 5), middleColor);
|
|
||||||
AddLine(BPoint(rect.left + 5, rect.top + 5),
|
|
||||||
BPoint(rect.left + 5, rect.top + 6), middleColor);
|
|
||||||
EndLineArray();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetDrawingMode(B_OP_COPY);
|
||||||
|
be_control_look->DrawArrowShape(this, rect, rect, arrowColor,
|
||||||
|
arrowDirection, 0, tint);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -694,7 +694,7 @@ FindPanel::FindPanel(BRect frame, BFile* node, FindWindow* parent,
|
|||||||
|
|
||||||
BMessenger self(this);
|
BMessenger self(this);
|
||||||
fRecentQueries = new BPopUpMenu("RecentQueries");
|
fRecentQueries = new BPopUpMenu("RecentQueries");
|
||||||
FindPanel::AddRecentQueries(fRecentQueries, true, &self,
|
FindPanel::AddRecentQueries(fRecentQueries, true, &self,
|
||||||
kSwitchToQueryTemplate);
|
kSwitchToQueryTemplate);
|
||||||
|
|
||||||
AddChild(new MiniMenuField(rect, "RecentQueries", fRecentQueries));
|
AddChild(new MiniMenuField(rect, "RecentQueries", fRecentQueries));
|
||||||
@@ -781,9 +781,10 @@ FindPanel::FindPanel(BRect frame, BFile* node, FindWindow* parent,
|
|||||||
|
|
||||||
rect = expandedBounds;
|
rect = expandedBounds;
|
||||||
rect.right = rect.left + 200;
|
rect.right = rect.left + 200;
|
||||||
rect.bottom = rect.top + 20;;
|
rect.bottom = rect.top + 20;
|
||||||
fQueryName = new BTextControl(rect, "queryName",
|
fQueryName = new BTextControl(rect, "queryName",
|
||||||
B_TRANSLATE("Query name:"), "", 0);
|
B_TRANSLATE("Query name:"), "", B_FOLLOW_NONE,
|
||||||
|
B_NAVIGABLE | B_NAVIGABLE_JUMP);
|
||||||
fQueryName->SetDivider(fQueryName->StringWidth(fQueryName->Label()) + 5);
|
fQueryName->SetDivider(fQueryName->StringWidth(fQueryName->Label()) + 5);
|
||||||
fMoreOptionsPane->AddItem(fQueryName, 1);
|
fMoreOptionsPane->AddItem(fQueryName, 1);
|
||||||
FillCurrentQueryName(fQueryName, parent);
|
FillCurrentQueryName(fQueryName, parent);
|
||||||
@@ -1886,7 +1887,6 @@ FindPanel::AddRecentQueries(BMenu* menu, bool addSaveAsItem,
|
|||||||
for (int32 index = 0; index < count; index++)
|
for (int32 index = 0; index < count; index++)
|
||||||
AddOneRecentItem(&recentQueries.ItemAt(index)->first, ¶ms);
|
AddOneRecentItem(&recentQueries.ItemAt(index)->first, ¶ms);
|
||||||
|
|
||||||
|
|
||||||
if (addSaveAsItem) {
|
if (addSaveAsItem) {
|
||||||
// add a Save as template item
|
// add a Save as template item
|
||||||
if (count || templates.CountItems())
|
if (count || templates.CountItems())
|
||||||
@@ -1894,7 +1894,7 @@ FindPanel::AddRecentQueries(BMenu* menu, bool addSaveAsItem,
|
|||||||
|
|
||||||
BMessage* message = new BMessage(kRunSaveAsTemplatePanel);
|
BMessage* message = new BMessage(kRunSaveAsTemplatePanel);
|
||||||
BMenuItem* item = new BMenuItem(
|
BMenuItem* item = new BMenuItem(
|
||||||
B_TRANSLATE("Save Query as template"B_UTF8_ELLIPSIS), message);
|
B_TRANSLATE("Save Query as template" B_UTF8_ELLIPSIS), message);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2420,7 +2420,8 @@ FindPanel::ShowOrHideMimeTypeMenu()
|
|||||||
|
|
||||||
|
|
||||||
TAttrView::TAttrView(BRect frame, int32 index)
|
TAttrView::TAttrView(BRect frame, int32 index)
|
||||||
: BView(frame, "AttrView", B_FOLLOW_NONE, B_WILL_DRAW)
|
:
|
||||||
|
BView(frame, "AttrView", B_FOLLOW_NONE, B_WILL_DRAW)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
@@ -3059,9 +3060,10 @@ DeleteTransientQueriesTask::StartUpTransientQueryCleaner()
|
|||||||
|
|
||||||
RecentFindItemsMenu::RecentFindItemsMenu(const char* title,
|
RecentFindItemsMenu::RecentFindItemsMenu(const char* title,
|
||||||
const BMessenger* target, uint32 what)
|
const BMessenger* target, uint32 what)
|
||||||
: BMenu(title, B_ITEMS_IN_COLUMN),
|
:
|
||||||
fTarget(*target),
|
BMenu(title, B_ITEMS_IN_COLUMN),
|
||||||
fWhat(what)
|
fTarget(*target),
|
||||||
|
fWhat(what)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3095,8 +3097,9 @@ TrackerBuildRecentFindItemsMenu(const char* title)
|
|||||||
DraggableQueryIcon::DraggableQueryIcon(BRect frame, const char* name,
|
DraggableQueryIcon::DraggableQueryIcon(BRect frame, const char* name,
|
||||||
const BMessage* message, BMessenger messenger, uint32 resizeFlags,
|
const BMessage* message, BMessenger messenger, uint32 resizeFlags,
|
||||||
uint32 flags)
|
uint32 flags)
|
||||||
: DraggableIcon(frame, name, B_QUERY_MIMETYPE, B_LARGE_ICON,
|
:
|
||||||
message, messenger, resizeFlags, flags)
|
DraggableIcon(frame, name, B_QUERY_MIMETYPE, B_LARGE_ICON,
|
||||||
|
message, messenger, resizeFlags, flags)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3329,4 +3332,3 @@ MostUsedNames::UpdateList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ class FindPanel : public BView {
|
|||||||
|
|
||||||
void AddMimeTypesToMenu();
|
void AddMimeTypesToMenu();
|
||||||
// populates the type menu
|
// populates the type menu
|
||||||
static bool AddOneMimeTypeToMenu(const ShortMimeInfo*, void*);
|
static bool AddOneMimeTypeToMenu(const ShortMimeInfo*, void* castToMenu);
|
||||||
|
|
||||||
void AddVolumes(BMenu*);
|
void AddVolumes(BMenu*);
|
||||||
// populates the volume menu
|
// populates the volume menu
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ All rights reserved.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <ControlLook.h>
|
||||||
|
#include <InterfaceDefs.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
@@ -96,10 +98,18 @@ void
|
|||||||
MiniMenuField::Draw(BRect)
|
MiniMenuField::Draw(BRect)
|
||||||
{
|
{
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
bounds.InsetBy(2, 2);
|
bounds.OffsetBy(1, 2);
|
||||||
|
bounds.right--;
|
||||||
|
bounds.bottom -= 2;
|
||||||
|
if (IsFocus()) {
|
||||||
|
// draw the focus indicator border
|
||||||
|
SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
|
||||||
|
StrokeRect(bounds);
|
||||||
|
}
|
||||||
|
bounds.right--;
|
||||||
|
bounds.bottom--;
|
||||||
BRect rect(bounds);
|
BRect rect(bounds);
|
||||||
rect.right--;
|
rect.InsetBy(1, 1);
|
||||||
rect.bottom--;
|
|
||||||
|
|
||||||
rgb_color darkest = tint_color(kBlack, 0.6f);
|
rgb_color darkest = tint_color(kBlack, 0.6f);
|
||||||
rgb_color dark = tint_color(kBlack, 0.4f);
|
rgb_color dark = tint_color(kBlack, 0.4f);
|
||||||
@@ -121,43 +131,17 @@ MiniMenuField::Draw(BRect)
|
|||||||
AddLine(rect.RightBottom(), rect.LeftBottom(), medium);
|
AddLine(rect.RightBottom(), rect.LeftBottom(), medium);
|
||||||
AddLine(rect.LeftBottom(), rect.LeftTop(), light);
|
AddLine(rect.LeftBottom(), rect.LeftTop(), light);
|
||||||
AddLine(rect.LeftTop(), rect.RightTop(), light);
|
AddLine(rect.LeftTop(), rect.RightTop(), light);
|
||||||
|
|
||||||
EndLineArray();
|
EndLineArray();
|
||||||
|
|
||||||
// draw triangle
|
// draw triangle
|
||||||
rect = BRect(5, 5, 15, 15);
|
rect = BRect(0, 0, 12, 12);
|
||||||
const rgb_color outlineColor = kBlack;
|
rect.OffsetBy(4, 4);
|
||||||
const rgb_color middleColor = {150, 150, 150, 255};
|
const rgb_color arrowColor = {150, 150, 150, 255};
|
||||||
|
float tint = Window()->IsActive() ? B_DARKEN_3_TINT : B_DARKEN_1_TINT;
|
||||||
|
|
||||||
BeginLineArray(5);
|
SetDrawingMode(B_OP_COPY);
|
||||||
AddLine(BPoint(rect.left + 3, rect.top + 1),
|
be_control_look->DrawArrowShape(this, rect, rect, arrowColor,
|
||||||
BPoint(rect.left + 3, rect.top + 7), outlineColor);
|
BControlLook::B_RIGHT_ARROW, 0, tint);
|
||||||
AddLine(BPoint(rect.left + 3, rect.top + 1),
|
|
||||||
BPoint(rect.left + 6, rect.top + 4), outlineColor);
|
|
||||||
AddLine(BPoint(rect.left + 6, rect.top + 4),
|
|
||||||
BPoint(rect.left + 3, rect.top + 7), outlineColor);
|
|
||||||
|
|
||||||
AddLine(BPoint(rect.left + 4, rect.top + 3),
|
|
||||||
BPoint(rect.left + 4, rect.top + 5), middleColor);
|
|
||||||
AddLine(BPoint(rect.left + 5, rect.top + 4),
|
|
||||||
BPoint(rect.left + 5, rect.top + 4), middleColor);
|
|
||||||
EndLineArray();
|
|
||||||
|
|
||||||
// draw focus if focused, else erase focus
|
|
||||||
bounds = Bounds();
|
|
||||||
bool focused = IsFocus() && Window()->IsActive();
|
|
||||||
rgb_color markColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
|
|
||||||
rgb_color viewColor = ViewColor();
|
|
||||||
BeginLineArray(4);
|
|
||||||
AddLine(BPoint(bounds.left, bounds.top),
|
|
||||||
BPoint(bounds.right, bounds.top), focused ? markColor : viewColor);
|
|
||||||
AddLine(BPoint(bounds.right, bounds.top),
|
|
||||||
BPoint(bounds.right, bounds.bottom), focused ? markColor : viewColor);
|
|
||||||
AddLine(BPoint(bounds.right, bounds.bottom),
|
|
||||||
BPoint(bounds.left, bounds.bottom), focused ? markColor : viewColor);
|
|
||||||
AddLine(BPoint(bounds.left, bounds.bottom),
|
|
||||||
BPoint(bounds.left, bounds.top), focused ? markColor : viewColor);
|
|
||||||
EndLineArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user