M2DPreview.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #pragma once
  2. #include "Drawing.h"
  3. namespace Framework
  4. {
  5. class Model2D; //! Model2D.h
  6. class Model2DData; //! Model2D.h
  7. class Border; //! Border.h
  8. class AlphaFeld; //! AlphaField.h
  9. struct MausEreignis; //! MouseEvent.h
  10. //! A 2D GUI framework drawing that displays a 2D model
  11. class M2DVorschau : public DrawableBackground
  12. {
  13. public:
  14. class Style : public DrawableBackground::Style
  15. {
  16. public:
  17. //! If this style is set, the user can scale the model
  18. //! by scrolling
  19. static const __int64 UsrScale = 0x001000;
  20. //! If this style is set, the user can move the model
  21. //! via drag and drop
  22. static const __int64 UsrMove = 0x002000;
  23. //! If this style is set, the user can rotate the model
  24. //! with the right mouse button
  25. static const __int64 UsrRot = 0x004000;
  26. };
  27. private:
  28. Model2D* mdl;
  29. Border* ram;
  30. AlphaFeld* af;
  31. int bgF;
  32. int mx;
  33. int my;
  34. //! Processes mouse messages
  35. //! \param me The event triggered by the mouse input
  36. DLLEXPORT void doMausEreignis(MausEreignis& me, bool userRet) override;
  37. public:
  38. //! Constructor
  39. DLLEXPORT M2DVorschau();
  40. //! Destructor
  41. DLLEXPORT virtual ~M2DVorschau();
  42. //! Sets a pointer to the model to display
  43. //! \param mdl The model
  44. DLLEXPORT void setModel2DZ(Model2D* mdl);
  45. //! Sets the data of the model to display
  46. //! \param mdl The data
  47. DLLEXPORT void setModel2D(Model2DData* mdl);
  48. //! Updates the object. Called by the framework
  49. //! \param tickVal The time in seconds since the last call
  50. //! of this function \return 1 if something changed
  51. //! and the image needs to be redrawn. 0 otherwise
  52. DLLEXPORT bool tick(double tv) override;
  53. //! Draws the object to zRObj if it is visible
  54. //! \param zRObj The image to draw into
  55. DLLEXPORT void render(Image& rb) override;
  56. //! Returns the displayed model without increased reference counter
  57. DLLEXPORT Model2D* zModel() const;
  58. //! Returns the displayed model
  59. DLLEXPORT Model2D* getModel() const;
  60. //! Creates a copy of the drawing that can be used without affecting the
  61. //! original
  62. DLLEXPORT Drawable* dublizieren() const override;
  63. };
  64. } // namespace Framework