00001
00002
00004
00005
00006 #include <ALL.H>
00007 #include <OINFO.H>
00008 #include <OVGA.H>
00009 #include <OSYS.H>
00010 #include <OFONT.H>
00011 #include <OIFACE.H>
00012 #include <OMOUSE.H>
00013 #include <ORADIO.H>
00014 #include "OBar.h"
00015
00016
00017
00018 static char paint_flag = 0;
00019
00021
00023
00024 Bar::Bar() {
00025
00026 }
00027
00028
00029
00030 Bar::~Bar() {
00031 deinit();
00032 }
00033
00034
00035
00036
00042
00043 void Bar::init( int x1, int y1, int x2, int y2, int barColor) {
00044 font_ptr = &font_chartsm;
00045 bar_x1 = x1;
00046 bar_y1 = (y1 + y2 - font_ptr->font_height) / 2;
00047 bar_x2 = x2;
00048 bar_y2 = (y1 + y2 + font_ptr->font_height) / 2;
00049 bar_width = x2 - x1;
00050 bar_height = y2 - y1;
00051 bar_color=barColor;
00052 bar_bitmap=NULL;
00053
00054 init_flag = 1;
00055 }
00056
00057
00058
00060
00061 void Bar::deinit() {
00062
00063 if (init_flag)
00064 if (bar_bitmap) {
00065 mem_del(bar_bitmap);
00066 bar_bitmap = NULL;
00067 }
00068 init_flag = 0;
00069 }
00070
00071
00072
00074
00075 void Bar::paint(void) {
00076
00077 bar_bitmap=vga_back.save_area(bar_x1,bar_y1,bar_x2,bar_y2+2,bar_bitmap);
00078
00079 paint_flag = 1;
00080 refresh();
00081 }
00082
00083
00084
00086
00087 void Bar::refresh(void) {
00088 vga_back.rest_area(bar_bitmap, 0, 0);
00089 user_interface.bar(bar_x1,bar_y1,bar_x2,bar_y2);
00090 if (!paint_flag)
00091 vga.blt_buf(bar_x1, bar_y1, bar_x2, bar_y2+2);
00092 else
00093 paint_flag = 0;
00094 }
00095
00096
00097
00099
00100
00101
00102
00103 int Bar::detect() {
00104 if (!init_flag)
00105 return 0;
00106
00107
00108
00109 if (mouse.single_click( bar_x1, bar_y1, bar_x2, bar_y2 )) {
00110 return 1;
00111 }
00112
00113 return 0;
00114 }
00115
00116