finalcut/src/fmessagebox.h

144 lines
3.8 KiB
C
Raw Normal View History

2015-05-23 13:35:12 +02:00
// fmessagebox.h
// class FMessageBox
#ifndef _FMESSAGEBOX_H
#define _FMESSAGEBOX_H
#include <cstring>
#include "fbutton.h"
#include "fdialog.h"
#include "fterm.h"
//----------------------------------------------------------------------
// class FMessageBox
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FMessageBox : public FDialog
{
public:
enum
{
Reject = 0,
Ok = 1,
Cancel = 2,
Yes = 3,
No = 4,
Abort = 5,
Retry = 6,
Ignore = 7
};
private:
FString headline_text;
FString text;
FString* text_components;
std::vector<FString> text_split;
uInt maxLineWidth;
bool center_text;
uChar emphasis_color;
uInt numButtons;
uInt text_num_lines;
int* button_digit[3];
FButton* button[3];
protected:
void adjustSize();
private:
void init(int, int, int);
void msg_dimension();
virtual void draw();
void resizeButtons();
void adjustButtons();
void cb_processClick (FWidget*, void*);
public:
explicit FMessageBox (FWidget* parent=0);
2015-09-22 04:18:20 +02:00
FMessageBox (const FMessageBox&); // copy constructor
FMessageBox ( const FString&, const FString&
, int, int, int
, FWidget* parent=0 );
2015-05-23 13:35:12 +02:00
~FMessageBox();
2015-09-22 04:18:20 +02:00
FMessageBox& operator = (const FMessageBox&); // assignment
2015-05-23 13:35:12 +02:00
const char* getClassName() const;
2015-09-22 04:18:20 +02:00
const FString getTitlebarText() const;
void setTitlebarText (const FString&);
2015-05-23 13:35:12 +02:00
const FString getHeadline() const;
void setHeadline (const FString&);
void setHeadline (const std::string&);
void setHeadline (const char*);
const FString getText() const;
void setText (const FString&);
void setText (const std::string&);
void setText (const char*);
bool setCenterText(bool);
bool setCenterText();
bool unsetCenterText();
2015-09-22 04:18:20 +02:00
static int info ( FWidget*
, const FString&
, const FString&
, int button0 = FMessageBox::Ok
, int button1=0
, int button2=0 );
static int info ( FWidget*
, const FString&
, int
, int button0 = FMessageBox::Ok
, int button1=0
, int button2=0 );
static int error ( FWidget*
, const FString&
, int button0 = FMessageBox::Ok
, int button1=0
, int button2=0 );
2015-05-23 13:35:12 +02:00
};
#pragma pack(pop)
// FMessageBox inline functions
//----------------------------------------------------------------------
inline const char* FMessageBox::getClassName() const
{ return "FMessageBox"; }
2015-09-22 04:18:20 +02:00
//----------------------------------------------------------------------
inline const FString FMessageBox::getTitlebarText() const
{ return FDialog::getText(); }
//----------------------------------------------------------------------
inline void FMessageBox::setTitlebarText (const FString& txt)
{ return FDialog::setText(txt); }
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
inline const FString FMessageBox::getHeadline() const
{ return headline_text; }
//----------------------------------------------------------------------
inline const FString FMessageBox::getText() const
{ return text; }
//----------------------------------------------------------------------
inline bool FMessageBox::setCenterText(bool on)
2015-09-22 04:18:20 +02:00
{ return center_text = on; }
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
inline bool FMessageBox::setCenterText()
{ return setCenterText(true); }
//----------------------------------------------------------------------
inline bool FMessageBox::unsetCenterText()
{ return setCenterText(false); }
#endif // _FMESSAGEBOX_H