1 Screenshot
2 Source code
/*
* SplitPane.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL++2000
// 1999.09.23 Modified
// 2000.02.18
#include <sol\ApplicationView.h>
#include <sol\ScrolledText.h>
#include <sol\SplitPane.h>
#include <sol\FileListBox.h>
#include "resource.h"
namespace SOL {
/**
* This is a simple viewer based on SOL::SplitPane class for the *.ini files
* on the Windows system folder.
*/
class AppView :public ApplicationView {
private:
FileListBox listbox;
ScrolledText scrollt;
SplitPane panedw;
public:
/**
* Constructor
*/
AppView(Application& applet, const TCHAR* name, Args& args)
:ApplicationView(applet, name, args.set(XmNstyle, WS_CLIPCHILDREN))
{
Args ar;
ar.set(XmNdirection, SplitPane::HORIZONTAL);
panedw.create(this, NULL, ar);
add(panedw);
ar.reset();
ar.set(XmNstyle, (ulong)WS_BORDER|LBS_NOINTEGRALHEIGHT);
listbox.create(&panedw, NULL, ar);
TCHAR dir[_MAX_PATH];
::GetWindowsDirectory(dir, CountOf(dir));
listbox.setup(dir, _T("*.ini"),
(ulong)DDL_READWRITE|DDL_READONLY|DDL_HIDDEN |\
DDL_SYSTEM|DDL_ARCHIVE|DDL_DIRECTORY);
listbox.addCallback(XmNselChangeCallback, this,
(Callback)&AppView::select, NULL);
panedw.add(&listbox);
ar.reset();
ar.set(XmNstyle, (ulong)WS_BORDER);
scrollt.create(&panedw, NULL, ar);
panedw.add(&scrollt);
addCallback(XmNmenuCallback, IDM_EXIT, this,
(Callback)&AppView::exit, NULL);
panedw.setSashPosition(200);
restorePlacement();
}
private:
void select(Action& action)
{
// We got a selchange notification from the left listbox.
String path = "";
listbox.getPathName(path);
scrollt.load((TCHAR*)path);
}
};
}
// Sample Main
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.