/******************************************************************************* * FILE NAME: Hello.cpp * * * * DESCRIPTION: * * Class implementation of the class: * * Hello- Hello World - My first VA C++ Application * * ---------------------------------------------------------------------------- * * Warning: This file was generated by the VisualAge C++ Visual Builder. * * Modifications to this source file will be lost when the part is regenerated. * *******************************************************************************/ #include #include #include #include #include #include #include #include #include #include "Hello.hpp" #include #include #include //***************************************************************************** // Class definition for HelloConn0 //***************************************************************************** class HelloConn0 : public IVBConnection { public: //--------------------------------------------------------------------------- // Constructors / destructors //--------------------------------------------------------------------------- HelloConn0(IPushButton * aSource, IFrameWindow * aTarget) : source(aSource), target(aTarget) { handleNotificationsFor(*source); }; virtual ~HelloConn0() { stopHandlingNotificationsFor(*source); }; //--------------------------------------------------------------------------- // public member functions //--------------------------------------------------------------------------- virtual int checkEvent(const INotificationEvent & anEvent) const { return ((anEvent.notificationId() == IPushButton::buttonClickId)); }; void perform(const INotificationEvent & anEvent) { IFUNCTRACE_DEVELOP(); ITRACE_DEVELOP(" firing connection : pbExit(buttonClickEvent) to FrameWindow(close))"); target->close(); }; protected: private: //--------------------------------------------------------------------------- // private member data //--------------------------------------------------------------------------- IPushButton * source; IFrameWindow * target; }; //HelloConn0 const INotificationId _Export Hello::readyId = "Hello::readyId"; //------------------------------------------------------------------------------ // Hello :: defaultFramingSpec //------------------------------------------------------------------------------ const IRectangle _Export Hello::defaultFramingSpec() { return(IRectangle(VBPOINT(30, IWindow::desktopWindow()->size().height() - 30 - 384, 30, 30), ISize(512, 384))); } //------------------------------------------------------------------------------ // Hello :: defaultTitle //------------------------------------------------------------------------------ IString _Export Hello::defaultTitle() { return("Hello World Application"); } //------------------------------------------------------------------------------ // Hello :: Hello //------------------------------------------------------------------------------ _Export Hello::Hello( unsigned long id, IWindow* parent, IWindow* owner, const IRectangle& rect, const IFrameWindow::Style& style, const char* title) : IFrameWindow(id, parent, owner, rect, style, title) { iHelloConnectionList = new IVBConnectionList; iCanvas = new ICanvas( IC_FRAME_CLIENT_ID, this, this, IRectangle()); iStaticText1 = new IStaticText( id+WNDOFFSET_Hello_StaticText1, iCanvas, iCanvas, IRectangle(VBPOINT(146, 212, 146, 88), ISize(211, 54))); ipbExit = new IPushButton( id+WNDOFFSET_Hello_pbExit, iCanvas, iCanvas, IRectangle(VBPOINT(224, 90, 224, 230), ISize(56, 34))); iStaticText1->setFont(IFont("Times New Roman Bold Italic", 24).setBold(false).setItalic(false).setUnderscore(false).setStrikeout(false)); iStaticText1->setText("Hello World"); ipbExit->setText(VBXLATEMNEMONIC("E~xit")); this->setClient(iCanvas); this->setFocus(); } //end constructor //------------------------------------------------------------------------------ // Hello :: ~Hello //------------------------------------------------------------------------------ _Export Hello::~Hello() { delete iHelloConnectionList; delete ipbExit; delete iStaticText1; delete iCanvas; } //------------------------------------------------------------------------------ // Hello :: initializePart //------------------------------------------------------------------------------ Hello & _Export Hello::initializePart() { makeConnections(); notifyObservers(INotificationEvent(readyId, *this)); return *this; } //------------------------------------------------------------------------------ // Hello :: makeConnections //------------------------------------------------------------------------------ void _Export Hello::makeConnections() { this->enableNotification(); iCanvas->enableNotification(); iStaticText1->enableNotification(); ipbExit->enableNotification(); unsigned long id = this->id(); HelloConn0 *conn0 = new HelloConn0(ipbExit, this); iHelloConnectionList->add(conn0); iHelloConnectionList->initialize(); }