home *** CD-ROM | disk | FTP | other *** search
/ Geek 6 / Geek-006.iso / linux / video / xmovie-1.5.3.tar.gz / xmovie-1.5.3.tar / xmovie-1.5.3 / guicast / bcpot.h < prev    next >
C/C++ Source or Header  |  2000-11-29  |  3KB  |  134 lines

  1. #ifndef BCPOT_H
  2. #define BCPOT_H
  3.  
  4. #include "bcpixmap.h"
  5. #include "vframe.inc"
  6. #include "bcsubwindow.h"
  7.  
  8. #define POT_UP 0
  9. #define POT_HIGH 1
  10. #define POT_DN 2
  11. #define POT_STATES 3
  12.  
  13. class  BC_FPot;
  14. class  BC_IPot;
  15. class  BC_PercentagePot;
  16.  
  17. class BC_Pot : public BC_SubWindow
  18. {
  19. public:
  20.     BC_Pot(int x, int y, VFrame **data);
  21.     virtual ~BC_Pot();
  22.  
  23.     friend BC_FPot;
  24.     friend BC_IPot;
  25.     friend BC_PercentagePot;
  26.  
  27.     int initialize();
  28.     virtual float get_percentage() { return 0; };
  29.     virtual int percentage_to_value(float percentage) { return 0; };
  30.     virtual int handle_event() { return 0; };
  31.     virtual char* get_caption() { return ""; };
  32.     virtual int increase_value() { return 0; };
  33.     virtual int decrease_value() { return 0; };
  34.  
  35.     int reposition_window(int x, int y);
  36.     int repeat_event(long repeat_id);
  37.     int cursor_enter_event();
  38.     int cursor_leave_event();
  39.     int button_press_event();
  40.     int button_release_event();
  41.     int cursor_motion_event();
  42.     int keypress_event();
  43.  
  44. private:
  45.     int set_data(VFrame **data);
  46.     int draw();
  47.     float percentage_to_angle(float percentage);
  48.     float angle_to_percentage(float angle);
  49.     int angle_to_coords(int &x1, int &y1, int &x2, int &y2, float angle);
  50.     float coords_to_angle(int x2, int y2);
  51.     void show_value_tooltip();
  52.     
  53.     VFrame **data;
  54.     BC_Pixmap *images[POT_STATES];
  55.     char caption[BCTEXTLEN], temp_tooltip_text[BCTEXTLEN];
  56.     int status;
  57.     long keypress_tooltip_timer;
  58.     float angle_offset;
  59.     float start_cursor_angle;
  60.     float start_needle_angle;
  61.     float prev_angle, angle_correction;
  62. };
  63.  
  64. class BC_FPot : public BC_Pot
  65. {
  66. public:
  67.     BC_FPot(int x, 
  68.         int y, 
  69.         float value, 
  70.         float minvalue, 
  71.         float maxvalue, 
  72.         VFrame **data = 0);
  73.     ~BC_FPot();
  74.  
  75.     char* get_caption();
  76.     int increase_value();
  77.     int decrease_value();
  78.     float get_percentage();
  79.     float get_value();
  80.     int percentage_to_value(float percentage);
  81.     void update(float value);
  82.  
  83. private:
  84.     float value, minvalue, maxvalue;
  85. };
  86.  
  87. class BC_IPot : public BC_Pot
  88. {
  89. public:
  90.     BC_IPot(int x, 
  91.         int y, 
  92.         long value, 
  93.         long minvalue, 
  94.         long maxvalue, 
  95.         VFrame **data = 0);
  96.     ~BC_IPot();
  97.  
  98.     char* get_caption();
  99.     int increase_value();
  100.     int decrease_value();
  101.     float get_percentage();
  102.     int percentage_to_value(float percentage);
  103.     long get_value();
  104.     void update(long value);
  105.  
  106. private:
  107.     long value, minvalue, maxvalue;
  108. };
  109.  
  110. class BC_PercentagePot : public BC_Pot
  111. {
  112. public:
  113.     BC_PercentagePot(int x, 
  114.         int y, 
  115.         float value, 
  116.         float minvalue, 
  117.         float maxvalue, 
  118.         VFrame **data = 0);
  119.     ~BC_PercentagePot();
  120.  
  121.     char* get_caption();
  122.     int increase_value();
  123.     int decrease_value();
  124.     float get_percentage();
  125.     float get_value();
  126.     int percentage_to_value(float percentage);
  127.     void update(float value);
  128.  
  129. private:
  130.     float value, minvalue, maxvalue;
  131. };
  132.  
  133. #endif
  134.