1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
/*
* Seven Kingdoms: Ancient Adversaries
*
* Copyright 1997,1998 Enlight Software Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Filename : OSLIDCUS.H
// Description : Custom slide bar
#ifndef __OSLIDCUS_H
#define __OSLIDCUS_H
// -------- define type SlideBarFP ---------//
class SlideBar;
class SlideVBar;
typedef void (*SlideBarFP)(SlideBar *, int repaintBody);
typedef void (*SlideVBarFP)(SlideVBar *, int repaintBody);
// --------- define clas SlideBar
class SlideBar
{
public:
// screen representation
short scrn_x1;
short scrn_y1;
short scrn_x2;
short scrn_y2;
short scrn_bar_width;
short scroll_type; // 0 = slide, 1 = scroll bar
// assume the recno of the first is min_recno and
// last record is max_recno
// and you can view (view_size) records at a time
// and first record on the viewing area is view_recno
int min_recno;
int max_recno;
int view_size;
int view_recno;
char drag_flag;
// valid if drag_flag is true
short drag_cur_x; // mouse.cur_x when start dragging the mouse
short drag_rect_left; // rect_left() when start dragging
int drag_last_view_recno;
SlideBarFP disp_func;
public:
void init_slide(short x1, short y1, short x2, short y2, short barWidth, SlideBarFP dispFunc);
void init_scroll(short x1, short y1, short x2, short y2, int viewSize, SlideBarFP dispFunc);
void set(int minRecno, int maxRecno, int viewRecno);
int set_view_recno(int viewRecno);
void set_min_recno(int minRecno);
void set_max_recno(int maxRecno);
int is_empty();
int detect();
void paint();
void paint(int newViewRecno);
public:
// function for disp_func
short rect_left();
short rect_right();
int calc_view_recno(short scrnX);
int max_view_recno();
};
class SlideVBar
{
public:
// screen representation
short scrn_x1;
short scrn_y1;
short scrn_x2;
short scrn_y2;
short scrn_bar_height;
short scroll_type; // 0 = slide, 1 = scroll bar
// assume the recno of the first is min_recno and
// last record is max_recno
// and you can view (view_size) records at a time
// and first record on the viewing area is view_recno
int min_recno;
int max_recno;
int view_size;
int view_recno;
char drag_flag;
// valid if drag_flag is true
short drag_cur_y; // mouse.cur_y when start dragging the mouse
short drag_rect_top; // rect_top() when start dragging
int drag_last_view_recno;
SlideVBarFP disp_func;
public:
void init_slide(short x1, short y1, short x2, short y2, short barHeight, SlideVBarFP dispFunc);
void init_scroll(short x1, short y1, short x2, short y2, int viewSize, SlideVBarFP dispFunc);
void set(int minRecno, int maxRecno, int viewRecno);
int set_view_recno(int viewRecno);
void set_min_recno(int minRecno);
void set_max_recno(int maxRecno);
int is_empty();
int detect();
void paint();
void paint(int newViewRecno);
public:
// function for disp_func
short rect_top();
short rect_bottom();
int calc_view_recno(short scrnY);
int max_view_recno();
};
#endif
|