1 Screenshot
2 Source code
/*
* IconHolder.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL++2000
// 2000.02.18
#include <sol\ApplicationView.h>
#include <sol\Icon.h>
#include <sol\PaintDC.h>
#include "resource.h"
namespace SOL {
class IconHolder :public ApplicationView {
private:
int num;
Icon** icons;
public:
IconHolder(Application& applet, const TCHAR* name, Args& args)
:ApplicationView(applet, name,
args.set(XmNstyle, (ulong)WS_VSCROLL|WS_HSCROLL))
{
num = 5;
icons = new Icon*[num];
int x = 20;
int y = 20;
int n = 0;
icons[n] = new Icon(_T("Application"), LoadIcon(NULL,IDI_APPLICATION));
icons[n++] -> move(x, y); x += 100;
icons[n] = new Icon(_T("Asterisk"), LoadIcon(NULL,IDI_ASTERISK));
icons[n++] -> move(x, y); x += 100;
icons[n] = new Icon(_T("Exclamation"), LoadIcon(NULL,IDI_EXCLAMATION));
icons[n++] -> move(x, y); x += 100;
icons[n] = new Icon(_T("Hand"), LoadIcon(NULL,IDI_HAND));
icons[n++] -> move(x, y); x += 100;
icons[n] = new Icon(_T("Question"), LoadIcon(NULL,IDI_QUESTION));
icons[n++] -> move(x, y);
addEventHandler(WM_PAINT, this,
(Handler)&IconHolder::paint, NULL);
addCallback(XmNmenuCallback, IDM_EXIT, this,
(Callback)&IconHolder::exit, NULL);
}
public:
~IconHolder()
{
for(int i = 0; i<num; i++)
delete icons[i];
}
private:
long paint(Event& event)
{
PaintDC pdc(this);
int x = getScrollPos(SB_HORZ);
int y = getScrollPos(SB_VERT);
for(int i = 0; i<num; i++) {
icons[i]->draw(pdc.get(), -x, -y);
}
return NULL;
}
};
}
//
void Main(int argc, TCHAR** argv)
{
ModuleFileName module(argv[0]);
const TCHAR* name = module.getFileName();
try {
Application applet(name, argc, argv);
Args args;
args.set(XmNhorizScrollMaximum, 200);
args.set(XmNvertScrollMaximum, 30);
args.set(XmNclassStyle, 0);
IconHolder iconHolder(applet, name, args);
iconHolder.realize();
applet.run();
} catch (Exception& ex) {
caught(ex);
} catch (...) {
caught(UnknownException());
}
}
Last modified: 1 Feb 2017
Copyright (c) 2017 Antillia.com ALL RIGHTS RESERVED.