add edit clear submenu/clear hard_edges, fix tessy gl segv, mask toolgui layout,...
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcbar.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #include "bcbar.h"
23 #include "bcpixmap.h"
24 #include "bcresources.h"
25 #include "vframe.h"
26
27
28
29
30 BC_Bar::BC_Bar(int x, int y, int w, VFrame *data)
31  : BC_SubWindow(x, y, w, 0, -1)
32 {
33         this->data = data;
34         image = 0;
35 }
36
37 BC_Bar::~BC_Bar()
38 {
39         delete image;
40 }
41
42 int BC_Bar::initialize()
43 {
44         if(data)
45                 set_image(data);
46         else
47                 set_image(get_resources()->bar_data);
48
49 // Create the subwindow
50         BC_SubWindow::initialize();
51
52         draw(0);
53         return 0;
54 }
55
56 void BC_Bar::set_image(VFrame *data)
57 {
58         delete image;
59         image = new BC_Pixmap(parent_window, data, PIXMAP_ALPHA);
60         h = image->get_h();
61 }
62
63 int BC_Bar::reposition_window(int x, int y, int w)
64 {
65         BC_WindowBase::reposition_window(x, y, w, -1);
66         draw(0);
67         return 0;
68 }
69
70 int BC_Bar::resize_event(int w, int h)
71 {
72         reposition_window(x, y, get_w());
73         return 1;
74 }
75
76
77 void BC_Bar::draw(int flush)
78 {
79         draw_top_background(parent_window, 0, 0,w, h);
80         draw_3segmenth(0, 0, w, 0, w, image);
81         flash(flush);
82 }