SOL9 Sample: LabelGadget

SOL9 2.0 Samples

1 Screenshot


2 Source code

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



// SOL++2000
// 2000.03.20

#include <sol\ApplicationView.h>
#include <sol\LabelGadget.h>
#include <sol\PaintDC.h>
#include <sol\MessageFont.h>
#include "resource.h"

namespace SOL {

class AppView :public ApplicationView {
private:
  LabelGadget labelg;

private:
  MessageFont mfont;

private:
  long paint(Event& event) {
    PaintDC dc(this);
    for (int i = 0; i<10; i++) {
      labelg.draw(&dc, 10, 10+40*i);
    }
    return 0L;
  }

  
public:
  /**
   * Constructor
   */
  AppView(Application& applet, const TCHAR* name, Args& args)
    :ApplicationView(applet, name, args)
  {
    Args ar;
    ar.set(XmNmargin, 2);
    labelg.create(this, _T(" Hello world! "), ar);
    labelg.setBackColor(RGB(0,0,255));
    labelg.setTextColor(RGB(255,255,255));
  
    //2012/07/10
    mfont.create(16);
    labelg.setFont(&mfont);

    addEventHandler(WM_PAINT, this, 
      (Handler)&AppView::paint, NULL);
  addCallback(XmNmenuCallback, IDM_EXIT, this, 
      (Callback)&AppView::exit, NULL);
  }
};

}

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