#ifndef Window_H
#define Window_H

#include "Array.h"
#include "Drawing.h"

namespace Framework
{
    class VScrollBar;        //! Scroll.h
    class HScrollBar;        //! Scroll.h
    class TextField;         //! TextField.h
    class Border;            //! Border.h
    class Screen;            //! Screen.h
    class AlphaField;        //! AlphaField.h
    class Font;              //! Font.h
    class Text;              //! Text.h
    class Image;             //! Image.h
    class NativeWindow;      //! from this file
    class NativeWindowArray; //! from this file
    class Window;            //! from this file
#ifdef WIN32
    //! Creates a normal window class of the Windows API
    //! \param hInst The HINSTANCE of the program (passed by the Framework to
    //! the start function in the Startparam structure)
    DLLEXPORT WNDCLASS F_Normal(HINSTANCE hInst);
    //! Creates a normal window class of the Windows API
    //! \param hInst The HINSTANCE of the program (passed by the Framework to
    //! the start function in the Startparam structure)
    DLLEXPORT WNDCLASSEX F_NormalEx(HINSTANCE hInst);
    //! Framework function that processes all messages from Windows or other
    //! processes
    DLLEXPORT LRESULT CALLBACK WindowProc(
        HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
    //! Starts a loop that processes user input. The loop runs until
    //! StopMessageLoop is called somewhere in the program
    DLLEXPORT void StartMessageLoop();
    //! Stops the execution of the framework's message loop.
    //! \param hwnd A handle to any framework window that can receive
    //! messages. Required to send a message so that StartMessageLoop
    //! stops waiting and exits immediately
    DLLEXPORT void StopMessageLoop(HWND hwnd);
    //! Translates a keycode sent by Windows into the character of the
    //! pressed key
    DLLEXPORT void CalculateEnteredString(
        int virtualKeyCode, int scanCode, KeyboardEvent& te);

    //! Class for a Windows API window
    class NativeWindow : public virtual ReferenceCounter
    {
    private:
        HWND hWnd; //! Handle to the window
        int style;
        void* makParam;
        void* sakParam;
        void* takParam;
        MouseAction mouseAction;
        std::function<void(void*, void*)> preCloseAction;
        std::function<void(void*, void*)> postCloseAction;
        KeyboardAction keyboardAction;
        Screen* screen;
        int mx, my;
        bool movable;
        HWND border;
        HBITMAP bitmap;
        HDC hdc;

    public:
        //--Constructor--
        DLLEXPORT NativeWindow();
        //--Constructor--
        //! \param hwnd A handle to the window that should be managed by this
        //! class
        DLLEXPORT NativeWindow(HWND hWnd);
        //--Destructor--
        DLLEXPORT ~NativeWindow();
        //! Creates the window
        //! \param style The style of the window. Example: WS_OVERLAPPEDWINDOW
        //! (for a normal window) \param wc The Windows API window class from
        //! which a window should be created. Can be created with the F_Normal
        //! function. lpszClassName must have been set.
        DLLEXPORT void create(int style, WNDCLASS wc);
        //! Creates the window
        //! \param exStyle The EX style of the window. Example:
        //! WS_EX_OVERLAPPEDWINDOW (for a normal window)
        //! \param style The style of the window. Example: WS_OVERLAPPEDWINDOW
        //! (for a normal window) \param wc The Windows API window class from
        //! which a window should be created. Can be created with the F_Normal
        //! function. lpszClassName must have been set.
        DLLEXPORT void createEx(int exStyle, int style, WNDCLASSEX wc);
        //! Sets the display mode of the window
        //! \param mod The mode. Example: SW_SHOWNORMAL to show the window
        //! and SW_HIDE to minimize it
        DLLEXPORT void setDisplayMode(int mod);
        //! Sets the focus to the window so that keyboard input is received
        DLLEXPORT bool setFocus();
        //! Sets the position of the window on the screen
        //! \param pos The position in pixels
        DLLEXPORT void setPosition(const Point& pos);
        //! Sets the position of the window on the screen
        //! \param x The X position in pixels
        //! \param y The Y position in pixels
        DLLEXPORT void setPosition(int x, int y);
        //! Sets the size of the window on the screen
        //! \param gr\u00f6\u00dfe The size in pixels
        DLLEXPORT void setSize(Point& groesse);
        //! Sets the size of the window on the screen
        //! \param Width The width in pixels
        //! \param h\u00f6he The height in pixels
        DLLEXPORT void setSize(int Width, int height);
        //! Sets the position and size of the window
        //! \param pos The position in pixels
        //! \param gr\u00f6\u00dfe The size in pixels
        DLLEXPORT void setBounds(const Point& pos, const Point& groesse);
        //! Sets the screen object used to forward keyboard and mouse input
        //! to the framework's objects. Must be called with 0 before the
        //! window is destroyed. \param screen The screen object
        DLLEXPORT void setScreen(Screen* screen);
        //! Destroys the window
        DLLEXPORT void destroy();
        //! Processes mouse messages. Calls MouseAction and forwards events
        //! to the screen with objects if MouseAction returns 1
        //! \param me The event triggered by the mouse input
        DLLEXPORT void doMouseAction(MouseEvent& me);
        //! Calls the pre-close callback function
        DLLEXPORT void doPreCloseAction();
        //! Calls the post-close callback function
        DLLEXPORT void doPostCloseAction();
        //! Processes keyboard messages. Calls KeyboardAction and forwards
        //! events to the screen with objects if KeyboardAction returns 1
        //! \param me The event triggered by the keyboard input
        DLLEXPORT void doKeyboardAction(KeyboardEvent& et);
        //! Makes the window frame visible if loadBorderWindow was called
        DLLEXPORT void doRestoreMessage();
        //! Sets the parameter passed to the callback function on a mouse event
        //! \param p The parameter
        DLLEXPORT void setMouseEventParameter(void* p);
        //! Sets the parameter passed to the callback function on close
        //! \param p The parameter
        DLLEXPORT void setCloseEventParameter(void* p);
        //! Sets the parameter passed to the callback function on a keyboard
        //! event
        //! \param p The parameter
        DLLEXPORT void setKeyboardEventParameter(void* p);
        //! Sets the callback function to be called on a mouse event.
        //! If the callback returns 0 or was not set, the mouse event is not
        //! further processed by the window. The standard function __ret1ME
        //! can be used, defined in MouseEvent.h and always returns 1
        //! \param ak A pointer to the callback function
        DLLEXPORT void setMouseAction(MouseAction ak);
        //! Sets the callback function to be called before closing.
        //! \param ak A pointer to the callback function
        DLLEXPORT void setPreCloseAction(std::function<void(void*, void*)> ak);
        //! Sets the callback function to be called after closing.
        //! \param ak A pointer to the callback function
        DLLEXPORT void setPostCloseAction(std::function<void(void*, void*)> ak);
        //! Sets the callback function to be called on a keyboard event.
        //! If the callback returns 0 or was not set, the keyboard event is not
        //! further processed. The standard function __ret1TE can be used,
        //! defined in KeyboardEvent.h and always returns 1. Other standard
        //! functions are _onlyNumbersTE and _onlyHexTE also from
        //! KeyboardEvent.h \param ak A pointer to the callback function
        DLLEXPORT void setKeyboardAction(KeyboardAction ak);
        //! Sets the handle to the window that should be managed by this class
        //! \param hwnd The handle
        DLLEXPORT void setWindowHandle(HWND hWnd);
        //! Specifies whether the window can be moved by dragging with the mouse
        //! \param movable 1 if the window may be moved
        DLLEXPORT void setMovable(bool movable);
        //! Sets a transparent frame around the window
        //! \param zImage An image containing the frame
        //! \param hins The HINSTANCE of the program (passed by the Framework to
        //! the start function in the Startparam structure)
        DLLEXPORT void loadBorderWindow(Image* zImage,
            HINSTANCE hinst); //! sets a transparent frame around the window
        //! Returns the handle of the managed window
        DLLEXPORT HWND getWindowHandle() const;
        //! Returns the position of the window in pixels
        DLLEXPORT Point getPosition() const;
        //! Returns the size of the window in pixels
        DLLEXPORT Point getSize() const;
        //! Returns the size of the window body in pixels
        DLLEXPORT Point getBodySize() const;
        //! Returns the width of the window body in pixels
        DLLEXPORT int getBodyWidth() const;
        //! Returns the height of the window body in pixels
        DLLEXPORT int getBodyHeight() const;
        //! Returns whether a callback function for a mouse event was set
        DLLEXPORT bool hasMouseAction() const;
        //! Returns whether a callback function for the event before
        //! closing the window was set
        DLLEXPORT bool hasPreCloseAction() const;
        //! Returns whether a callback function for the event after
        //! closing the window was set
        DLLEXPORT bool hasPostCloseAction() const;
        //! Returns whether a callback function for a keyboard event
        //! was set
        DLLEXPORT bool hasKeyboardAction() const;
        //! Returns the screen to whose drawings the events are forwarded
        DLLEXPORT Screen* getScreen() const;
        //! Returns the screen without increased reference counter to whose
        //! drawings the events are forwarded
        DLLEXPORT Screen* zScreen() const;
        //! Returns whether the window is movable
        DLLEXPORT bool isMovable() const;
    };

    //! Manages all Windows API windows in the framework
    class NativeWindowArray
    {
    private:
        NativeWindowArray* next;
        NativeWindow* This;

    public:
        //! Constructor
        DLLEXPORT NativeWindowArray();
        //! Destructor
        DLLEXPORT ~NativeWindowArray();
        //! Adds a new window
        //! \param fenster The window
        DLLEXPORT bool addWindow(NativeWindow* fenster);
        //! Removes a window
        //! \param fenster The window
        DLLEXPORT bool removeWindow(NativeWindow* fenster);
        //! Returns the next element
        DLLEXPORT NativeWindowArray* getNext();
        //! Sets the next element to 0
        DLLEXPORT void setNext0();
        //! Deletes the element
        DLLEXPORT void del();
        //! Sends the pre-close event to a specific window
        //! \param hWnd The handle to the window
        DLLEXPORT bool sendPreCloseMessage(HWND hWnd);
        //! Sends the post-close event to a specific window
        //! \param hWnd The handle to the window
        DLLEXPORT bool sendPostCloseMessage(HWND hwnd);
        //! Sends a mouse event to a specific window
        //! \param hWnd The handle to the window
        //! \param me The event triggered by the mouse input
        DLLEXPORT bool sendMouseMessage(HWND hWnd, MouseEvent& me);
        //! Sends a keyboard event to a specific window
        //! \param hWnd The handle to the window
        //! \param me The event triggered by the keyboard input
        DLLEXPORT bool sendKeyboardMessage(HWND hwnd, KeyboardEvent& te);
        //! Sends the event triggered by opening the window to a specific
        //! window \param hWnd The handle to the window
        DLLEXPORT bool sendRestoreMessage(HWND hwnd);
        //! Returns the window of this entry
        DLLEXPORT NativeWindow* getThis();
    };

    //! Creates a Windows API popup window with a message
    //! \param hWnd A handle to the window that should be blocked until
    //! the popup window is closed. Can be 0 \param title The title
    //! of the popup window \param meldung The message to display in the
    //! window \param style Determines the icon displayed in the window.
    //! Example: MB_ICONERROR, MB_ICONINFORMATION
    DLLEXPORT void WMessageBox(
        HWND hWnd, Text* title, Text* meldung, UINT style);
#endif
    //! Window class in the program
    class Window : public Drawable
    {
    public:
        class Style : public Drawable::Style
        {
        public:
            //! Determines whether the window body has a background
            static const __int64 BodyBackground = 0x000000008;
            //! Determines whether alpha blending is used when drawing
            //! the body background
            static const __int64 BodyBAlpha = 0x000000010;
            //! Determines whether an image is used as the body background
            static const __int64 BodyBImage = 0x000000020;
            //! Determines whether the body has a color gradient
            static const __int64 BodyBuffered = 0x000000040;
            //! Determines whether the window has a title bar
            static const __int64 Title = 0x000000080;
            //! Determines whether the title bar has a background
            static const __int64 TitleBackground = 0x000000100;
            //! Determines whether alpha blending is used when drawing
            //! the title background
            static const __int64 TitleBAlpha = 0x000000200;
            //! Determines whether an image is used for the title background
            static const __int64 TitleBImage = 0x000000400;
            //! Determines whether the title bar has a color gradient
            static const __int64 TitleBuffered = 0x000000800;
            //! Determines whether a close button is displayed in the title bar
            static const __int64 Closable = 0x000001000;
            //! Determines whether the close button has a background
            static const __int64 ClosingBackground = 0x000002000;
            //! Determines whether alpha blending is used when drawing
            //! the close button background
            static const __int64 ClosingBAlpha = 0x000004000;
            //! Determines whether an image is used for the close button
            //! background
            static const __int64 ClosingBImage = 0x000008000;
            //! Determines whether the close button has a color gradient
            static const __int64 ClosingBuffer = 0x000010000;
            //! Determines whether the close button has a color gradient
            //! while being pressed
            static const __int64 ClosingClickBuffer = 0x000020000;
            //! Determines whether the user can move the window by holding
            //! the left mouse button in the title bar
            static const __int64 Movable = 0x000040000;
            //! Determines whether the user can change the width of the window
            //! by holding the left mouse button on the right or left window
            //! edge
            static const __int64 WidthChangeable = 0x000080000;
            //! Determines whether the user can change the height of the window
            //! by holding the left mouse button on the top or bottom window
            //! edge
            static const __int64 HeightChangeable = 0x000100000;
            //! Determines whether the user can change the title bar height
            //! by holding the left mouse button on the bottom edge of the title
            //! bar
            static const __int64 TitleHeightChangeable = 0x000200000;
            //! Determines whether there is a minimum window width
            static const __int64 MinWidth = 0x000400000;
            //! Determines whether there is a maximum window width
            static const __int64 MaxWidth = 0x000800000;
            //! Determines whether there is a minimum window height
            static const __int64 MinHeight = 0x001000000;
            //! Determines whether there is a maximum window height
            static const __int64 MaxHeight = 0x002000000;
            //! Determines whether there is a minimum body width
            static const __int64 BodyMinWidth = 0x004000000;
            //! Determines whether there is a maximum body width
            static const __int64 BodyMaxWidth = 0x008000000;
            //! Determines whether there is a minimum body height
            static const __int64 BodyMinHeight = 0x010000000;
            //! Determines whether there is a maximum body height
            static const __int64 BodyMaxHeight = 0x020000000;
            //! Determines whether a scrollbar appears at the right window edge
            static const __int64 VScroll = 0x040000000;
            //! Determines whether a scrollbar appears at the bottom window edge
            static const __int64 HScroll = 0x080000000;
            //! Determines whether mouse events should also be processed by
            //! drawings behind the window
            static const __int64 METransparent = 0x100000000;
            //! Determines whether the window has a border
            static const __int64 Border = 0x200000000;
            //! Determines whether the left side of the window is fixed when
            //! the size is changeable
            static const __int64 LeftPositionFixed = 0x400000000;
            //! Determines whether the right side of the window is fixed when
            //! the size is changeable
            static const __int64 RightPositionFixed = 0x800000000;
            //! Determines whether the top side of the window is fixed when
            //! the size is changeable
            static const __int64 TopPositionFixed = 0x1000000000;
            //! Determines whether the bottom side of the window is fixed when
            //! the size is changeable
            static const __int64 BottomPositionFixed = 0x2000000000;
            //! Determines whether the position and size of the title text field
            //! should remain unchanged
            static const __int64 CustomTitle = 0x4000000000;
            //! Combines flags MinHeight, MaxHeight, MaxWidth, MaxHeight
            static const __int64 min_max
                = MinHeight | MaxHeight | MaxWidth | MaxHeight;
            //! Combines flags BodyMinWidth, BodyMaxWidth, BodyMinHeight,
            //! BodyMaxWidth
            static const __int64 body_min_max
                = BodyMinWidth | BodyMaxWidth | BodyMinHeight | BodyMaxWidth;
            //! Combines flags VScroll, HScroll
            static const __int64 scroll = VScroll | HScroll;
            //! Combines flags TitleHeightChangeable, HeightChangeable,
            //! WidthChangeable, Movable
            static const __int64 notFixed = TitleHeightChangeable
                                          | HeightChangeable | WidthChangeable
                                          | Movable;

            //! Combines flags Visible, Enabled, Border, Title,
            //! TitleBuffered, Closable, ClosingImage, ClosingClickBuffer,
            //! Movable
            static const __int64 normal
                = Visible | Allowed | Border | Title | TitleBuffered | Closable
                | ClosingBImage | ClosingClickBuffer | Movable
                | MEIgnoreProcessed | MEIgnoreVisible | MEIgnoreParentInside
                | MEIgnoreInside;
        };

    private:
        MouseAction closingMe;
        void* closingMeParam;
        Border* border;
        TextField* title;
        RCArray<Drawable>* members;
        int bgBodyColor;
        Image* bgBodyPicture;
        AlphaField* bodyBuffer;
        int bgClosingColor;
        Image* bgClosingImage;
        AlphaField* closeBuffer;
        AlphaField* closeClickBuffer;
        VScrollBar* vScroll;
        HScrollBar* hScroll;
        Point min, max;
        Point kMin, kMax;
        bool closeClick, click;
        int moving;
        int mx, my;

    protected:
        //! Processes mouse messages
        //! \param me The event triggered by the mouse input
        DLLEXPORT void doMouseEvent(MouseEvent& me, bool userRet) override;

    public:
        //! Constructor
        DLLEXPORT Window();
        //! Destructor
        DLLEXPORT virtual ~Window();
        //! Sets a pointer to the window border
        //! \param ram The border
        DLLEXPORT void setBorderZ(Border* ram);
        //! Sets the color of the window border
        //! \param f The color in A8R8G8B8 format
        DLLEXPORT void setBorderColor(int f);
        //! Sets the width of the window border
        //! \param br The width in pixels
        DLLEXPORT void setBorderWidth(int br);
        //! Sets the title of the window
        //! \param txt The text
        DLLEXPORT void setTitel(Text* txt);
        //! Sets a pointer to the title text
        //! \param txt The new text
        DLLEXPORT void setTitelZ(Text* txt);
        //! Sets the title of the window
        //! \param txt The text
        DLLEXPORT void setTitel(const char* txt);
        //! Sets a pointer to the TextField that draws the title text
        //! \param tf The TextField
        DLLEXPORT void setTTextFieldZ(TextField* tf);
        //! Sets the font used for the title
        //! \param font The font
        DLLEXPORT void setTFontZ(Font* font);
        //! Sets the color of the font used for the title
        //! \param f The color in A8R8G8B8 format
        DLLEXPORT void setTFontColor(int f);
        //! Sets the size of the font used for the title
        //! \param gr The height of a line in pixels
        DLLEXPORT void setTFontSize(int gr);
        //! Sets the background color of the title
        //! \param f The color in A8R8G8B8 format
        DLLEXPORT void setTBgColor(int f);
        //! Sets a pointer to the color gradient of the title
        //! \param af The color gradient
        DLLEXPORT void setTAlphaFieldZ(AlphaField* af);
        //! Sets the color of the color gradient of the title
        //! \param f The color in A8R8G8B8 format
        DLLEXPORT void setTAfColor(int f);
        //! Sets the strength of the color gradient of the title
        //! \param st The strength
        DLLEXPORT void setTAfStrength(int st);
        //! Sets the background image of the title by copying
        //! \param b The image to copy
        DLLEXPORT void setTBgImage(Image* b);
        //! Sets a pointer to the background image of the title
        //! \param b The image
        DLLEXPORT void setTBgImageZ(Image* b);
        //! Sets a pointer to the border of the title
        //! \param ram The border
        DLLEXPORT void setTBorderZ(Border* ram);
        //! Sets the color of the border of the title
        //! \param f The color in A8R8G8B8 format
        DLLEXPORT void setTBorderColor(int f);
        //! Sets the width of the border of the title
        //! \param br The width in pixels
        DLLEXPORT void setTBorderWidth(int br);
        //! Sets the background color of the body
        //! \param f The color in A8R8G8B8 format
        DLLEXPORT void setBodyBgColor(int f);
        //! Sets the background image of the body by copying
        //! \param b The image to copy
        DLLEXPORT void setBodyBgImage(Image* b);
        //! Sets a pointer to the background image of the body
        //! \param b The image
        DLLEXPORT void setBodyBgImageZ(Image* b);
        //! Sets a pointer to the color gradient of the body
        //! \param af The color gradient
        DLLEXPORT void setBodyAlphaFieldZ(AlphaField* af);
        //! Sets the color of the color gradient of the body
        //! \param f The color in A8R8G8B8 format
        DLLEXPORT void setBodyAfColor(int f);
        //! Sets the strength of the color gradient of the body
        //! \param st The strength
        DLLEXPORT void setBodyAfStrength(int st);
        //! Sets the parameter of the callback function called when the close
        //! button receives a mouse event \param param The parameter
        DLLEXPORT void setClosingMeParam(void* param);
        //! Sets the callback function called when the close button receives
        //! a mouse event. If the callback returns 0 or was not set, the mouse
        //! event is not further processed by the drawing. The window is not
        //! closed automatically but should be closed in the callback by calling
        //! removeStyle( Window::Style::Visible );
        //! \param ak A pointer to the callback function
        DLLEXPORT void setClosingMe(MouseAction closingMe);
        //! Sets the background color of the close button
        //! \param f The color in A8R8G8B8 format
        DLLEXPORT void setCloseBgColor(int f);
        //! Sets the background image of the close button by copying
        //! \param b The image to copy
        DLLEXPORT void setCloseBgImage(Image* b);
        //! Sets a pointer to the background image of the close button
        //! \param b The image
        DLLEXPORT void setCloseBgImageZ(Image* b);
        //! Sets a pointer to the color gradient of the close button
        //! \param af The color gradient
        DLLEXPORT void setCloseAlphaFieldZ(AlphaField* af);
        //! Sets the color of the color gradient of the close button
        //! \param f The color in A8R8G8B8 format
        DLLEXPORT void setCloseAfColor(int f);
        //! Sets the strength of the color gradient of the close button
        //! \param st The strength
        DLLEXPORT void setCloseAfStrength(int st);
        //! Sets a pointer to the color gradient used when clicking the
        //! close button \param af The color gradient
        DLLEXPORT void setCloseClickAlphaFieldZ(AlphaField* af);
        //! Sets the color of the color gradient used when clicking the
        //! close button \param f The color in A8R8G8B8 format
        DLLEXPORT void setCloseClickAfColor(int f);
        //! Sets the strength of the color gradient used when clicking the
        //! close button \param st The strength
        DLLEXPORT void setCloseClickAfStrength(int st);
        //! Sets the minimum size of the window
        //! \param mx The minimum width in pixels
        //! \param my The minimum height in pixels
        DLLEXPORT void setMin(int mx, int my);
        //! Sets the minimum size of the window
        //! \param min The minimum width and height in pixels
        DLLEXPORT void setMin(const Point& min);
        //! Sets the maximum size of the window
        //! \param mx The maximum width in pixels
        //! \param my The maximum height in pixels
        DLLEXPORT void setMax(int mx, int my);
        //! Sets the maximum size of the window
        //! \param min The maximum width and height in pixels
        DLLEXPORT void setMax(const Point& max);
        //! Sets the minimum size of the window body
        //! \param mx The minimum width in pixels
        //! \param my The minimum height in pixels
        DLLEXPORT void setBodyMin(int mx, int my);
        //! Sets the minimum size of the window body
        //! \param min The minimum width and height in pixels
        DLLEXPORT void setBodyMin(const Point& min);
        //! Sets the maximum size of the window body
        //! \param mx The maximum width in pixels
        //! \param my The maximum height in pixels
        DLLEXPORT void setBodyMax(int mx, int my);
        //! Sets the maximum size of the window body
        //! \param min The maximum width and height in pixels
        DLLEXPORT void setBodyMax(const Point& max);
        //! Sets a pointer to the scrollbar at the bottom of the window
        //! \param hScroll The scrollbar
        DLLEXPORT void setHScrollBarZ(HScrollBar* hScroll);
        //! Sets a pointer to the scrollbar at the right of the window
        //! \param vScroll The scrollbar
        DLLEXPORT void setVScrollBarZ(VScrollBar* vScroll);
        //! Sets the maximum scroll width of the window body
        //! \param max The width in pixels
        DLLEXPORT void setHSBMax(int max);
        //! Sets the maximum scroll height of the window body
        //! \param max The height in pixels
        DLLEXPORT void setVSBMax(int max);
        //! Scrolls to a specific x position in the window body
        //! \param scroll The number of pixels the content should be shifted
        //! left
        DLLEXPORT void setHSBScroll(int scroll);
        //! Scrolls to a specific y position in the window body
        //! \param scroll The number of pixels the content should be shifted up
        DLLEXPORT void setVSBScroll(int scroll);
        //! Updates the horizontal scrollbar so that the max scroll size is set
        //! to the width of the content
        DLLEXPORT void updateHScroll();
        //! Updates the vertical scrollbar so that the max scroll size is set to
        //! the height of the content
        DLLEXPORT void updateVScroll();
        //! Adds a drawing to the window
        //! \param obj The drawing
        DLLEXPORT virtual void addMember(Drawable* obj);
        //! sets the position of a member to index. This changes the order of
        //! rendering and the order input events are processed
        DLLEXPORT void setMemberIndex(Drawable* zMember, int index);
        //! Removes a drawing from the window
        //! \param zObj The drawing (without increased reference counter)
        DLLEXPORT virtual void removeMember(Drawable* zObj);
        //! Removes all drawings from the window
        DLLEXPORT virtual void removeAll();
        //! Updates the object. Called by the framework
        //! \param tickVal The time in seconds since the last call
        //! of this function \return 1 if something changed
        //! and the image needs to be redrawn. 0 otherwise
        DLLEXPORT bool tick(double tickval) override;
        //! Processes keyboard messages
        //! \param me The event triggered by the keyboard input
        DLLEXPORT void doKeyboardEvent(KeyboardEvent& te) override;
        //! Draws the window to zRObj if it is visible
        //! \param zRObj The image to draw into
        DLLEXPORT void render(Image& zRObj) override;
        //! Returns the inner width of the drawing in pixels
        DLLEXPORT int getInnerWidth() const override;
        //! Returns the inner height of the drawing in pixels
        DLLEXPORT int getInnerHeight() const override;
        //! Returns the border of the window
        DLLEXPORT Border* getBorder() const;
        //! Returns the border of the window without increased reference counter
        DLLEXPORT Border* zBorder() const;
        //! Returns the color of the window border in A8R8G8B8 format
        DLLEXPORT int getBorderColor() const;
        //! Returns the width of the window border in pixels
        DLLEXPORT int getBorderWidth() const;
        //! Returns the title of the window
        DLLEXPORT Text* getTitel() const;
        //! Returns the title of the window without increased reference counter
        DLLEXPORT Text* zTitel() const;
        //! Returns the TextField used to draw the title
        DLLEXPORT TextField* getTTextField() const;
        //! Returns the TextField without increased reference counter used
        //! to draw the title
        DLLEXPORT TextField* zTTextField() const;
        //! Returns the font used for the title
        DLLEXPORT Font* getTFont() const;
        //! Returns the font without increased reference counter used for the
        //! title
        DLLEXPORT Font* zTFont() const;
        //! Returns the font color of the title in A8R8G8B8 format
        DLLEXPORT int getTFontColor() const;
        //! Returns the height of a line of the title in pixels
        DLLEXPORT int getTFontSize() const;
        //! Returns the background color of the title in A8R8G8B8 format
        DLLEXPORT int getTBgColor() const;
        //! Returns the color gradient of the title
        DLLEXPORT AlphaField* getTAlphaField() const;
        //! Returns the color gradient of the title without increased reference
        //! counter
        DLLEXPORT AlphaField* zTAlphaField() const;
        //! Returns the color of the color gradient of the title in A8R8G8B8
        //! format
        DLLEXPORT int getTAfColor() const;
        //! Returns the strength of the color gradient of the title
        DLLEXPORT int getTAfStrength() const;
        //! Returns the background image of the title
        DLLEXPORT Image* getTBgImage() const;
        //! Returns the background image of the title without increased
        //! reference counter
        DLLEXPORT Image* zTBgImage() const;
        //! Returns the border of the title
        DLLEXPORT Border* getTBorder() const;
        //! Returns the border of the title without increased reference counter
        DLLEXPORT Border* zTBorder() const;
        //! Returns the color of the title border in A8R8G8B8 format
        DLLEXPORT int getTBorderColor() const;
        //! Returns the width of the title border
        DLLEXPORT int getTBorderWidth() const;
        //! Returns the background color of the body
        DLLEXPORT int getBodyBgColor() const;
        //! Returns the background image of the body
        DLLEXPORT Image* getBodyBgImage() const;
        //! Returns the background image of the body without increased reference
        //! counter
        DLLEXPORT Image* zBodyBgImage() const;
        //! Returns the color gradient of the body
        DLLEXPORT AlphaField* getBodyAlphaField() const;
        //! Returns the color gradient of the body without increased reference
        //! counter
        DLLEXPORT AlphaField* zBodyAlphaField() const;
        //! Returns the color of the color gradient of the body in A8R8G8B8
        //! format
        DLLEXPORT int getBodyAfColor() const;
        //! Returns the strength of the color gradient of the body
        DLLEXPORT int getBodyAfStrength() const;
        //! Returns the background color of the close button in A8R8G8B8 format
        DLLEXPORT int getCloseBgColor() const;
        //! Returns the background image of the close button
        DLLEXPORT Image* getCloseBgImage() const;
        //! Returns the background image of the close button without increased
        //! reference counter
        DLLEXPORT Image* zCloseBgImage() const;
        //! Returns the color gradient of the close button
        DLLEXPORT AlphaField* getCloseAlphaField() const;
        //! Returns the color gradient of the close button without increased
        //! reference counter
        DLLEXPORT AlphaField* zCloseAlphaField() const;
        //! Returns the color of the color gradient of the close button in
        //! A8R8G8B8 format
        DLLEXPORT int getCloseAfColor() const;
        //! Returns the strength of the color gradient of the close button
        DLLEXPORT int getCloseAfStrength() const;
        //! Returns the color gradient used when the close button is pressed
        DLLEXPORT AlphaField* getCloseClickAlphaField() const;
        //! Returns the color gradient without increased reference counter
        //! used when the close button is pressed
        DLLEXPORT AlphaField* zCloseClickAlphaField() const;
        //! Returns the color of the color gradient in A8R8G8B8 format
        //! used when the close button is pressed
        DLLEXPORT int getCloseClickAfColor() const;
        //! Returns the strength of the color gradient used when the close
        //! button is pressed
        DLLEXPORT int getCloseClickAfStrength() const;
        //! Returns the minimum window size in pixels
        DLLEXPORT const Point& getMin() const;
        //! Returns the maximum window size in pixels
        DLLEXPORT const Point& getMax() const;
        //! Returns the minimum body size in pixels
        DLLEXPORT const Point& getBodyMin() const;
        //! Returns the maximum body size in pixels
        DLLEXPORT const Point& getBodyMax() const;
        //! Returns the scrollbar from the right window edge
        DLLEXPORT VScrollBar* getVScrollBar() const;
        //! Returns the scrollbar from the right window edge without increased
        //! reference counter
        DLLEXPORT VScrollBar* zVScrollBar() const;
        //! Returns the scrollbar from the bottom window edge
        DLLEXPORT HScrollBar* getHScrollBar() const;
        //! Returns the scrollbar from the bottom window edge without increased
        //! reference counter
        DLLEXPORT HScrollBar* zHScrollBar() const;
        //! Returns a list of drawings contained in the window
        DLLEXPORT const RCArray<Drawable>& getMembers() const;
        //! Returns the width needed by the children of the window
        DLLEXPORT int getNeededChildWidth() const;
        //! Returns the height needed by the children of the window
        DLLEXPORT int getNeededChildHeight() const;
        //! Creates a copy of the window that can be modified without
        //! affecting the original
        DLLEXPORT Drawable* duplicate() const override;
    };
} // namespace Framework
#endif