1*02be5353SAxel Dörfler /* 2*02be5353SAxel Dörfler Open Tracker License 3*02be5353SAxel Dörfler 4*02be5353SAxel Dörfler Terms and Conditions 5*02be5353SAxel Dörfler 6*02be5353SAxel Dörfler Copyright (c) 1991-2000, Be Incorporated. All rights reserved. 7*02be5353SAxel Dörfler 8*02be5353SAxel Dörfler Permission is hereby granted, free of charge, to any person obtaining a copy of 9*02be5353SAxel Dörfler this software and associated documentation files (the "Software"), to deal in 10*02be5353SAxel Dörfler the Software without restriction, including without limitation the rights to 11*02be5353SAxel Dörfler use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12*02be5353SAxel Dörfler of the Software, and to permit persons to whom the Software is furnished to do 13*02be5353SAxel Dörfler so, subject to the following conditions: 14*02be5353SAxel Dörfler 15*02be5353SAxel Dörfler The above copyright notice and this permission notice applies to all licensees 16*02be5353SAxel Dörfler and shall be included in all copies or substantial portions of the Software. 17*02be5353SAxel Dörfler 18*02be5353SAxel Dörfler THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19*02be5353SAxel Dörfler IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY, 20*02be5353SAxel Dörfler FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21*02be5353SAxel Dörfler BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 22*02be5353SAxel Dörfler AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION 23*02be5353SAxel Dörfler WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24*02be5353SAxel Dörfler 25*02be5353SAxel Dörfler Except as contained in this notice, the name of Be Incorporated shall not be 26*02be5353SAxel Dörfler used in advertising or otherwise to promote the sale, use or other dealings in 27*02be5353SAxel Dörfler this Software without prior written authorization from Be Incorporated. 28*02be5353SAxel Dörfler 29*02be5353SAxel Dörfler Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks 30*02be5353SAxel Dörfler of Be Incorporated in the United States and other countries. Other brand product 31*02be5353SAxel Dörfler names are registered trademarks or trademarks of their respective holders. 32*02be5353SAxel Dörfler All rights reserved. 33*02be5353SAxel Dörfler */ 34*02be5353SAxel Dörfler 35*02be5353SAxel Dörfler #include "Window.h" 36*02be5353SAxel Dörfler #include "DialogPane.h" 37*02be5353SAxel Dörfler #include "Thread.h" 38*02be5353SAxel Dörfler #include "Utilities.h" 39*02be5353SAxel Dörfler 40*02be5353SAxel Dörfler void 41*02be5353SAxel Dörfler ViewList::RemoveAll(BView *) 42*02be5353SAxel Dörfler { 43*02be5353SAxel Dörfler EachListItemIgnoreResult(this, &BView::RemoveSelf); 44*02be5353SAxel Dörfler } 45*02be5353SAxel Dörfler 46*02be5353SAxel Dörfler static void 47*02be5353SAxel Dörfler AddSelf(BView *self, BView *to) 48*02be5353SAxel Dörfler { 49*02be5353SAxel Dörfler to->AddChild(self); 50*02be5353SAxel Dörfler } 51*02be5353SAxel Dörfler 52*02be5353SAxel Dörfler void 53*02be5353SAxel Dörfler ViewList::AddAll(BView *toParent) 54*02be5353SAxel Dörfler { 55*02be5353SAxel Dörfler EachListItem(this, &AddSelf, toParent); 56*02be5353SAxel Dörfler } 57*02be5353SAxel Dörfler 58*02be5353SAxel Dörfler 59*02be5353SAxel Dörfler DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, int32 initialMode, 60*02be5353SAxel Dörfler const char *name, uint32 followFlags, uint32 flags) 61*02be5353SAxel Dörfler : BView(FrameForMode(initialMode, mode1Frame, mode2Frame, mode2Frame), 62*02be5353SAxel Dörfler name, followFlags, flags), 63*02be5353SAxel Dörfler fMode1Frame(mode1Frame), 64*02be5353SAxel Dörfler fMode2Frame(mode2Frame), 65*02be5353SAxel Dörfler fMode3Frame(mode2Frame) 66*02be5353SAxel Dörfler { 67*02be5353SAxel Dörfler SetMode(initialMode, true); 68*02be5353SAxel Dörfler } 69*02be5353SAxel Dörfler 70*02be5353SAxel Dörfler 71*02be5353SAxel Dörfler DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, BRect mode3Frame, 72*02be5353SAxel Dörfler int32 initialMode, const char *name, uint32 followFlags, uint32 flags) 73*02be5353SAxel Dörfler : BView(FrameForMode(initialMode, mode1Frame, mode2Frame, mode3Frame), 74*02be5353SAxel Dörfler name, followFlags, flags), 75*02be5353SAxel Dörfler fMode1Frame(mode1Frame), 76*02be5353SAxel Dörfler fMode2Frame(mode2Frame), 77*02be5353SAxel Dörfler fMode3Frame(mode3Frame) 78*02be5353SAxel Dörfler { 79*02be5353SAxel Dörfler SetMode(initialMode, true); 80*02be5353SAxel Dörfler } 81*02be5353SAxel Dörfler 82*02be5353SAxel Dörfler 83*02be5353SAxel Dörfler DialogPane::~DialogPane() 84*02be5353SAxel Dörfler { 85*02be5353SAxel Dörfler fMode3Items.RemoveAll(this); 86*02be5353SAxel Dörfler fMode2Items.RemoveAll(this); 87*02be5353SAxel Dörfler } 88*02be5353SAxel Dörfler 89*02be5353SAxel Dörfler 90*02be5353SAxel Dörfler void 91*02be5353SAxel Dörfler DialogPane::SetMode(int32 mode, bool initialSetup) 92*02be5353SAxel Dörfler { 93*02be5353SAxel Dörfler ASSERT(mode < 3 && mode >= 0); 94*02be5353SAxel Dörfler 95*02be5353SAxel Dörfler if (!initialSetup && mode == fMode) 96*02be5353SAxel Dörfler return; 97*02be5353SAxel Dörfler 98*02be5353SAxel Dörfler int32 oldMode = fMode; 99*02be5353SAxel Dörfler fMode = mode; 100*02be5353SAxel Dörfler 101*02be5353SAxel Dörfler bool followBottom = (ResizingMode() & B_FOLLOW_BOTTOM) != 0; 102*02be5353SAxel Dörfler // if we are follow bottom, we will move ourselves, need to place us back 103*02be5353SAxel Dörfler float bottomOffset = 0; 104*02be5353SAxel Dörfler if (followBottom) 105*02be5353SAxel Dörfler bottomOffset = Window()->Bounds().bottom - Frame().bottom; 106*02be5353SAxel Dörfler 107*02be5353SAxel Dörfler BRect newBounds(BoundsForMode(fMode)); 108*02be5353SAxel Dörfler if (!initialSetup) 109*02be5353SAxel Dörfler ResizeParentWindow(fMode, oldMode); 110*02be5353SAxel Dörfler 111*02be5353SAxel Dörfler ResizeTo(newBounds.Width(), newBounds.Height()); 112*02be5353SAxel Dörfler 113*02be5353SAxel Dörfler float delta = 0; 114*02be5353SAxel Dörfler if (followBottom) 115*02be5353SAxel Dörfler delta = (Window()->Bounds().bottom - Frame().bottom) - bottomOffset; 116*02be5353SAxel Dörfler 117*02be5353SAxel Dörfler if (delta != 0) { 118*02be5353SAxel Dörfler MoveBy(0, delta); 119*02be5353SAxel Dörfler if (fLatch && (fLatch->ResizingMode() & B_FOLLOW_BOTTOM)) 120*02be5353SAxel Dörfler fLatch->MoveBy(0, delta); 121*02be5353SAxel Dörfler } 122*02be5353SAxel Dörfler 123*02be5353SAxel Dörfler switch (fMode) { 124*02be5353SAxel Dörfler case 0: 125*02be5353SAxel Dörfler { 126*02be5353SAxel Dörfler if (oldMode > 1) 127*02be5353SAxel Dörfler fMode3Items.RemoveAll(this); 128*02be5353SAxel Dörfler if (oldMode > 0) 129*02be5353SAxel Dörfler fMode2Items.RemoveAll(this); 130*02be5353SAxel Dörfler 131*02be5353SAxel Dörfler BView *separator = FindView("separatorLine"); 132*02be5353SAxel Dörfler if (separator) { 133*02be5353SAxel Dörfler BRect frame(separator->Frame()); 134*02be5353SAxel Dörfler frame.InsetBy(-1, -1); 135*02be5353SAxel Dörfler RemoveChild(separator); 136*02be5353SAxel Dörfler Invalidate(); 137*02be5353SAxel Dörfler } 138*02be5353SAxel Dörfler 139*02be5353SAxel Dörfler AddChild(new SeparatorLine(BPoint(newBounds.left, newBounds.top 140*02be5353SAxel Dörfler + newBounds.Height() / 2), newBounds.Width(), false, 141*02be5353SAxel Dörfler "separatorLine")); 142*02be5353SAxel Dörfler } 143*02be5353SAxel Dörfler break; 144*02be5353SAxel Dörfler case 1: 145*02be5353SAxel Dörfler { 146*02be5353SAxel Dörfler if (oldMode > 1) 147*02be5353SAxel Dörfler fMode3Items.RemoveAll(this); 148*02be5353SAxel Dörfler else 149*02be5353SAxel Dörfler fMode2Items.AddAll(this); 150*02be5353SAxel Dörfler 151*02be5353SAxel Dörfler BView *separator = FindView("separatorLine"); 152*02be5353SAxel Dörfler if (separator) { 153*02be5353SAxel Dörfler BRect frame(separator->Frame()); 154*02be5353SAxel Dörfler frame.InsetBy(-1, -1); 155*02be5353SAxel Dörfler RemoveChild(separator); 156*02be5353SAxel Dörfler Invalidate(); 157*02be5353SAxel Dörfler } 158*02be5353SAxel Dörfler } 159*02be5353SAxel Dörfler break; 160*02be5353SAxel Dörfler case 2: 161*02be5353SAxel Dörfler { 162*02be5353SAxel Dörfler fMode3Items.AddAll(this); 163*02be5353SAxel Dörfler if (oldMode < 1) 164*02be5353SAxel Dörfler fMode2Items.AddAll(this); 165*02be5353SAxel Dörfler 166*02be5353SAxel Dörfler BView *separator = FindView("separatorLine"); 167*02be5353SAxel Dörfler if (separator) { 168*02be5353SAxel Dörfler BRect frame(separator->Frame()); 169*02be5353SAxel Dörfler frame.InsetBy(-1, -1); 170*02be5353SAxel Dörfler RemoveChild(separator); 171*02be5353SAxel Dörfler Invalidate(); 172*02be5353SAxel Dörfler } 173*02be5353SAxel Dörfler } 174*02be5353SAxel Dörfler break; 175*02be5353SAxel Dörfler } 176*02be5353SAxel Dörfler } 177*02be5353SAxel Dörfler 178*02be5353SAxel Dörfler void 179*02be5353SAxel Dörfler DialogPane::AttachedToWindow() 180*02be5353SAxel Dörfler { 181*02be5353SAxel Dörfler BView *parent = Parent(); 182*02be5353SAxel Dörfler if (parent) { 183*02be5353SAxel Dörfler SetViewColor(parent->ViewColor()); 184*02be5353SAxel Dörfler SetLowColor(parent->LowColor()); 185*02be5353SAxel Dörfler } 186*02be5353SAxel Dörfler } 187*02be5353SAxel Dörfler 188*02be5353SAxel Dörfler void 189*02be5353SAxel Dörfler DialogPane::ResizeParentWindow(int32 from, int32 to) 190*02be5353SAxel Dörfler { 191*02be5353SAxel Dörfler if (!Window()) 192*02be5353SAxel Dörfler return; 193*02be5353SAxel Dörfler 194*02be5353SAxel Dörfler BRect oldBounds = BoundsForMode(from); 195*02be5353SAxel Dörfler BRect newBounds = BoundsForMode(to); 196*02be5353SAxel Dörfler 197*02be5353SAxel Dörfler BPoint by = oldBounds.RightBottom() - newBounds.RightBottom(); 198*02be5353SAxel Dörfler if (by != BPoint(0, 0)) 199*02be5353SAxel Dörfler Window()->ResizeBy(by.x, by.y); 200*02be5353SAxel Dörfler } 201*02be5353SAxel Dörfler 202*02be5353SAxel Dörfler void 203*02be5353SAxel Dörfler DialogPane::AddItem(BView *view, int32 toMode) 204*02be5353SAxel Dörfler { 205*02be5353SAxel Dörfler if (toMode == 1) 206*02be5353SAxel Dörfler fMode2Items.AddItem(view); 207*02be5353SAxel Dörfler else if (toMode == 2) 208*02be5353SAxel Dörfler fMode3Items.AddItem(view); 209*02be5353SAxel Dörfler if (fMode >= toMode) 210*02be5353SAxel Dörfler AddChild(view); 211*02be5353SAxel Dörfler } 212*02be5353SAxel Dörfler 213*02be5353SAxel Dörfler BRect 214*02be5353SAxel Dörfler DialogPane::FrameForMode(int32 mode) 215*02be5353SAxel Dörfler { 216*02be5353SAxel Dörfler switch (mode) { 217*02be5353SAxel Dörfler case 0: 218*02be5353SAxel Dörfler return fMode1Frame; 219*02be5353SAxel Dörfler case 1: 220*02be5353SAxel Dörfler return fMode2Frame; 221*02be5353SAxel Dörfler case 2: 222*02be5353SAxel Dörfler return fMode3Frame; 223*02be5353SAxel Dörfler } 224*02be5353SAxel Dörfler return fMode1Frame; 225*02be5353SAxel Dörfler } 226*02be5353SAxel Dörfler 227*02be5353SAxel Dörfler BRect 228*02be5353SAxel Dörfler DialogPane::BoundsForMode(int32 mode) 229*02be5353SAxel Dörfler { 230*02be5353SAxel Dörfler BRect result; 231*02be5353SAxel Dörfler switch (mode) { 232*02be5353SAxel Dörfler case 0: 233*02be5353SAxel Dörfler result = fMode1Frame; 234*02be5353SAxel Dörfler break; 235*02be5353SAxel Dörfler case 1: 236*02be5353SAxel Dörfler result = fMode2Frame; 237*02be5353SAxel Dörfler break; 238*02be5353SAxel Dörfler case 2: 239*02be5353SAxel Dörfler result = fMode3Frame; 240*02be5353SAxel Dörfler break; 241*02be5353SAxel Dörfler } 242*02be5353SAxel Dörfler result.OffsetTo(0, 0); 243*02be5353SAxel Dörfler return result; 244*02be5353SAxel Dörfler } 245*02be5353SAxel Dörfler 246*02be5353SAxel Dörfler BRect 247*02be5353SAxel Dörfler DialogPane::FrameForMode(int32 mode, BRect mode1Frame, BRect mode2Frame, 248*02be5353SAxel Dörfler BRect mode3Frame) 249*02be5353SAxel Dörfler { 250*02be5353SAxel Dörfler switch (mode) { 251*02be5353SAxel Dörfler case 0: 252*02be5353SAxel Dörfler return mode1Frame; 253*02be5353SAxel Dörfler case 1: 254*02be5353SAxel Dörfler return mode2Frame; 255*02be5353SAxel Dörfler case 2: 256*02be5353SAxel Dörfler return mode3Frame; 257*02be5353SAxel Dörfler } 258*02be5353SAxel Dörfler return mode1Frame; 259*02be5353SAxel Dörfler } 260*02be5353SAxel Dörfler 261*02be5353SAxel Dörfler const uint32 kValueChanged = 'swch'; 262*02be5353SAxel Dörfler 263*02be5353SAxel Dörfler void 264*02be5353SAxel Dörfler DialogPane::SetSwitch(BControl *control) 265*02be5353SAxel Dörfler { 266*02be5353SAxel Dörfler fLatch = control; 267*02be5353SAxel Dörfler control->SetMessage(new BMessage(kValueChanged)); 268*02be5353SAxel Dörfler control->SetTarget(this); 269*02be5353SAxel Dörfler } 270*02be5353SAxel Dörfler 271*02be5353SAxel Dörfler void 272*02be5353SAxel Dörfler DialogPane::MessageReceived(BMessage *message) 273*02be5353SAxel Dörfler { 274*02be5353SAxel Dörfler if (message->what == kValueChanged) { 275*02be5353SAxel Dörfler int32 value; 276*02be5353SAxel Dörfler if (message->FindInt32("be:value", &value) == B_OK) 277*02be5353SAxel Dörfler SetMode(value); 278*02be5353SAxel Dörfler } else 279*02be5353SAxel Dörfler _inherited::MessageReceived(message); 280*02be5353SAxel Dörfler } 281*02be5353SAxel Dörfler 282*02be5353SAxel Dörfler PaneSwitch::PaneSwitch(BRect frame, const char *name, bool leftAligned, 283*02be5353SAxel Dörfler uint32 resizeMask, uint32 flags) 284*02be5353SAxel Dörfler : BControl(frame, name, "", 0, resizeMask, flags), 285*02be5353SAxel Dörfler fLeftAligned(leftAligned), 286*02be5353SAxel Dörfler fPressing(false) 287*02be5353SAxel Dörfler { 288*02be5353SAxel Dörfler } 289*02be5353SAxel Dörfler 290*02be5353SAxel Dörfler void 291*02be5353SAxel Dörfler PaneSwitch::DoneTracking(BPoint point) 292*02be5353SAxel Dörfler { 293*02be5353SAxel Dörfler BRect bounds(Bounds()); 294*02be5353SAxel Dörfler bounds.InsetBy(-3, -3); 295*02be5353SAxel Dörfler 296*02be5353SAxel Dörfler fPressing = false; 297*02be5353SAxel Dörfler Invalidate(); 298*02be5353SAxel Dörfler if (bounds.Contains(point)) { 299*02be5353SAxel Dörfler SetValue(!Value()); 300*02be5353SAxel Dörfler Invoke(); 301*02be5353SAxel Dörfler } 302*02be5353SAxel Dörfler } 303*02be5353SAxel Dörfler 304*02be5353SAxel Dörfler void 305*02be5353SAxel Dörfler PaneSwitch::Track(BPoint point, uint32) 306*02be5353SAxel Dörfler { 307*02be5353SAxel Dörfler BRect bounds(Bounds()); 308*02be5353SAxel Dörfler bounds.InsetBy(-3, -3); 309*02be5353SAxel Dörfler 310*02be5353SAxel Dörfler bool newPressing = bounds.Contains(point); 311*02be5353SAxel Dörfler if (newPressing != fPressing) { 312*02be5353SAxel Dörfler fPressing = newPressing; 313*02be5353SAxel Dörfler Invalidate(); 314*02be5353SAxel Dörfler } 315*02be5353SAxel Dörfler } 316*02be5353SAxel Dörfler 317*02be5353SAxel Dörfler 318*02be5353SAxel Dörfler void 319*02be5353SAxel Dörfler PaneSwitch::MouseDown(BPoint) 320*02be5353SAxel Dörfler { 321*02be5353SAxel Dörfler if (!IsEnabled()) 322*02be5353SAxel Dörfler return; 323*02be5353SAxel Dörfler 324*02be5353SAxel Dörfler fPressing = true; 325*02be5353SAxel Dörfler MouseDownThread<PaneSwitch>::TrackMouse(this, &PaneSwitch::DoneTracking, 326*02be5353SAxel Dörfler &PaneSwitch::Track); 327*02be5353SAxel Dörfler Invalidate(); 328*02be5353SAxel Dörfler } 329*02be5353SAxel Dörfler 330*02be5353SAxel Dörfler 331*02be5353SAxel Dörfler const rgb_color kNormalColor = {150, 150, 150, 255}; 332*02be5353SAxel Dörfler const rgb_color kHighlightColor = {100, 100, 0, 255}; 333*02be5353SAxel Dörfler 334*02be5353SAxel Dörfler void 335*02be5353SAxel Dörfler PaneSwitch::Draw(BRect) 336*02be5353SAxel Dörfler { 337*02be5353SAxel Dörfler if (fPressing) 338*02be5353SAxel Dörfler DrawInState(kPressed); 339*02be5353SAxel Dörfler else if (Value()) 340*02be5353SAxel Dörfler DrawInState(kExpanded); 341*02be5353SAxel Dörfler else 342*02be5353SAxel Dörfler DrawInState(kCollapsed); 343*02be5353SAxel Dörfler 344*02be5353SAxel Dörfler 345*02be5353SAxel Dörfler rgb_color markColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR); 346*02be5353SAxel Dörfler 347*02be5353SAxel Dörfler bool focused = IsFocus() && Window()->IsActive(); 348*02be5353SAxel Dörfler BRect bounds(Bounds()); 349*02be5353SAxel Dörfler BeginLineArray(2); 350*02be5353SAxel Dörfler AddLine(BPoint(bounds.left + 2, bounds.bottom - 1), 351*02be5353SAxel Dörfler BPoint(bounds.right - 2, bounds.bottom - 1), focused ? markColor : ViewColor()); 352*02be5353SAxel Dörfler AddLine(BPoint(bounds.left + 2, bounds.bottom), 353*02be5353SAxel Dörfler BPoint(bounds.right - 2, bounds.bottom), focused ? kWhite : ViewColor()); 354*02be5353SAxel Dörfler EndLineArray(); 355*02be5353SAxel Dörfler } 356*02be5353SAxel Dörfler 357*02be5353SAxel Dörfler void 358*02be5353SAxel Dörfler PaneSwitch::DrawInState(PaneSwitch::State state) 359*02be5353SAxel Dörfler { 360*02be5353SAxel Dörfler BRect rect(0, 0, 10, 10); 361*02be5353SAxel Dörfler 362*02be5353SAxel Dörfler rgb_color outlineColor = {0, 0, 0, 255}; 363*02be5353SAxel Dörfler rgb_color middleColor = state == kPressed ? kHighlightColor : kNormalColor; 364*02be5353SAxel Dörfler 365*02be5353SAxel Dörfler 366*02be5353SAxel Dörfler SetDrawingMode(B_OP_COPY); 367*02be5353SAxel Dörfler 368*02be5353SAxel Dörfler switch (state) { 369*02be5353SAxel Dörfler case kCollapsed: 370*02be5353SAxel Dörfler BeginLineArray(6); 371*02be5353SAxel Dörfler 372*02be5353SAxel Dörfler if (fLeftAligned) { 373*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 3, rect.top + 1), 374*02be5353SAxel Dörfler BPoint(rect.left + 3, rect.bottom - 1), outlineColor); 375*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 3, rect.top + 1), 376*02be5353SAxel Dörfler BPoint(rect.left + 7, rect.top + 5), outlineColor); 377*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 7, rect.top + 5), 378*02be5353SAxel Dörfler BPoint(rect.left + 3, rect.bottom - 1), outlineColor); 379*02be5353SAxel Dörfler 380*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 4, rect.top + 3), 381*02be5353SAxel Dörfler BPoint(rect.left + 4, rect.bottom - 3), middleColor); 382*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 5, rect.top + 4), 383*02be5353SAxel Dörfler BPoint(rect.left + 5, rect.bottom - 4), middleColor); 384*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 5, rect.top + 5), 385*02be5353SAxel Dörfler BPoint(rect.left + 6, rect.top + 5), middleColor); 386*02be5353SAxel Dörfler } else { 387*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 3, rect.top + 1), 388*02be5353SAxel Dörfler BPoint(rect.right - 3, rect.bottom - 1), outlineColor); 389*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 3, rect.top + 1), 390*02be5353SAxel Dörfler BPoint(rect.right - 7, rect.top + 5), outlineColor); 391*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 7, rect.top + 5), 392*02be5353SAxel Dörfler BPoint(rect.right - 3, rect.bottom - 1), outlineColor); 393*02be5353SAxel Dörfler 394*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 4, rect.top + 3), 395*02be5353SAxel Dörfler BPoint(rect.right - 4, rect.bottom - 3), middleColor); 396*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 5, rect.top + 4), 397*02be5353SAxel Dörfler BPoint(rect.right - 5, rect.bottom - 4), middleColor); 398*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 5, rect.top + 5), 399*02be5353SAxel Dörfler BPoint(rect.right - 6, rect.top + 5), middleColor); 400*02be5353SAxel Dörfler } 401*02be5353SAxel Dörfler EndLineArray(); 402*02be5353SAxel Dörfler break; 403*02be5353SAxel Dörfler 404*02be5353SAxel Dörfler case kPressed: 405*02be5353SAxel Dörfler BeginLineArray(7); 406*02be5353SAxel Dörfler if (fLeftAligned) { 407*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 1, rect.top + 7), 408*02be5353SAxel Dörfler BPoint(rect.left + 7, rect.top + 7), outlineColor); 409*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 7, rect.top + 1), 410*02be5353SAxel Dörfler BPoint(rect.left + 7, rect.top + 7), outlineColor); 411*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 1, rect.top + 7), 412*02be5353SAxel Dörfler BPoint(rect.left + 7, rect.top + 1), outlineColor); 413*02be5353SAxel Dörfler 414*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 3, rect.top + 6), 415*02be5353SAxel Dörfler BPoint(rect.left + 6, rect.top + 6), middleColor); 416*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 4, rect.top + 5), 417*02be5353SAxel Dörfler BPoint(rect.left + 6, rect.top + 5), middleColor); 418*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 5, rect.top + 4), 419*02be5353SAxel Dörfler BPoint(rect.left + 6, rect.top + 4), middleColor); 420*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 6, rect.top + 3), 421*02be5353SAxel Dörfler BPoint(rect.left + 6, rect.top + 4), middleColor); 422*02be5353SAxel Dörfler } else { 423*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 1, rect.top + 7), 424*02be5353SAxel Dörfler BPoint(rect.right - 7, rect.top + 7), outlineColor); 425*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 7, rect.top + 1), 426*02be5353SAxel Dörfler BPoint(rect.right - 7, rect.top + 7), outlineColor); 427*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 1, rect.top + 7), 428*02be5353SAxel Dörfler BPoint(rect.right - 7, rect.top + 1), outlineColor); 429*02be5353SAxel Dörfler 430*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 3, rect.top + 6), 431*02be5353SAxel Dörfler BPoint(rect.right - 6, rect.top + 6), middleColor); 432*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 4, rect.top + 5), 433*02be5353SAxel Dörfler BPoint(rect.right - 6, rect.top + 5), middleColor); 434*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 5, rect.top + 4), 435*02be5353SAxel Dörfler BPoint(rect.right - 6, rect.top + 4), middleColor); 436*02be5353SAxel Dörfler AddLine(BPoint(rect.right - 6, rect.top + 3), 437*02be5353SAxel Dörfler BPoint(rect.right - 6, rect.top + 4), middleColor); 438*02be5353SAxel Dörfler } 439*02be5353SAxel Dörfler EndLineArray(); 440*02be5353SAxel Dörfler break; 441*02be5353SAxel Dörfler 442*02be5353SAxel Dörfler case kExpanded: 443*02be5353SAxel Dörfler BeginLineArray(6); 444*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 1, rect.top + 3), 445*02be5353SAxel Dörfler BPoint(rect.right - 1, rect.top + 3), outlineColor); 446*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 1, rect.top + 3), 447*02be5353SAxel Dörfler BPoint(rect.left + 5, rect.top + 7), outlineColor); 448*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 5, rect.top + 7), 449*02be5353SAxel Dörfler BPoint(rect.right - 1, rect.top + 3), outlineColor); 450*02be5353SAxel Dörfler 451*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 3, rect.top + 4), 452*02be5353SAxel Dörfler BPoint(rect.right - 3, rect.top + 4), middleColor); 453*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 4, rect.top + 5), 454*02be5353SAxel Dörfler BPoint(rect.right - 4, rect.top + 5), middleColor); 455*02be5353SAxel Dörfler AddLine(BPoint(rect.left + 5, rect.top + 5), 456*02be5353SAxel Dörfler BPoint(rect.left + 5, rect.top + 6), middleColor); 457*02be5353SAxel Dörfler EndLineArray(); 458*02be5353SAxel Dörfler break; 459*02be5353SAxel Dörfler } 460*02be5353SAxel Dörfler } 461*02be5353SAxel Dörfler 462