3.3.1 Label

 On Motif++ application for OZ++ 2.0, you simply include Motif++ class header files for your requirement, as shown below.
Note:
1. Define your own top level application view class(MainView) to be a subclass of OZ::ApplicationView class.
2. In main function, create an instance of OZ::Application class, and an instance of your own application view class(MainView).
3. Call realize method of the instance of the application view.
4. Call run method of the instance of Application to enter an event loop.




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

#include <oz++/motif/ApplicationView.h>
#include <oz++/motif/Label.h>
#include <oz++/motif/PixmapFile.h>

namespace OZ {

class MainView :public ApplicationView {
private:
   SmartPtr<PixmapFile> pixmapf;
   SmartPtr<Label>      label;

public:
  MainView(Application& applet, const char* name, Args& args)
  :ApplicationView(applet, name, args)
  {
    Args ar;
    label = new Label(this, "label", ar);

    Pixel fg, bg;
    label -> get(XmNforeground, (XtArgVal)&fg);
    label -> get(XmNbackground, (XtArgVal)&bg);
    pixmapf = new PixmapFile(getDisplay(), "escherknot", fg, bg);
    label -> set(XmNlabelType,   XmPIXMAP);
    label -> set(XmNlabelPixmap, (XtArgVal)pixmapf->get());
  }

  ~MainView()
  {
  }
};
}

//
int main(int argc, char** argv)
{
  try {
    const char*  appclass = argv[0];
    Application applet(appclass, argc, argv);

    Args args;
    args.set(XmNgeometry, "400x300");
    MainView view(applet, argv[0], args);
    view.realize();

    applet.run();
  } catch (Exception& ex) {
    caught(ex);
  }
  return 0;
}


Last modified: 1 Jan 2017

 Last modified: 1 Jan 2017

Copyright (c) 2000-2017 Antillia.com ALL RIGHTS RESERVED.