102be5353SAxel Dörfler /* 202be5353SAxel Dörfler Open Tracker License 302be5353SAxel Dörfler 402be5353SAxel Dörfler Terms and Conditions 502be5353SAxel Dörfler 602be5353SAxel Dörfler Copyright (c) 1991-2000, Be Incorporated. All rights reserved. 702be5353SAxel Dörfler 802be5353SAxel Dörfler Permission is hereby granted, free of charge, to any person obtaining a copy of 902be5353SAxel Dörfler this software and associated documentation files (the "Software"), to deal in 1002be5353SAxel Dörfler the Software without restriction, including without limitation the rights to 1102be5353SAxel Dörfler use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 1202be5353SAxel Dörfler of the Software, and to permit persons to whom the Software is furnished to do 1302be5353SAxel Dörfler so, subject to the following conditions: 1402be5353SAxel Dörfler 1502be5353SAxel Dörfler The above copyright notice and this permission notice applies to all licensees 1602be5353SAxel Dörfler and shall be included in all copies or substantial portions of the Software. 1702be5353SAxel Dörfler 1802be5353SAxel Dörfler THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1902be5353SAxel Dörfler IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY, 2002be5353SAxel Dörfler FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 2102be5353SAxel Dörfler BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 2202be5353SAxel Dörfler AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION 2302be5353SAxel Dörfler WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2402be5353SAxel Dörfler 2502be5353SAxel Dörfler Except as contained in this notice, the name of Be Incorporated shall not be 2602be5353SAxel Dörfler used in advertising or otherwise to promote the sale, use or other dealings in 2702be5353SAxel Dörfler this Software without prior written authorization from Be Incorporated. 2802be5353SAxel Dörfler 2902be5353SAxel Dörfler Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks 3002be5353SAxel Dörfler of Be Incorporated in the United States and other countries. Other brand product 3102be5353SAxel Dörfler names are registered trademarks or trademarks of their respective holders. 3202be5353SAxel Dörfler All rights reserved. 3302be5353SAxel Dörfler */ 3402be5353SAxel Dörfler 3502be5353SAxel Dörfler #include "Window.h" 3602be5353SAxel Dörfler #include "DialogPane.h" 3702be5353SAxel Dörfler #include "Thread.h" 3802be5353SAxel Dörfler #include "Utilities.h" 3902be5353SAxel Dörfler 4081202ff5SAxel Dörfler 4181202ff5SAxel Dörfler const uint32 kValueChanged = 'swch'; 4281202ff5SAxel Dörfler 4381202ff5SAxel Dörfler const rgb_color kNormalColor = {150, 150, 150, 255}; 4481202ff5SAxel Dörfler const rgb_color kHighlightColor = {100, 100, 0, 255}; 4581202ff5SAxel Dörfler 4602be5353SAxel Dörfler 4702be5353SAxel Dörfler static void 4802be5353SAxel Dörfler AddSelf(BView *self, BView *to) 4902be5353SAxel Dörfler { 5002be5353SAxel Dörfler to->AddChild(self); 5102be5353SAxel Dörfler } 5202be5353SAxel Dörfler 5381202ff5SAxel Dörfler 5481202ff5SAxel Dörfler void 5581202ff5SAxel Dörfler ViewList::RemoveAll(BView *) 5681202ff5SAxel Dörfler { 5781202ff5SAxel Dörfler EachListItemIgnoreResult(this, &BView::RemoveSelf); 5881202ff5SAxel Dörfler } 5981202ff5SAxel Dörfler 6081202ff5SAxel Dörfler 6102be5353SAxel Dörfler void 6202be5353SAxel Dörfler ViewList::AddAll(BView *toParent) 6302be5353SAxel Dörfler { 6402be5353SAxel Dörfler EachListItem(this, &AddSelf, toParent); 6502be5353SAxel Dörfler } 6602be5353SAxel Dörfler 6702be5353SAxel Dörfler 6881202ff5SAxel Dörfler // #pragma mark - 6981202ff5SAxel Dörfler 7081202ff5SAxel Dörfler 7102be5353SAxel Dörfler DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, int32 initialMode, 7202be5353SAxel Dörfler const char *name, uint32 followFlags, uint32 flags) 7302be5353SAxel Dörfler : BView(FrameForMode(initialMode, mode1Frame, mode2Frame, mode2Frame), 7402be5353SAxel Dörfler name, followFlags, flags), 7581202ff5SAxel Dörfler fMode(initialMode), 7602be5353SAxel Dörfler fMode1Frame(mode1Frame), 7702be5353SAxel Dörfler fMode2Frame(mode2Frame), 7802be5353SAxel Dörfler fMode3Frame(mode2Frame) 7902be5353SAxel Dörfler { 80*4f459891SAxel Dörfler SetMode(fMode, true); 8102be5353SAxel Dörfler } 8202be5353SAxel Dörfler 8302be5353SAxel Dörfler 8402be5353SAxel Dörfler DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, BRect mode3Frame, 8502be5353SAxel Dörfler int32 initialMode, const char *name, uint32 followFlags, uint32 flags) 8602be5353SAxel Dörfler : BView(FrameForMode(initialMode, mode1Frame, mode2Frame, mode3Frame), 8702be5353SAxel Dörfler name, followFlags, flags), 8881202ff5SAxel Dörfler fMode(initialMode), 8902be5353SAxel Dörfler fMode1Frame(mode1Frame), 9002be5353SAxel Dörfler fMode2Frame(mode2Frame), 9102be5353SAxel Dörfler fMode3Frame(mode3Frame) 9202be5353SAxel Dörfler { 93*4f459891SAxel Dörfler SetMode(fMode, true); 9402be5353SAxel Dörfler } 9502be5353SAxel Dörfler 9602be5353SAxel Dörfler 9702be5353SAxel Dörfler DialogPane::~DialogPane() 9802be5353SAxel Dörfler { 9902be5353SAxel Dörfler fMode3Items.RemoveAll(this); 10002be5353SAxel Dörfler fMode2Items.RemoveAll(this); 10102be5353SAxel Dörfler } 10202be5353SAxel Dörfler 10302be5353SAxel Dörfler 10402be5353SAxel Dörfler void 10502be5353SAxel Dörfler DialogPane::SetMode(int32 mode, bool initialSetup) 10602be5353SAxel Dörfler { 10702be5353SAxel Dörfler ASSERT(mode < 3 && mode >= 0); 10802be5353SAxel Dörfler 10902be5353SAxel Dörfler if (!initialSetup && mode == fMode) 11002be5353SAxel Dörfler return; 11102be5353SAxel Dörfler 11202be5353SAxel Dörfler int32 oldMode = fMode; 11302be5353SAxel Dörfler fMode = mode; 11402be5353SAxel Dörfler 11502be5353SAxel Dörfler bool followBottom = (ResizingMode() & B_FOLLOW_BOTTOM) != 0; 11602be5353SAxel Dörfler // if we are follow bottom, we will move ourselves, need to place us back 11702be5353SAxel Dörfler float bottomOffset = 0; 11881202ff5SAxel Dörfler if (followBottom && Window() != NULL) 11902be5353SAxel Dörfler bottomOffset = Window()->Bounds().bottom - Frame().bottom; 12002be5353SAxel Dörfler 12102be5353SAxel Dörfler BRect newBounds(BoundsForMode(fMode)); 12202be5353SAxel Dörfler if (!initialSetup) 12302be5353SAxel Dörfler ResizeParentWindow(fMode, oldMode); 12402be5353SAxel Dörfler 12502be5353SAxel Dörfler ResizeTo(newBounds.Width(), newBounds.Height()); 12602be5353SAxel Dörfler 12702be5353SAxel Dörfler float delta = 0; 12881202ff5SAxel Dörfler if (followBottom && Window() != NULL) 12902be5353SAxel Dörfler delta = (Window()->Bounds().bottom - Frame().bottom) - bottomOffset; 13002be5353SAxel Dörfler 13102be5353SAxel Dörfler if (delta != 0) { 13202be5353SAxel Dörfler MoveBy(0, delta); 13302be5353SAxel Dörfler if (fLatch && (fLatch->ResizingMode() & B_FOLLOW_BOTTOM)) 13402be5353SAxel Dörfler fLatch->MoveBy(0, delta); 13502be5353SAxel Dörfler } 13602be5353SAxel Dörfler 13702be5353SAxel Dörfler switch (fMode) { 13802be5353SAxel Dörfler case 0: 13902be5353SAxel Dörfler { 14002be5353SAxel Dörfler if (oldMode > 1) 14102be5353SAxel Dörfler fMode3Items.RemoveAll(this); 14202be5353SAxel Dörfler if (oldMode > 0) 14302be5353SAxel Dörfler fMode2Items.RemoveAll(this); 14402be5353SAxel Dörfler 14502be5353SAxel Dörfler BView *separator = FindView("separatorLine"); 14602be5353SAxel Dörfler if (separator) { 14702be5353SAxel Dörfler BRect frame(separator->Frame()); 14802be5353SAxel Dörfler frame.InsetBy(-1, -1); 14902be5353SAxel Dörfler RemoveChild(separator); 15002be5353SAxel Dörfler Invalidate(); 15102be5353SAxel Dörfler } 15202be5353SAxel Dörfler 15302be5353SAxel Dörfler AddChild(new SeparatorLine(BPoint(newBounds.left, newBounds.top 15402be5353SAxel Dörfler + newBounds.Height() / 2), newBounds.Width(), false, 15502be5353SAxel Dörfler "separatorLine")); 15602be5353SAxel Dörfler break; 15781202ff5SAxel Dörfler } 15802be5353SAxel Dörfler case 1: 15902be5353SAxel Dörfler { 16002be5353SAxel Dörfler if (oldMode > 1) 16102be5353SAxel Dörfler fMode3Items.RemoveAll(this); 16202be5353SAxel Dörfler else 16302be5353SAxel Dörfler fMode2Items.AddAll(this); 16402be5353SAxel Dörfler 16502be5353SAxel Dörfler BView *separator = FindView("separatorLine"); 16602be5353SAxel Dörfler if (separator) { 16702be5353SAxel Dörfler BRect frame(separator->Frame()); 16802be5353SAxel Dörfler frame.InsetBy(-1, -1); 16902be5353SAxel Dörfler RemoveChild(separator); 17002be5353SAxel Dörfler Invalidate(); 17102be5353SAxel Dörfler } 17202be5353SAxel Dörfler break; 17381202ff5SAxel Dörfler } 17402be5353SAxel Dörfler case 2: 17502be5353SAxel Dörfler { 17602be5353SAxel Dörfler fMode3Items.AddAll(this); 17702be5353SAxel Dörfler if (oldMode < 1) 17802be5353SAxel Dörfler fMode2Items.AddAll(this); 17902be5353SAxel Dörfler 18002be5353SAxel Dörfler BView *separator = FindView("separatorLine"); 18102be5353SAxel Dörfler if (separator) { 18202be5353SAxel Dörfler BRect frame(separator->Frame()); 18302be5353SAxel Dörfler frame.InsetBy(-1, -1); 18402be5353SAxel Dörfler RemoveChild(separator); 18502be5353SAxel Dörfler Invalidate(); 18602be5353SAxel Dörfler } 18702be5353SAxel Dörfler break; 18802be5353SAxel Dörfler } 18902be5353SAxel Dörfler } 19081202ff5SAxel Dörfler } 19181202ff5SAxel Dörfler 19202be5353SAxel Dörfler 19302be5353SAxel Dörfler void 19402be5353SAxel Dörfler DialogPane::AttachedToWindow() 19502be5353SAxel Dörfler { 19602be5353SAxel Dörfler BView *parent = Parent(); 19702be5353SAxel Dörfler if (parent) { 19802be5353SAxel Dörfler SetViewColor(parent->ViewColor()); 19902be5353SAxel Dörfler SetLowColor(parent->LowColor()); 20002be5353SAxel Dörfler } 20102be5353SAxel Dörfler } 20202be5353SAxel Dörfler 20381202ff5SAxel Dörfler 20402be5353SAxel Dörfler void 20502be5353SAxel Dörfler DialogPane::ResizeParentWindow(int32 from, int32 to) 20602be5353SAxel Dörfler { 20702be5353SAxel Dörfler if (!Window()) 20802be5353SAxel Dörfler return; 20902be5353SAxel Dörfler 21002be5353SAxel Dörfler BRect oldBounds = BoundsForMode(from); 21102be5353SAxel Dörfler BRect newBounds = BoundsForMode(to); 21202be5353SAxel Dörfler 21302be5353SAxel Dörfler BPoint by = oldBounds.RightBottom() - newBounds.RightBottom(); 21402be5353SAxel Dörfler if (by != BPoint(0, 0)) 21502be5353SAxel Dörfler Window()->ResizeBy(by.x, by.y); 21602be5353SAxel Dörfler } 21702be5353SAxel Dörfler 21881202ff5SAxel Dörfler 21902be5353SAxel Dörfler void 22002be5353SAxel Dörfler DialogPane::AddItem(BView *view, int32 toMode) 22102be5353SAxel Dörfler { 22202be5353SAxel Dörfler if (toMode == 1) 22302be5353SAxel Dörfler fMode2Items.AddItem(view); 22402be5353SAxel Dörfler else if (toMode == 2) 22502be5353SAxel Dörfler fMode3Items.AddItem(view); 22602be5353SAxel Dörfler if (fMode >= toMode) 22702be5353SAxel Dörfler AddChild(view); 22802be5353SAxel Dörfler } 22902be5353SAxel Dörfler 23081202ff5SAxel Dörfler 23102be5353SAxel Dörfler BRect 23202be5353SAxel Dörfler DialogPane::FrameForMode(int32 mode) 23302be5353SAxel Dörfler { 23402be5353SAxel Dörfler switch (mode) { 23502be5353SAxel Dörfler case 0: 23602be5353SAxel Dörfler return fMode1Frame; 23702be5353SAxel Dörfler case 1: 23802be5353SAxel Dörfler return fMode2Frame; 23902be5353SAxel Dörfler case 2: 24002be5353SAxel Dörfler return fMode3Frame; 24102be5353SAxel Dörfler } 24202be5353SAxel Dörfler return fMode1Frame; 24302be5353SAxel Dörfler } 24402be5353SAxel Dörfler 24581202ff5SAxel Dörfler 24602be5353SAxel Dörfler BRect 24702be5353SAxel Dörfler DialogPane::BoundsForMode(int32 mode) 24802be5353SAxel Dörfler { 24902be5353SAxel Dörfler BRect result; 25002be5353SAxel Dörfler switch (mode) { 25102be5353SAxel Dörfler case 0: 25202be5353SAxel Dörfler result = fMode1Frame; 25302be5353SAxel Dörfler break; 25402be5353SAxel Dörfler case 1: 25502be5353SAxel Dörfler result = fMode2Frame; 25602be5353SAxel Dörfler break; 25702be5353SAxel Dörfler case 2: 25802be5353SAxel Dörfler result = fMode3Frame; 25902be5353SAxel Dörfler break; 26002be5353SAxel Dörfler } 26102be5353SAxel Dörfler result.OffsetTo(0, 0); 26202be5353SAxel Dörfler return result; 26302be5353SAxel Dörfler } 26402be5353SAxel Dörfler 26581202ff5SAxel Dörfler 26602be5353SAxel Dörfler BRect 26702be5353SAxel Dörfler DialogPane::FrameForMode(int32 mode, BRect mode1Frame, BRect mode2Frame, 26802be5353SAxel Dörfler BRect mode3Frame) 26902be5353SAxel Dörfler { 27002be5353SAxel Dörfler switch (mode) { 27102be5353SAxel Dörfler case 0: 27202be5353SAxel Dörfler return mode1Frame; 27302be5353SAxel Dörfler case 1: 27402be5353SAxel Dörfler return mode2Frame; 27502be5353SAxel Dörfler case 2: 27602be5353SAxel Dörfler return mode3Frame; 27702be5353SAxel Dörfler } 27802be5353SAxel Dörfler return mode1Frame; 27902be5353SAxel Dörfler } 28002be5353SAxel Dörfler 28102be5353SAxel Dörfler 28202be5353SAxel Dörfler void 28302be5353SAxel Dörfler DialogPane::SetSwitch(BControl *control) 28402be5353SAxel Dörfler { 28502be5353SAxel Dörfler fLatch = control; 28602be5353SAxel Dörfler control->SetMessage(new BMessage(kValueChanged)); 28702be5353SAxel Dörfler control->SetTarget(this); 28802be5353SAxel Dörfler } 28902be5353SAxel Dörfler 29081202ff5SAxel Dörfler 29102be5353SAxel Dörfler void 29202be5353SAxel Dörfler DialogPane::MessageReceived(BMessage *message) 29302be5353SAxel Dörfler { 29402be5353SAxel Dörfler if (message->what == kValueChanged) { 29502be5353SAxel Dörfler int32 value; 29602be5353SAxel Dörfler if (message->FindInt32("be:value", &value) == B_OK) 29702be5353SAxel Dörfler SetMode(value); 29802be5353SAxel Dörfler } else 29902be5353SAxel Dörfler _inherited::MessageReceived(message); 30002be5353SAxel Dörfler } 30102be5353SAxel Dörfler 30281202ff5SAxel Dörfler 30381202ff5SAxel Dörfler // #pragma mark - 30481202ff5SAxel Dörfler 30581202ff5SAxel Dörfler 30602be5353SAxel Dörfler PaneSwitch::PaneSwitch(BRect frame, const char *name, bool leftAligned, 30702be5353SAxel Dörfler uint32 resizeMask, uint32 flags) 30802be5353SAxel Dörfler : BControl(frame, name, "", 0, resizeMask, flags), 30902be5353SAxel Dörfler fLeftAligned(leftAligned), 31002be5353SAxel Dörfler fPressing(false) 31102be5353SAxel Dörfler { 31202be5353SAxel Dörfler } 31302be5353SAxel Dörfler 31481202ff5SAxel Dörfler 31502be5353SAxel Dörfler void 31602be5353SAxel Dörfler PaneSwitch::DoneTracking(BPoint point) 31702be5353SAxel Dörfler { 31802be5353SAxel Dörfler BRect bounds(Bounds()); 31902be5353SAxel Dörfler bounds.InsetBy(-3, -3); 32002be5353SAxel Dörfler 32102be5353SAxel Dörfler fPressing = false; 32202be5353SAxel Dörfler Invalidate(); 32302be5353SAxel Dörfler if (bounds.Contains(point)) { 32402be5353SAxel Dörfler SetValue(!Value()); 32502be5353SAxel Dörfler Invoke(); 32602be5353SAxel Dörfler } 32702be5353SAxel Dörfler } 32802be5353SAxel Dörfler 32981202ff5SAxel Dörfler 33002be5353SAxel Dörfler void 33102be5353SAxel Dörfler PaneSwitch::Track(BPoint point, uint32) 33202be5353SAxel Dörfler { 33302be5353SAxel Dörfler BRect bounds(Bounds()); 33402be5353SAxel Dörfler bounds.InsetBy(-3, -3); 33502be5353SAxel Dörfler 33602be5353SAxel Dörfler bool newPressing = bounds.Contains(point); 33702be5353SAxel Dörfler if (newPressing != fPressing) { 33802be5353SAxel Dörfler fPressing = newPressing; 33902be5353SAxel Dörfler Invalidate(); 34002be5353SAxel Dörfler } 34102be5353SAxel Dörfler } 34202be5353SAxel Dörfler 34302be5353SAxel Dörfler 34402be5353SAxel Dörfler void 34502be5353SAxel Dörfler PaneSwitch::MouseDown(BPoint) 34602be5353SAxel Dörfler { 34702be5353SAxel Dörfler if (!IsEnabled()) 34802be5353SAxel Dörfler return; 34902be5353SAxel Dörfler 35002be5353SAxel Dörfler fPressing = true; 35102be5353SAxel Dörfler MouseDownThread<PaneSwitch>::TrackMouse(this, &PaneSwitch::DoneTracking, 35202be5353SAxel Dörfler &PaneSwitch::Track); 35302be5353SAxel Dörfler Invalidate(); 35402be5353SAxel Dörfler } 35502be5353SAxel Dörfler 35602be5353SAxel Dörfler 35702be5353SAxel Dörfler void 35802be5353SAxel Dörfler PaneSwitch::Draw(BRect) 35902be5353SAxel Dörfler { 36002be5353SAxel Dörfler if (fPressing) 36102be5353SAxel Dörfler DrawInState(kPressed); 36202be5353SAxel Dörfler else if (Value()) 36302be5353SAxel Dörfler DrawInState(kExpanded); 36402be5353SAxel Dörfler else 36502be5353SAxel Dörfler DrawInState(kCollapsed); 36602be5353SAxel Dörfler 36702be5353SAxel Dörfler rgb_color markColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR); 36802be5353SAxel Dörfler 36902be5353SAxel Dörfler bool focused = IsFocus() && Window()->IsActive(); 37002be5353SAxel Dörfler BRect bounds(Bounds()); 37102be5353SAxel Dörfler BeginLineArray(2); 37202be5353SAxel Dörfler AddLine(BPoint(bounds.left + 2, bounds.bottom - 1), 37302be5353SAxel Dörfler BPoint(bounds.right - 2, bounds.bottom - 1), focused ? markColor : ViewColor()); 37402be5353SAxel Dörfler AddLine(BPoint(bounds.left + 2, bounds.bottom), 37502be5353SAxel Dörfler BPoint(bounds.right - 2, bounds.bottom), focused ? kWhite : ViewColor()); 37602be5353SAxel Dörfler EndLineArray(); 37702be5353SAxel Dörfler } 37802be5353SAxel Dörfler 37981202ff5SAxel Dörfler 38002be5353SAxel Dörfler void 38102be5353SAxel Dörfler PaneSwitch::DrawInState(PaneSwitch::State state) 38202be5353SAxel Dörfler { 38302be5353SAxel Dörfler BRect rect(0, 0, 10, 10); 38402be5353SAxel Dörfler 38502be5353SAxel Dörfler rgb_color outlineColor = {0, 0, 0, 255}; 38602be5353SAxel Dörfler rgb_color middleColor = state == kPressed ? kHighlightColor : kNormalColor; 38702be5353SAxel Dörfler 38802be5353SAxel Dörfler SetDrawingMode(B_OP_COPY); 38902be5353SAxel Dörfler 39002be5353SAxel Dörfler switch (state) { 39102be5353SAxel Dörfler case kCollapsed: 39202be5353SAxel Dörfler BeginLineArray(6); 39302be5353SAxel Dörfler 39402be5353SAxel Dörfler if (fLeftAligned) { 39502be5353SAxel Dörfler AddLine(BPoint(rect.left + 3, rect.top + 1), 39602be5353SAxel Dörfler BPoint(rect.left + 3, rect.bottom - 1), outlineColor); 39702be5353SAxel Dörfler AddLine(BPoint(rect.left + 3, rect.top + 1), 39802be5353SAxel Dörfler BPoint(rect.left + 7, rect.top + 5), outlineColor); 39902be5353SAxel Dörfler AddLine(BPoint(rect.left + 7, rect.top + 5), 40002be5353SAxel Dörfler BPoint(rect.left + 3, rect.bottom - 1), outlineColor); 40102be5353SAxel Dörfler 40202be5353SAxel Dörfler AddLine(BPoint(rect.left + 4, rect.top + 3), 40302be5353SAxel Dörfler BPoint(rect.left + 4, rect.bottom - 3), middleColor); 40402be5353SAxel Dörfler AddLine(BPoint(rect.left + 5, rect.top + 4), 40502be5353SAxel Dörfler BPoint(rect.left + 5, rect.bottom - 4), middleColor); 40602be5353SAxel Dörfler AddLine(BPoint(rect.left + 5, rect.top + 5), 40702be5353SAxel Dörfler BPoint(rect.left + 6, rect.top + 5), middleColor); 40802be5353SAxel Dörfler } else { 40902be5353SAxel Dörfler AddLine(BPoint(rect.right - 3, rect.top + 1), 41002be5353SAxel Dörfler BPoint(rect.right - 3, rect.bottom - 1), outlineColor); 41102be5353SAxel Dörfler AddLine(BPoint(rect.right - 3, rect.top + 1), 41202be5353SAxel Dörfler BPoint(rect.right - 7, rect.top + 5), outlineColor); 41302be5353SAxel Dörfler AddLine(BPoint(rect.right - 7, rect.top + 5), 41402be5353SAxel Dörfler BPoint(rect.right - 3, rect.bottom - 1), outlineColor); 41502be5353SAxel Dörfler 41602be5353SAxel Dörfler AddLine(BPoint(rect.right - 4, rect.top + 3), 41702be5353SAxel Dörfler BPoint(rect.right - 4, rect.bottom - 3), middleColor); 41802be5353SAxel Dörfler AddLine(BPoint(rect.right - 5, rect.top + 4), 41902be5353SAxel Dörfler BPoint(rect.right - 5, rect.bottom - 4), middleColor); 42002be5353SAxel Dörfler AddLine(BPoint(rect.right - 5, rect.top + 5), 42102be5353SAxel Dörfler BPoint(rect.right - 6, rect.top + 5), middleColor); 42202be5353SAxel Dörfler } 42302be5353SAxel Dörfler EndLineArray(); 42402be5353SAxel Dörfler break; 42502be5353SAxel Dörfler 42602be5353SAxel Dörfler case kPressed: 42702be5353SAxel Dörfler BeginLineArray(7); 42802be5353SAxel Dörfler if (fLeftAligned) { 42902be5353SAxel Dörfler AddLine(BPoint(rect.left + 1, rect.top + 7), 43002be5353SAxel Dörfler BPoint(rect.left + 7, rect.top + 7), outlineColor); 43102be5353SAxel Dörfler AddLine(BPoint(rect.left + 7, rect.top + 1), 43202be5353SAxel Dörfler BPoint(rect.left + 7, rect.top + 7), outlineColor); 43302be5353SAxel Dörfler AddLine(BPoint(rect.left + 1, rect.top + 7), 43402be5353SAxel Dörfler BPoint(rect.left + 7, rect.top + 1), outlineColor); 43502be5353SAxel Dörfler 43602be5353SAxel Dörfler AddLine(BPoint(rect.left + 3, rect.top + 6), 43702be5353SAxel Dörfler BPoint(rect.left + 6, rect.top + 6), middleColor); 43802be5353SAxel Dörfler AddLine(BPoint(rect.left + 4, rect.top + 5), 43902be5353SAxel Dörfler BPoint(rect.left + 6, rect.top + 5), middleColor); 44002be5353SAxel Dörfler AddLine(BPoint(rect.left + 5, rect.top + 4), 44102be5353SAxel Dörfler BPoint(rect.left + 6, rect.top + 4), middleColor); 44202be5353SAxel Dörfler AddLine(BPoint(rect.left + 6, rect.top + 3), 44302be5353SAxel Dörfler BPoint(rect.left + 6, rect.top + 4), middleColor); 44402be5353SAxel Dörfler } else { 44502be5353SAxel Dörfler AddLine(BPoint(rect.right - 1, rect.top + 7), 44602be5353SAxel Dörfler BPoint(rect.right - 7, rect.top + 7), outlineColor); 44702be5353SAxel Dörfler AddLine(BPoint(rect.right - 7, rect.top + 1), 44802be5353SAxel Dörfler BPoint(rect.right - 7, rect.top + 7), outlineColor); 44902be5353SAxel Dörfler AddLine(BPoint(rect.right - 1, rect.top + 7), 45002be5353SAxel Dörfler BPoint(rect.right - 7, rect.top + 1), outlineColor); 45102be5353SAxel Dörfler 45202be5353SAxel Dörfler AddLine(BPoint(rect.right - 3, rect.top + 6), 45302be5353SAxel Dörfler BPoint(rect.right - 6, rect.top + 6), middleColor); 45402be5353SAxel Dörfler AddLine(BPoint(rect.right - 4, rect.top + 5), 45502be5353SAxel Dörfler BPoint(rect.right - 6, rect.top + 5), middleColor); 45602be5353SAxel Dörfler AddLine(BPoint(rect.right - 5, rect.top + 4), 45702be5353SAxel Dörfler BPoint(rect.right - 6, rect.top + 4), middleColor); 45802be5353SAxel Dörfler AddLine(BPoint(rect.right - 6, rect.top + 3), 45902be5353SAxel Dörfler BPoint(rect.right - 6, rect.top + 4), middleColor); 46002be5353SAxel Dörfler } 46102be5353SAxel Dörfler EndLineArray(); 46202be5353SAxel Dörfler break; 46302be5353SAxel Dörfler 46402be5353SAxel Dörfler case kExpanded: 46502be5353SAxel Dörfler BeginLineArray(6); 46602be5353SAxel Dörfler AddLine(BPoint(rect.left + 1, rect.top + 3), 46702be5353SAxel Dörfler BPoint(rect.right - 1, rect.top + 3), outlineColor); 46802be5353SAxel Dörfler AddLine(BPoint(rect.left + 1, rect.top + 3), 46902be5353SAxel Dörfler BPoint(rect.left + 5, rect.top + 7), outlineColor); 47002be5353SAxel Dörfler AddLine(BPoint(rect.left + 5, rect.top + 7), 47102be5353SAxel Dörfler BPoint(rect.right - 1, rect.top + 3), outlineColor); 47202be5353SAxel Dörfler 47302be5353SAxel Dörfler AddLine(BPoint(rect.left + 3, rect.top + 4), 47402be5353SAxel Dörfler BPoint(rect.right - 3, rect.top + 4), middleColor); 47502be5353SAxel Dörfler AddLine(BPoint(rect.left + 4, rect.top + 5), 47602be5353SAxel Dörfler BPoint(rect.right - 4, rect.top + 5), middleColor); 47702be5353SAxel Dörfler AddLine(BPoint(rect.left + 5, rect.top + 5), 47802be5353SAxel Dörfler BPoint(rect.left + 5, rect.top + 6), middleColor); 47902be5353SAxel Dörfler EndLineArray(); 48002be5353SAxel Dörfler break; 48102be5353SAxel Dörfler } 48202be5353SAxel Dörfler } 48302be5353SAxel Dörfler 484