⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 widget.h

📁 Linux系统下的《红色警戒》游戏
💻 H
📖 第 1 页 / 共 2 页
字号:
/*      _______   __   __   __   ______   __   __   _______   __   __                  *     / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___  /\ /  |\/ /\                 *    / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /                  *   / / /__   / / // / // / // / /    / ___  / // ___  / // /| ' / /                   *  / /_// /\ / /_// / // / // /_/_   / / // / // /\_/ / // / |  / /                    * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /                     * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/                       * * Copyright (c) 2004, 2005 darkbits                        Js_./ * Per Larsson a.k.a finalman                          _RqZ{a<^_aa * Olof Naess閚 a.k.a jansem/yakslem                _asww7!uY`>  )\a// *                                                 _Qhm`] _f "'c  1!5m * Visit: http://guichan.darkbits.org             )Qk<P ` _: :+' .'  "{[ *                                               .)j(] .d_/ '-(  P .   S * License: (BSD)                                <Td/Z <fP"5(\"??"\a.  .L * Redistribution and use in source and          _dV>ws?a-?'      ._/L  #' * binary forms, with or without                 )4d[#7r, .   '     )d`)[ * modification, are permitted provided         _Q-5'5W..j/?'   -?!\)cam' * that the following conditions are met:       j<<WP+k/);.        _W=j f * 1. Redistributions of source code must       .$%w\/]Q  . ."'  .  mj$ *    retain the above copyright notice,        ]E.pYY(Q]>.   a     J@\ *    this list of conditions and the           j(]1u<sE"L,. .   ./^ ]{a *    following disclaimer.                     4'_uomm\.  )L);-4     (3= * 2. Redistributions in binary form must        )_]X{Z('a_"a7'<a"a,  ]"[ *    reproduce the above copyright notice,       #}<]m7`Za??4,P-"'7. ).m *    this list of conditions and the            ]d2e)Q(<Q(  ?94   b-  LQ/ *    following disclaimer in the                <B!</]C)d_, '(<' .f. =C+m *    documentation and/or other materials      .Z!=J ]e []('-4f _ ) -.)m]' *    provided with the distribution.          .w[5]' _[ /.)_-"+?   _/ <W" * 3. Neither the name of Guichan nor the      :$we` _! + _/ .        j? *    names of its contributors may be used     =3)= _f  (_yQmWW$#(    " *    to endorse or promote products derived     -   W,  sQQQQmZQ#Wwa].. *    from this software without specific        (js, \[QQW$QWW#?!V"". *    prior written permission.                    ]y:.<\..          . *                                                 -]n w/ '         [. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT       )/ )/           ! * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY         <  (; sac    ,    ' * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,               ]^ .-  % * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF            c <   r * MERCHANTABILITY AND FITNESS FOR A PARTICULAR            aga<  <La * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE          5%  )P'-3L * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR        _bQf` y`..)a * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          ,J?4P'.P"_(\?d'., * EXEMPLARY, OR CONSEQUENTIAL DAMAGES               _Pa,)!f/<[]/  ?" * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT      _2-..:. .r+_,.. . * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     ?a.<%"'  " -'.a_ _, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                     ^ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */#ifndef GCN_WIDGET_HPP#define GCN_WIDGET_HPP#include <list>#include <string>#include "guichan/actionlistener.h"#include "guichan/color.h"#include "guichan/defaultfont.h"#include "guichan/font.h"#include "guichan/graphics.h"#include "guichan/keyinput.h"#include "guichan/keylistener.h"#include "guichan/mouseinput.h"#include "guichan/mouselistener.h"#include "guichan/rectangle.h"#include "guichan/platform.h"namespace gcn{    /*     * Exists for the widget class to compile.     */    class FocusHandler;    /*     * Exists for the widget class to compile.     */    class BasicContainer;    /**     * Widget base class. Contains basic widget functions every widget should     * have. Widgets should inherit from this class and implements it's     * functions.     *     * NOTE: Functions begining with underscore "_" should not     *       be overloaded unless you know what you are doing.     */    class GCN_CORE_DECLSPEC Widget    {    public:        /**         * Constructor. Resets member variables. Noteable, a widget is not         * focusable as default, therefore, Widgets that are supposed to be         * focusable should overide this default in their own constructor.         */        Widget();            /**         * Default destructor.         */        virtual ~Widget();        /**         * Draws the Widget. It is called by the parent widget when it is time         * for the Widget to draw itself. The graphics object is set up so         * that all drawing is relative to the Widget, i.e coordinate (0,0) is         * the top-left corner of the Widget. It is not possible to draw         * outside of a Widgets dimension.         *         * @param graphics a Graphics object to draw with.         */        virtual void draw(Graphics* graphics) = 0;                /**         * Draws a the Widget border. A border is drawn around a Widget.         * The width and height of the border is therefore the Widgets         * height+2*bordersize. Think of a painting that has a certain size,         * the border surrounds the painting.          *         * @param graphics a Graphics object to draw with.         */        virtual void drawBorder(Graphics* graphics) { }                /**         * Called for all Widgets in the gui each time Gui::logic is called.         * You can do logic stuff here like playing an animation.         *         * @see Gui         */        virtual void logic() { }            /**         * Gets the Widget parent container.         *         * @return the Widget parent container. Returns NULL if the Widget         *         has no parent.                  */        virtual BasicContainer* getParent() const;            /**         * Sets the width of the Widget in pixels.         *         * @param width the Widget width in pixels.         */        virtual void setWidth(int width);        /**         * Gets the width of the Widget in pixels.         *         * @return the Widget with in pixels.         */        virtual int getWidth() const;            /**         * Sets the height of the Widget in pixels.         *         * @param height the Widget height in pixels.         */        virtual void setHeight(int height);        /**         * Gets the height of the Widget in pixels.         *         * @return the Widget height in pixels.         */        virtual int getHeight() const;        /**         * Sets the size of the Widget.         *         * @param width the width.         * @param height the height.         */        virtual void setSize(int width, int height);                /**         * Set the Widget x coordinate. It is relateive to it's parent.         *         * @param x the Widget x coordinate.         */        virtual void setX(int x);        /**         * Gets the Widget x coordinate. It is relative to it's parent.         *         * @return the Widget x coordinate.         */        virtual int getX() const;        /**         * Set the Widget y coordinate. It is relative to it's parent.         *         * @param y the Widget y coordinate.          */        virtual void setY(int y);        /**         * Gets the Widget y coordinate. It is relative to it's parent.         *         * @return the Widget y coordinate.         */        virtual int getY() const;        /**         * Sets the Widget position. It is relative to it's parent.         *         * @param x the Widget x coordinate.         * @param y the Widgets y coordinate.         */        virtual void setPosition(int x, int y);            /**         * Sets the dimension of the Widget. It is relative to it's parent.         *         * @param dimension the Widget dimension.         */        virtual void setDimension(const Rectangle& dimension);        /**         * Sets the size of the border, or the width if you so like. The size         * is the number of pixels that the border extends outside the Widget.         * Border size = 0 means no border.                  *         * @param borderSize the size of the border.         * @see drawBorder                 */        virtual void setBorderSize(unsigned int borderSize);        /**         * Gets the size of the border, or the width if you so like. The size         * is the number of pixels that the border extends outside the Widget.         * Border size = 0 means no border.                               *         * @return the size of the border.         * @see drawBorder                  */        virtual unsigned int getBorderSize() const;                /**         * Gets the dimension of the Widget. It is relative to it's parent.         *         * @return the widget dimension.         */        virtual const Rectangle& getDimension() const;        /**         * Sets a Widgets focusability.         *         * @param focusable true if the Widget should be focusable.         */        virtual void setFocusable(bool focusable);        /**         * Checks whether the Widget is focusable.         *         * @return true if the widget is focusable.         */        virtual bool isFocusable() const;                /**         * Checks if the Widget has focus.         *         * @return true if the widget currently has focus.         */        virtual bool hasFocus() const;        /**         * Sets the Widget to be disabled or enabled. A disabled         * Widget will never recieve mouse or key input.         *         * @param enabled true if Widget is enabled.         */        virtual void setEnabled(bool enabled);        /**         * Checks if a Widget is disabled or not.         *         * @return true if the Widget should be enabled.         */        virtual bool isEnabled() const;                 /**         * Called if the Widget looses focus.         */        virtual void lostFocus() { };            /**         * Called if the Widget recieves focus.                */        virtual void gotFocus() { };            /**         * Checks if the Widget has the mouse.         *         * @return true if the Widget has the mouse.         */        virtual bool hasMouse() const;            /**         * Sets the Widget to be visible.         *         * @param visible true if the Widget should be visiable.         */        virtual void setVisible(bool visible);        /**         * Checks if the Widget is visible.         *         * @return true if the Widget is visible.         */        virtual bool isVisible() const;        /**         * Sets the base color. The base color is the background         * color for many Widgets like the Button and Contianer Widgets.         *         * @param color the baseground Color.         */        virtual void setBaseColor(const Color& color);        /**         * Gets the base color.         *         * @return the foreground Color.         */        virtual const Color& getBaseColor() const;            /**         * Sets the foreground color.         *         * @param color the foreground Color.         */        virtual void setForegroundColor(const Color& color);        /**         * Gets the foreground color.         *         * @return the foreground Color.         */        virtual const Color& getForegroundColor() const;            /**         * Sets the background color.         *         * @param color the background Color.         */        virtual void setBackgroundColor(const Color& color);        /**         * Gets the background color.         *         * @return the background Color.         */        virtual const Color& getBackgroundColor() const;            /**         * Sets the disabled color.         *         * @param color the disabled Color.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -