home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / powervww / pvdc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-05  |  4.8 KB  |  116 lines

  1. //  ____________________________________________________
  2. // |                                                    |
  3. // |  Project:     POWER VIEW INTERFACE                 |
  4. // |  File:        PVDC.H                               |
  5. // |  Compiler:    WPP386 (10.6)                        |
  6. // |                                                    |
  7. // |  Subject:     Device Context interface             |
  8. // |                                                    |
  9. // |  Author:      Emil Dotchevski                      |
  10. // |____________________________________________________|
  11. //
  12. // E-mail: zajo@geocities.com
  13. // URL:    http://www.geocities.com/SiliconValley/Bay/3577
  14.  
  15. void __init_dc( void );
  16.  
  17. #ifndef _PVDC_H
  18. #define _PVDC_H
  19.  
  20.   class Tdc
  21.   {
  22.   //<R> means read-only
  23.   //<R/W> means read/write
  24.     public:
  25.   #ifdef __FLAT__
  26.       word *address; //<R> characters buffer
  27.   #else
  28.       word far *address; //<R> characters buffer
  29.   #endif
  30.       uint len; //<R> characters buffer length
  31.       int x; //<R/W> screen-based x position
  32.       int y; //<R/W> screen-based y position
  33.       uint xl; //<R> width
  34.       uint yl; //<R> heigh
  35.       int base_x; //<R> logical 0 x
  36.       int base_y; //<R> logical 0 y
  37.       int cursor_x; //<R> logical cursor x-position
  38.       int cursor_y; //<R> logical cursor y-position
  39.       uint cursor_ofs; //<R> cursor offset: 2 * ( cursor_y * xl + cursor_x )
  40.       int region_x; //<R> clip region x
  41.       int region_y; //<R> clip region y
  42.       int region_xl; //<R> clip region width
  43.       int region_yl; //<R> clip region heigh
  44.       int ®ion_x1; //<R> clip region left bound
  45.       int ®ion_y1; //<R> clip region top bound
  46.       int region_x2; //<R> clip region right bound
  47.       int region_y2; //<R> clip region bottom bound
  48.       Tdc( void );
  49.       Tdc( uint _xl, uint _yl );
  50.       virtual ~Tdc( void );
  51.       void set_region( int _x, int _y, uint _xl, uint _yl ); //specify clip region
  52.       void set_region_xy( int x1, int y1, int x2, int y2 ); //specify clip region
  53.       void invalidate( int _x, int _y, uint _xl, uint _yl ); //invalidate rectangle
  54.       void invalidate_xy( int x1, int y1, int x2, int y2 ); //invalidate rectangle
  55.       void validate( void ); //validate all
  56.       void goto_xy( int _x, int _y ); //set logical cursor position
  57.       void goto_ofs( uint cur_ofs ); //set logical cursor offset
  58.       int where_x( void ); //return logical cursor x-position
  59.       int where_y( void ); //return logical cursor y-position
  60.       void set_base( int _x, int _y ); //set logical 0 position
  61.       void home( void ); //clear dc
  62.       void fill_dc( char c ); //fill dc w/ char c
  63.       virtual void print( word *p, int l ); //print formatted line
  64.       void direct_txt( char *t ); //direct write to dc
  65.       void txt( char *t ); //formatted write to dc
  66.       void direct_txtf( char *t, ... ); //C-style formatted direct write to dc
  67.       void txtf( char *t, ... ); //C-style formatted formatted write to dc
  68.       void draw( void ); //draw this dc in current dc
  69.   };
  70.  
  71.   class Tscreen_dc : public Tdc
  72.   {
  73.     public:
  74.       Tscreen_dc( void );
  75.       virtual ~Tscreen_dc( void );
  76.       virtual void print( word *p, int l ); //print formatted line, avoid mouse pointer colision
  77.       void update_cursor( void ); //set hardware cursor at where_x, where_y
  78.   };
  79.  
  80. #endif
  81.  
  82. void set_dc( Tdc *dc ); //set current (active) dc
  83. uint smart_len( char *str ); //calculate actual formatted string length
  84. uint smart_index( char *str, uint i ); //convert i to actual formatted string index
  85. boolean rect_colision( int _x, int _y, uint _xl, uint _yl,
  86.   int &a, int &b, uint &al, uint &bl ); //check rectangle overlap, set up a, b, al, bl to overlapped area
  87. boolean rect_colision_xy( int x1, int y1, int x2, int y2,
  88.   int &a1, int &b1, int &a2, int &b2 ); //check rectangle overlap, set up a1, b1, a2, b2 to overlapped area
  89.  
  90. //CURRENT DC-BASED FUNCTIONS
  91.  
  92. void set_region( int _x, int _y, uint _xl, uint _yl ); //set clip region
  93. void set_region_xy( int x1, int y1, int x2, int y2 ); //set clip region
  94. void goto_xy( int _x, int _y ); //set cursor position
  95. void goto_ofs( uint cur_ofs ); //set cursor offset
  96. int where_x( void ); //return cursor x position
  97. int where_y( void ); //return cursor y position
  98. void set_base( int _x, int _y ); //set logical 0 position
  99. void home( void ); //clear dc
  100. void fill_dc( char c ); //fill dc w/ char c
  101. void print( word *p, int l ); //print formatted line
  102. void direct_txt( char *t ); //direct write to dc
  103. void txt( char *t ); //formatted write to dc
  104. void direct_txtf( char *t, ... ); //C-style formatted direct write to dc
  105. void txtf( char *t, ... ); //C-style formatted formatted write to dc
  106.  
  107. #ifdef DECLARE_PVDC
  108. Tscreen_dc *screen_dc;
  109. Tdc *current_dc;
  110. boolean draw_on_screen;
  111. #else
  112. extern Tscreen_dc *screen_dc;
  113. extern Tdc *current_dc;
  114. extern boolean draw_on_screen;
  115. #endif
  116.