finalcut/src/include/final/ftooltip.h

129 lines
4.0 KiB
C
Raw Normal View History

2017-11-04 07:03:53 +01:00
/***********************************************************************
* ftooltip.h - Widget FToolTip *
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2016-2018 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/>. *
***********************************************************************/
/* Inheritance diagram
*
*
*
* FTerm
*
*
*
*
* FVTerm FObject
*
*
*
*
*
*
* FWidget
*
*
*
*
* FWindow
*
*
*
*
* FToolTip
*
*/
#ifndef FTOOLTIP_H
#define FTOOLTIP_H
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
#error "Only <final/final.h> can be included directly."
#endif
2017-09-11 03:06:02 +02:00
#include <vector>
#include "final/fwindow.h"
namespace finalcut
{
//----------------------------------------------------------------------
// class FToolTip
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FToolTip : public FWindow
{
2017-09-11 03:06:02 +02:00
public:
// Constructor
explicit FToolTip (FWidget* = 0);
2018-11-20 21:11:04 +01:00
explicit FToolTip (const FString&, FWidget* = 0);
2017-09-11 03:06:02 +02:00
// Destructor
virtual ~FToolTip ();
// Accessors
const char* getClassName() const;
const FString getText() const;
// Mutators
void setText (const FString&);
// Methods
virtual void draw();
2018-09-24 04:02:35 +02:00
virtual void show();
virtual void hide();
2017-09-11 03:06:02 +02:00
// Event handler
2018-09-24 04:02:35 +02:00
virtual void onMouseDown (FMouseEvent*);
2017-09-11 03:06:02 +02:00
private:
// Disable copy constructor
FToolTip (const FToolTip&);
// Disable assignment operator (=)
FToolTip& operator = (const FToolTip&);
// Methods
void init();
void calculateDimensions();
virtual void adjustSize();
// Data Members
FString text{};
FString* text_components{0};
FStringList text_split{};
std::size_t max_line_width{0};
std::size_t text_num_lines{0};
};
#pragma pack(pop)
// FToolTip inline functions
//----------------------------------------------------------------------
inline const char* FToolTip::getClassName() const
{ return "FToolTip"; }
} // namespace finalcut
#endif // FTOOLTIP_H