SOL9 Sample: Anchor

SOL9 2.0 Samples

1 Screenshot


2 Source code

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



// SOL9
// 2009/10/13

#include <sol\ApplicationView.h>
#include <sol\Anchor.h>

#include "resource.h"

namespace SOL {

class AppView :public ApplicationView {
private:
  Anchor link[10];
  int count;

public:
  /**
   * Constructor
   */
  AppView(Application& applet, const TCHAR* name, Args& args)
    :ApplicationView(applet, name, args)
  {
    count = 0;

    Args ar;
    ar.set(XmNx, 10);
    ar.set(XmNy, 10);
    ar.set(XmNurl, _T("http://www.microsoft.com/"));
    link[count++].create(this, _T("Microsoft Corporation"), ar);

    ar.reset();
    ar.set(XmNx, 10);
    ar.set(XmNy, 10+40*count);
    ar.set(XmNurl, _T("http://www.google.com/"));
    link[count++].create(this, _T("Google"), ar);

    ar.reset();
    ar.set(XmNx, 10);
    ar.set(XmNy, 10+40*count);
    ar.set(XmNurl, _T("http://www.yahoo.com/"));
    link[count++].create(this, _T("Yahoo"), ar);

    ar.reset();
    ar.set(XmNx, 10);
    ar.set(XmNy, 10+40*count);
    ar.set(XmNurl, _T("http://www.apple.com/"));
    link[count++].create(this, _T("Apple Computer"), ar);

    ar.reset();
    ar.set(XmNx, 10);
    ar.set(XmNy, 10+40*count);
    ar.set(XmNurl, _T("http://www.asahi.com/"));
    link[count++].create(this, _T("Asahi Shimbun"), ar);

    ar.reset();
    ar.set(XmNfontSize, 16);
    ar.set(XmNx, 10);
    ar.set(XmNy, 10+40*count);
    ar.set(XmNurl, _T("http://www.antillia.com/"));
    link[count++].create(this, _T("Antillia.com"), ar);

    addCallback(XmNmenuCallback, ID_EXIT, this,
      (Callback)&AppView::exit, NULL);
    
    restorePlacement();

  }
};

}

//
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(XmNclassStyle, NO_REDRAW);
    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.