You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __FL_MRENDER_H__
  2. #define __FL_MRENDER_H__
  3. #include <FL/Fl.H>
  4. #include <FL/Fl_Box.H>
  5. #include <FL/Fl_Image.H>
  6. #include <FL/fl_draw.H>
  7. class Fl_MRender_Event {
  8. public:
  9. virtual int event(void *p, int i) = 0;
  10. };
  11. class Fl_MRender : public Fl_Box {
  12. public:
  13. Fl_MRender(int X, int Y, int W, int H, const char *l=0);
  14. virtual ~Fl_MRender();
  15. public:
  16. void dodraw( bool b ) { _bdraw = b; }
  17. bool dodraw() { return _bdraw; }
  18. void outstr( const char* str ) { _ostr = (char*)str; }
  19. char* outstr() { return _ostr; }
  20. public:
  21. void eventhandler( Fl_MRender_Event* p );
  22. Fl_MRender_Event* eventhandler(){ return _eventh; }
  23. Fl_Image* image() { return Fl_Box::image(); }
  24. public: /// override
  25. void draw();
  26. int handle(int h);
  27. void resize(int x, int y, int w, int h);
  28. void image( Fl_Image* img );
  29. private:
  30. void recalcimg(int w, int h);
  31. protected:
  32. bool _bdraw;
  33. bool _isInResize;
  34. unsigned int _orgw;
  35. unsigned int _orgh;
  36. unsigned int _putx;
  37. unsigned int _puty;
  38. unsigned int _putw;
  39. unsigned int _puth;
  40. char* _ostr;
  41. Fl_MRender_Event* _eventh;
  42. Fl_Image* _cachedimg;
  43. };
  44. #endif /// of __FL_MRENDER_H__