2015-09-25 21:37:19 +02:00
|
|
|
// File: fdialog.h
|
|
|
|
// Provides: class FDialog
|
|
|
|
//
|
|
|
|
// Inheritance diagram
|
|
|
|
// ═══════════════════
|
|
|
|
//
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FObject ▏ ▕ FTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWidget ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWindow ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FDialog ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
#ifndef _FDIALOG_H
|
|
|
|
#define _FDIALOG_H
|
|
|
|
|
2016-06-12 23:06:58 +02:00
|
|
|
#include "fmenu.h"
|
|
|
|
#include "fmenuitem.h"
|
2015-05-23 13:35:12 +02:00
|
|
|
#include "fwindow.h"
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FDialog
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FDialog : public FWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum DialogCode
|
|
|
|
{
|
|
|
|
Reject = 0,
|
|
|
|
Accept = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2016-07-25 23:50:57 +02:00
|
|
|
FString tb_text; // title bar text
|
2016-07-14 23:55:22 +02:00
|
|
|
int result_code;
|
2016-09-11 16:48:39 +02:00
|
|
|
bool zoom_button_pressed;
|
|
|
|
bool zoom_button_active;
|
2016-07-14 23:55:22 +02:00
|
|
|
FPoint TitleBarClickPos;
|
|
|
|
FRect oldGeometry; // required by move()
|
|
|
|
FMenu* dialog_menu;
|
|
|
|
FMenuItem* dgl_menuitem;
|
2016-09-11 16:48:39 +02:00
|
|
|
FMenuItem* zoom_item;
|
|
|
|
FMenuItem* close_item;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
FDialog (const FDialog&);
|
|
|
|
FDialog& operator = (const FDialog&);
|
2016-07-14 23:55:22 +02:00
|
|
|
void init();
|
|
|
|
void drawBorder();
|
|
|
|
void drawTitleBar();
|
|
|
|
void leaveMenu();
|
2016-09-11 16:48:39 +02:00
|
|
|
void cb_zoom (FWidget*, void*);
|
2016-07-14 23:55:22 +02:00
|
|
|
void cb_close (FWidget*, void*);
|
|
|
|
static void addDialog (FWidget*);
|
|
|
|
static void delDialog (FWidget*);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void done (int);
|
|
|
|
virtual void draw();
|
|
|
|
virtual void onShow (FShowEvent*);
|
|
|
|
virtual void onHide (FHideEvent*);
|
|
|
|
virtual void onClose (FCloseEvent*);
|
|
|
|
|
|
|
|
public:
|
2015-09-27 16:45:28 +02:00
|
|
|
explicit FDialog (FWidget* = 0); // constructor
|
|
|
|
FDialog (const FString&, FWidget* = 0); // constructor
|
2015-05-23 13:35:12 +02:00
|
|
|
virtual ~FDialog(); // destructor
|
|
|
|
virtual const char* getClassName() const;
|
|
|
|
|
|
|
|
void onKeyPress (FKeyEvent*);
|
|
|
|
void onMouseDown (FMouseEvent*);
|
|
|
|
void onMouseUp (FMouseEvent*);
|
|
|
|
void onMouseMove (FMouseEvent*);
|
|
|
|
void onMouseDoubleClick (FMouseEvent*);
|
2016-07-16 20:39:38 +02:00
|
|
|
void onAccel (FAccelEvent*);
|
2015-05-23 13:35:12 +02:00
|
|
|
void onWindowActive (FEvent*);
|
|
|
|
void onWindowInactive (FEvent*);
|
|
|
|
void onWindowRaised (FEvent*);
|
|
|
|
void onWindowLowered (FEvent*);
|
2016-07-25 23:50:57 +02:00
|
|
|
void activateDialog();
|
2015-05-23 13:35:12 +02:00
|
|
|
void drawDialogShadow();
|
|
|
|
void show();
|
|
|
|
void hide();
|
|
|
|
int exec();
|
|
|
|
void move (const FPoint&);
|
|
|
|
void move (int, int);
|
2016-07-25 23:50:57 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
bool setFocus(bool);
|
|
|
|
bool setFocus();
|
|
|
|
bool unsetFocus();
|
|
|
|
bool setModal(bool);
|
|
|
|
bool setModal();
|
|
|
|
bool unsetModal();
|
|
|
|
bool isModal();
|
|
|
|
bool setScrollable(bool);
|
|
|
|
bool setScrollable();
|
|
|
|
bool unsetScrollable();
|
|
|
|
bool isScrollable();
|
|
|
|
bool setResizeable(bool);
|
|
|
|
bool setResizeable();
|
|
|
|
bool unsetResizeable();
|
|
|
|
bool isResizeable();
|
|
|
|
bool setTransparentShadow(bool);
|
|
|
|
bool setTransparentShadow();
|
|
|
|
bool unsetTransparentShadow();
|
|
|
|
bool hasTransparentShadow();
|
|
|
|
bool setShadow(bool);
|
|
|
|
bool setShadow();
|
|
|
|
bool unsetShadow();
|
|
|
|
bool hasShadow();
|
|
|
|
FString getText() const;
|
2015-09-22 04:18:20 +02:00
|
|
|
void setText (const FString&);
|
2016-06-13 22:44:15 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend class FMenu;
|
2015-05-23 13:35:12 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
// FDialog inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FDialog::getClassName() const
|
|
|
|
{ return "FDialog"; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::setFocus()
|
|
|
|
{ return setFocus(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::unsetFocus()
|
|
|
|
{ return setFocus(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::setModal()
|
|
|
|
{ return setModal(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::unsetModal()
|
|
|
|
{ return setModal(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::isModal()
|
2016-01-24 14:53:09 +01:00
|
|
|
{ return ((flags & fc::modal) != 0); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::setScrollable()
|
|
|
|
{ return setScrollable(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::unsetScrollable()
|
|
|
|
{ return setScrollable(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::isScrollable()
|
2016-01-24 14:53:09 +01:00
|
|
|
{ return ((flags & fc::scrollable) != 0); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::setResizeable()
|
|
|
|
{ return setResizeable(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::unsetResizeable()
|
|
|
|
{ return setResizeable(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::isResizeable()
|
2016-01-24 14:53:09 +01:00
|
|
|
{ return ((flags & fc::resizeable) != 0); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::setTransparentShadow()
|
|
|
|
{ return setTransparentShadow(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::unsetTransparentShadow()
|
|
|
|
{ return setTransparentShadow(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::hasTransparentShadow()
|
2016-01-24 14:53:09 +01:00
|
|
|
{ return ((flags & fc::trans_shadow) != 0); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::setShadow()
|
|
|
|
{ return setShadow(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::unsetShadow()
|
|
|
|
{ return setShadow(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FDialog::hasShadow()
|
2016-01-24 14:53:09 +01:00
|
|
|
{ return ((flags & fc::shadow) != 0); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-22 04:18:20 +02:00
|
|
|
inline FString FDialog::getText() const
|
|
|
|
{ return tb_text; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-22 04:18:20 +02:00
|
|
|
inline void FDialog::setText (const FString& txt)
|
|
|
|
{ tb_text = txt; }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
#endif // _FDIALOG_H
|