SOL9 Sample: GridLayout

SOL9 2.0 Samples

1 Screenshot


2 Source code

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



// SOL++2000 
// 2000.02.18

//#define COMMONCONTROLS_V6

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

#include <sol\PushButton.h>
#include <sol\Sheet.h>
#include <sol\ClientDC.h>
#include <sol\Font.h>
#include "resource.h"

namespace SOL {

class AppView :public ApplicationView {
private:
  PushButton    fbutton[3];
  PushButton    buttons[5];
  GridLayout    gridLayout;
  FlowLayout    flowLayout;
  Sheet      panel;
  Font      font;

  
public:
  /**
   * Constructor
   */
  AppView(Application& applet, const TCHAR* label, Args& args)
  :ApplicationView(applet, label, args),
    gridLayout(3, 2),
    flowLayout(FlowLayout::VERTICAL)
  {
    Args ar;
    setLayout(&gridLayout);
    //ar.set(XmNstyle, WS_CHILD);

    ar.set(XmNclassStyle, 0);

    panel.create(this, _T(""), ar);
    panel.setVisible(True);
    
    panel.setLayout(&flowLayout);
    
    ar.reset();
    fbutton[0].create(&panel, _T("ButtonInFlowLayout 1"), ar);

    ar.reset();
    fbutton[1].create(&panel, _T("ButtonInFlowLayout 2"), ar);

    ar.reset();
    fbutton[2].create(&panel, _T("ButtonInFlowLayout 3"), ar);

    panel.add(fbutton[0]);
    panel.add(fbutton[1]);
    panel.add(fbutton[2]);

    for(int i = 0; i<5; i++) {
      TCHAR string[128];
      _stprintf_s(string, CountOf(string), _T("ButtonInGridLayout %d"), i);
      ar.reset();
      buttons[i].create(this, string, ar);
      add(buttons[i]);
    }
    add(panel);
    
    addCallback(XmNmenuCallback, IDM_EXIT, this,
      (Callback)&AppView::exit, NULL);    
  }
};

}

//SOL9 Application main.
void  Main(int argc, TCHAR** argv)
{
  ModuleFileName module(argv[0]);
  const TCHAR* name = module.getFileName();
  try {
    Application applet(name, argc, argv);
  
    Args args;
    //2009/10/13
    args.set(XmNclassStyle, 0);

    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.