SOL9 Sample: BorderLayout

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * BorderLayout.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL9
// 2017/01/29 Updated.

#define COMMONCONTROLS_V6

#include <sol\ApplicationView.h>
#include <sol\PaintDC.h>
#include <sol\FlowLayout.h>

#include <sol\BorderLayout.h>
#include <sol\TextField.h>
#include <sol\ScrolledText.h>
#include <sol\PushButton.h>
#include <sol\Sheet.h>
#include <sol\Panel.h>
#include "resource.h"

namespace SOL {

class AppView :public ApplicationView {
private:
  BorderLayout            blayout;
  FlowLayout              flowLayout;
  SmartPtr<PushButton>    save;
  SmartPtr<TextField>     name;
  SmartPtr<PushButton>    open;
  SmartPtr<Panel>         south;
  SmartPtr<PushButton>    north;
  SmartPtr<PushButton>    east;
  SmartPtr<PushButton>    west;
  SmartPtr<ScrolledText>  center;

public:
  AppView(Application& applet, const TCHAR* label, Args& args)
    :ApplicationView(applet, label, args)
  {
    Args ar;
    setLayout(&blayout);

    south = new Panel(this, _T(""), ar);
    south -> setLayout(&flowLayout);
    flowLayout.setAlignment(FlowLayout::CENTER);
    flowLayout.setHorizSpacing(20);
    flowLayout.setHorizGap(20);
    ar.reset();
    south -> add(open = new PushButton(south, _T("Open"), ar));

    ar.reset();
    south -> add(save = new PushButton(south, _T("Save"), ar));
    ar.reset();
    south -> add(name = new TextField(south, _T("Name"), ar));

    ar.reset();
    add(south, BorderLayout::SOUTH);
    ar.reset();
    north = new PushButton(this, _T("North"), ar);
    add(north, BorderLayout::NORTH);

    ar.reset();
    west = new PushButton(this, _T("West"), ar);
    add(west, BorderLayout::WEST);
    ar.reset();
    east = new PushButton(this, _T("East"), ar);
    add(east, BorderLayout::EAST);

    ar.reset();
    center = new ScrolledText(this, _T("Center"), ar);
    add(center, BorderLayout::CENTER);
    pack();
    
    addCallback(XmNmenuCallback, IDM_EXIT, this, 
      (Callback)&AppView::exit, NULL);

  }

  ~AppView() 
  {
  }
};

}

//
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.