1 Screenshot
2 Source code
/*
* FontDialog.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// Sample program to use FontDialog class of SOL++2000.
// 2000.02.18
#define COMMONCONTROLS_V6
#define ID_FONT 102
#include <sol\ApplicationView.h>
#include <sol\ScrolledText.h>
#include <sol\FontDialog.h>
#include <sol\Font.h>
#include "resource.h"
namespace SOL {
class AppView :public ApplicationView {
private:
Font* font;
ScrolledText sctext;
FontDialog fontdlg;
public:
AppView(Application& applet, const TCHAR* name, Args& args)
:ApplicationView(applet, name, args)
{
font = NULL;
Args ar;
sctext.create(this, _T(""), ar);
add(&sctext);
ar.reset();
fontdlg.create(this, NULL, ar);
addCallback(XmNmenuCallback, IDM_FONT, this,
(Callback)&AppView::setFont, NULL);
addCallback(XmNmenuCallback, IDM_EXIT, this,
(Callback)&AppView::exit, NULL);
}
public:
~AppView()
{
delete font;
}
private:
void setFont(Action& action)
{
fontdlg.popup(action);
if (action.getResult()) {
delete font;
font = fontdlg.getFont();
sctext.setFont(font);
}
}
};
}
void Main(int argc, TCHAR** argv)
{
ModuleFileName module(argv[0]);
const TCHAR* name = module.getFileName();
try {
Application applet(name, argc, argv);
Args args;
AppView appView(applet, name, args);
appView.realize();
applet.run();
} catch (Exception& ex) {
caught(ex);
} catch (...) {
caught(UnknownException());
}
}
Last modified: 1 Feb 2017
Copyright (c) 2017 Antillia.com ALL RIGHTS RESERVED.