| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #ifndef Scroll_H
- #define Scroll_H
- #include "Betriebssystem.h"
- #include "ReferenceCounter.h"
- namespace Framework
- {
- class Bild; //! Bild.h
- struct MausEreignis; //! MausEreignis.h
- struct ScrollData
- {
- int anzeige;
- int max;
- int scrollPos;
- };
- //! The base class for horizontal and vertical scrollbars
- class ScrollBar : public virtual ReferenceCounter
- {
- protected:
- ScrollData* data;
- int knopfdruck;
- int farbe;
- int bgFarbe;
- bool bg;
- int klickScroll;
- int mx, my;
- bool mp;
- bool rend;
- public:
- //! Constructor
- DLLEXPORT ScrollBar();
- //! Destructor
- DLLEXPORT virtual ~ScrollBar();
- //! Sets the foreground color of the scrollbar
- //! \param fc The color in A8R8G8B8 format
- DLLEXPORT void setFarbe(int fc);
- //! Sets the background color of the scrollbar
- //! \param fc The color in A8R8G8B8 format
- //! \param bgF 1 if a background should be drawn
- DLLEXPORT void setBgFarbe(int fc, bool bgF);
- //! Updates the scrollbar
- //! \param maxGr The maximum size of the window in pixels
- //! \param anzeigeGr The displayed size of the window in pixels
- DLLEXPORT void update(int maxGr, int anzeigeGr);
- //! Sets the scroll speed
- //! \param klickScroll The number of pixels scrolled per click
- DLLEXPORT void setKlickScroll(int klickScroll);
- //! Scrolls to a specific position
- //! \param pos The position in pixels in the window from which drawing
- //! should start
- DLLEXPORT void scroll(int pos);
- //! Processes a mouse event
- //! \param x The X position of the scroll bar in the window
- //! \param y The Y position of the scroll bar in the window
- //! \param br The width of the scroll bar
- //! \param hi The height of the scroll bar
- //! \return 1 if the message was processed. Does not set the
- //! processed flag of the mouse event
- DLLEXPORT virtual bool doMausMessage(
- int x, int y, int br, int hi, MausEreignis& me)
- = 0;
- //! Returns whether the scrollbar has changed since the last call of
- //! this function
- DLLEXPORT bool getRend();
- //! Draws the scrollbar
- //! \param x The X position of the scroll bar
- //! \param y The Y position of the scroll bar
- //! \param br The width of the scroll bar
- //! \param hi The height of the scroll bar
- //! \param zRObj The image to draw into
- DLLEXPORT virtual void render(
- int x, int y, int br, int hi, Bild& zRObj) const = 0;
- //! Returns a pointer to the scroll data
- DLLEXPORT ScrollData* getScrollData() const;
- //! Returns the scroll speed. The number of pixels scrolled per click
- DLLEXPORT int getKlickScroll() const;
- //! Returns the foreground color of the scrollbar
- DLLEXPORT int getFarbe() const;
- //! Returns the background color of the scrollbar
- DLLEXPORT int getBgFarbe() const;
- //! Returns the current scroll position
- DLLEXPORT int getScroll() const;
- };
- //! A vertical scrollbar, as used in some 2D GUI drawings of the
- //! framework
- class VScrollBar : public ScrollBar
- {
- public:
- //! Constructor
- DLLEXPORT VScrollBar();
- //! Destructor
- DLLEXPORT virtual ~VScrollBar();
- //! Processes a mouse event
- //! \param x The X position of the scroll bar in the window
- //! \param y The Y position of the scroll bar in the window
- //! \param br The width of the scroll bar
- //! \param hi The height of the scroll bar
- //! \return 1 if the message was processed. Does not set the
- //! processed flag of the mouse event
- DLLEXPORT bool doMausMessage(
- int x, int y, int br, int hi, MausEreignis& me) override;
- //! Draws the scrollbar
- //! \param x The X position of the scroll bar
- //! \param y The Y position of the scroll bar
- //! \param br The width of the scroll bar
- //! \param hi The height of the scroll bar
- //! \param zRObj The image to draw into
- DLLEXPORT void render(
- int x, int y, int br, int hi, Bild& zRObj) const override;
- };
- //! A horizontal scrollbar, as used in some 2D GUI drawings of the
- //! framework
- class HScrollBar : public ScrollBar
- {
- public:
- //! Constructor
- DLLEXPORT HScrollBar();
- //! Destructor
- DLLEXPORT virtual ~HScrollBar();
- //! Processes a mouse event
- //! \param x The X position of the scroll bar in the window
- //! \param y The Y position of the scroll bar in the window
- //! \param br The width of the scroll bar
- //! \param hi The height of the scroll bar
- //! \return 1 if the message was processed. Does not set the
- //! processed flag of the mouse event
- DLLEXPORT bool doMausMessage(
- int x, int y, int br, int hi, MausEreignis& me) override;
- //! Draws the scrollbar
- //! \param x The X position of the scroll bar
- //! \param y The Y position of the scroll bar
- //! \param br The width of the scroll bar
- //! \param hi The height of the scroll bar
- //! \param zRObj The image to draw into
- DLLEXPORT void render(
- int x, int y, int br, int hi, Bild& zRObj) const override;
- };
- } // namespace Framework
- #endif
|