2017-11-04 07:03:53 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* fprogressbar.h - Widget FProgressbar *
|
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
2019-01-21 03:42:18 +01:00
|
|
|
* Copyright 2014-2019 Markus Gans *
|
2017-11-04 07:03:53 +01:00
|
|
|
* *
|
|
|
|
* The Final Cut 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 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* The Final Cut 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 program. If not, see *
|
|
|
|
* <http://www.gnu.org/licenses/>. *
|
|
|
|
***********************************************************************/
|
2017-10-02 07:32:33 +02:00
|
|
|
|
|
|
|
/* Inheritance diagram
|
|
|
|
* ═══════════════════
|
|
|
|
*
|
2017-10-29 14:27:50 +01:00
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FTerm ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲
|
|
|
|
* │
|
2017-10-02 07:32:33 +02:00
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
2017-10-29 14:27:50 +01:00
|
|
|
* ▕ FVTerm ▏ ▕ FObject ▏
|
2017-10-02 07:32:33 +02:00
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲ ▲
|
|
|
|
* │ │
|
|
|
|
* └─────┬─────┘
|
|
|
|
* │
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FWidget ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲
|
|
|
|
* │
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FProgressbar ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
*/
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#ifndef FPROGRESSBAR_H
|
|
|
|
#define FPROGRESSBAR_H
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-10-31 00:41:59 +01:00
|
|
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
|
|
|
#error "Only <final/final.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2017-09-17 21:32:46 +02:00
|
|
|
#include "final/fwidget.h"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
namespace finalcut
|
|
|
|
{
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FProgressbar
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FProgressbar : public FWidget
|
|
|
|
{
|
2017-09-11 03:06:02 +02:00
|
|
|
public:
|
|
|
|
// Using-declarations
|
|
|
|
using FWidget::setGeometry;
|
|
|
|
|
|
|
|
// Constructor
|
2018-12-10 01:48:26 +01:00
|
|
|
explicit FProgressbar(FWidget* = nullptr);
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
// Destructor
|
|
|
|
virtual ~FProgressbar();
|
|
|
|
|
|
|
|
// Accessors
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual const char* getClassName() const override;
|
|
|
|
std::size_t getPercentage();
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
// Mutators
|
2018-12-31 06:18:39 +01:00
|
|
|
void setPercentage (std::size_t);
|
2019-01-21 03:42:18 +01:00
|
|
|
virtual void setGeometry ( const FPoint&, const FSize&
|
|
|
|
, bool = true ) override;
|
2018-12-31 06:18:39 +01:00
|
|
|
bool setShadow (bool);
|
|
|
|
bool setShadow();
|
|
|
|
bool unsetShadow();
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
// Inquiries
|
2018-12-31 06:18:39 +01:00
|
|
|
bool hasShadow();
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
// Methods
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual void hide() override;
|
|
|
|
void reset();
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
private:
|
2018-10-18 23:50:06 +02:00
|
|
|
// Constants
|
2018-12-26 23:41:49 +01:00
|
|
|
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
2018-10-18 23:50:06 +02:00
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
// Methods
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual void draw() override;
|
|
|
|
void drawPercentage();
|
|
|
|
void drawBar();
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
// Data Members
|
2018-12-03 03:22:36 +01:00
|
|
|
std::size_t percentage{NOT_SET};
|
|
|
|
std::size_t bar_length{getWidth()};
|
2015-05-23 13:35:12 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
// FProgressbar inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FProgressbar::getClassName() const
|
|
|
|
{ return "FProgressbar"; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2018-10-18 23:50:06 +02:00
|
|
|
inline std::size_t FProgressbar::getPercentage()
|
2015-05-23 13:35:12 +02:00
|
|
|
{ return percentage; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FProgressbar::setShadow()
|
|
|
|
{ return setShadow(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FProgressbar::unsetShadow()
|
|
|
|
{ return setShadow(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FProgressbar::hasShadow()
|
2018-11-04 23:00:06 +01:00
|
|
|
{ return flags.shadow; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
} // namespace finalcut
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#endif // FPROGRESSBAR_H
|