/usr/include/fifechan/widgets/iconprogressbar.hpp is in libfifechan-dev 0.1.4-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | /***************************************************************************
* Copyright (c) 2017 by the fifechan team *
* https://github.com/fifengine/fifechan *
* This file is part of fifechan. *
* *
* fifechan is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef FCN_ICONPROGRESSBAR_HPP
#define FCN_ICONPROGRESSBAR_HPP
#include <fifechan/widget.hpp>
#include <vector>
namespace fcn
{
class Container;
class Graphics;
class Icon;
class Image;
class FCN_CORE_DECLSPEC IconProgressBar : public Widget
{
public:
enum Orientation
{
HORIZONTAL = 0,
VERTICAL
};
/**
* Default constructor.
*/
IconProgressBar();
/**
* Constructor. The image passed is not owned by this object.
*
* @param image Image used by the progress bar's icons.
* @param maxIcons Count of icons when the progress bar is full.
*/
IconProgressBar(Image* image, int maxIcons);
/**
* Constructor. The image indicated by filename is opened and it's
* owned by this object.
*
* @param filename Filename of the image to be used by the progress bar's icons.
* @param maxIcons Count of icons when the progress bar is full.
*/
IconProgressBar(const std::string& filename, int maxIcons);
/**
* Destructor.
*/
virtual ~IconProgressBar();
/**
* Draws this IconProgressBar.
*/
virtual void draw(Graphics* graphics);
/**
* Returns children area of this IconProgressBar.
*/
virtual Rectangle getChildrenArea();
/**
* Sets the opacity of the IconProgressBar.
*
* @param opaque True if opaque, false otherwise.
*/
void setOpaque(bool opaque);
/**
* @return Whether this IconProgressBar is opaque or not.
*/
bool isOpaque() const;
/**
* Sets the IconProgressBar's image. The image passed is not owned by
* this object.
*
* @param image Image used by the progress bar's icons.
* @see setMaxIcons
*/
void setImage(Image* image);
/**
* @return The image used by this IconProgressBar.
*/
const Image* getImage() const;
/**
* Sets count of icons when the progress bar is full.
* Also creates enough icons to represent that.
*
* @param maxIcons desired maximum count of icons.
*/
void setMaxIcons(int maxIcons);
/**
* @return Maximum count of icons for this IconProgressBar.
*/
int getMaxIcons() const;
/**
* Sets the IconProgressBar's orientation.
*
* @param orientation Desired orientation.
*/
void setOrientation(Orientation orientation);
/**
* @return Orientation of this IconProgressBar.
*/
Orientation getOrientation() const;
/**
* Advances the progress bar to use one more icon. If there can be no advancement
* (maxIcons is reached), then the counter is reset to 0, useful if client wishes
* to make the IconProgressBar looping.
*/
void advance();
/**
* Resets the progress bar.
*/
void reset();
protected:
/**
* Creates icons needed by this progress bar.
* Makes them invisible.
*
* @param iconCount How many icons to create.
*/
void createIcons(int iconCount);
/**
* Destroys icons created for this progress bar.
*/
void destroyIcons();
/**
* Arranges icon positions in their container and
* resizes the container to fit them.
*/
void arrangeIcons();
/**
* Image used by the progress bar.
*/
const Image* mImage;
/**
* True if the image has been loaded internally, false otherwise.
* An image not loaded internally should not be deleted in the
* destructor.
*/
bool mInternalImage;
/**
* Count of icons when progress bar is full.
*/
int mMaxIcons;
/**
* Holds how many icons are currently displayed.
*/
int mIconCounter;
/**
* IconProgressBar's orientation.
*/
Orientation mOrientation;
/**
* Holds if the progress bar should be reset during the next advancement.
*/
bool mShouldReset;
/**
* Container holding the icon objects.
*/
Container* mContents;
/**
* Vector holding the icons used for fast access.
*/
std::vector<Icon*> mIcons;
};
};
#endif //FCN_ICONPROGRESSBAR_HPP
|