2 Epichord - a midi sequencer
3 Copyright (C) 2008 Evan Rinehart
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to
18 The Free Software Foundation, Inc.
19 51 Franklin Street, Fifth Floor
20 Boston, MA 02110-1301, USA
26 #include <fltk/Widget.h>
27 #include <fltk/Group.h>
28 #include <fltk/draw.h>
29 #include <fltk/events.h>
34 DragBar::DragBar(int x
, int y
, int w
, int h
, const char* label
) :
35 fltk::Widget(x
, y
, w
, h
, label
) {
41 int DragBar::handle(int event
){
42 int X
= fltk::event_x();
49 val
= orig_val
- (X
- orig_x
);
64 fltk::push_clip(2,2,w()-4,h()-4);
66 fltk::setcolor(fltk::GRAY60
);
67 fltk::fillrect(2,2,w()-4,h()-4);
69 if(!cached_flag
){//draw first time
70 for(int i
=-val
; i
<w(); i
+=6){
72 fltk::setcolor(fltk::GRAY80
);
73 fltk::fillrect(i
+5,4,3,1);
74 fltk::fillrect(i
+5,4,1,2);
76 fltk::setcolor(fltk::GRAY30
);
77 fltk::fillrect(i
+5,6,3,1);
78 fltk::fillrect(i
+7,5,1,2);
80 fltk::setcolor(fltk::GRAY80
);
81 fltk::fillrect(i
+5,4+5,3,1);
82 fltk::fillrect(i
+5,4+5,1,2);
84 fltk::setcolor(fltk::GRAY30
);
85 fltk::fillrect(i
+5,6+5,3,1);
86 fltk::fillrect(i
+7,5+5,1,2);
92 fltk::Widget
* p
= parent();
94 if(p
->parent() != NULL
){//the window
100 readimage(gfxbuf
,fltk::RGB
,fltk::Rectangle(GX
+2,GY
+2,102,h()-4));
104 for(int i
=-val
; i
<w(); i
+=102){
106 drawimage(gfxbuf
,fltk::RGB
,fltk::Rectangle(2+i
,2,102,h()-4));