fat: Greatly simplify and clean up dosfs_get_file_map().
[haiku.git] / src / preferences / dun / TreeView.cpp
blobee395ecd0a98e2ce8275f2b3a35ff24052dced3a
1 /*
3 The Amazing TreeView !
5 Author: Misza (misza@ihug.com.au)
7 (C) 2002 OpenBeOS under MIT license
9 */
10 #include "TreeView.h"
11 #include "DUNWindow.h"
12 TreeView::TreeView(BRect r) : BView(r,"miszaView",B_FOLLOW_TOP,B_WILL_DRAW)
14 down = false;
15 status = false;
17 void TreeView::MouseUp(BPoint point)
18 { //controls what get resized and how
19 BPoint where;
20 uint32 buttons;
21 GetMouse(&where, &buttons);
23 if(where != point)
24 { Invalidate();
25 down = false;
28 if(!status)//if view is hidden
30 Invalidate();
32 status = true;
33 ((DUNWindow*)Window())->DoResizeMagic();
35 else if(status)
37 Invalidate();
39 status = false;
40 ((DUNWindow*)Window())->DoResizeMagic();
44 void TreeView::MouseDown(BPoint point)
46 SetMouseEventMask(B_POINTER_EVENTS,B_LOCK_WINDOW_FOCUS);
47 down = true;
48 Invalidate();
51 void TreeView::Draw(BRect updateRect)
52 { //colours for drawing the triangle
54 SetHighColor(0,0,0);
55 SetLowColor(150,150,150);
56 if(status && !down)//if view is showing
58 //horiz triangle
59 FillTriangle(BPoint(0,2),BPoint(8,2),BPoint(4,6),B_SOLID_LOW);
60 StrokeTriangle(BPoint(0,2),BPoint(8,2),BPoint(4,6),B_SOLID_HIGH);
62 else if (!status && !down){
63 //vert triangle
64 FillTriangle(BPoint(2,0),BPoint(2,8),BPoint(6,4),B_SOLID_LOW);
65 StrokeTriangle(BPoint(2,0),BPoint(2,8),BPoint(6,4),B_SOLID_HIGH);
67 else
68 {//midway
69 SetHighColor(0,0,0);
70 SetLowColor(100,100,0);
71 FillTriangle(BPoint(0,6),BPoint(6,0),BPoint(6,6),B_SOLID_LOW);
72 StrokeTriangle(BPoint(0,6),BPoint(6,0),BPoint(6,6),B_SOLID_HIGH);
75 down = false;
76 SetHighColor(0,0,0);
77 SetLowColor(150,150,150);
81 void TreeView::SetTreeViewStatus(bool condition)
83 status = condition;