home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************************/
- /* Sample Program for IBMCLASS - Main Window Class implementation */
- /* */
- /* Change History: */
- /* Rel Programmer Stamp Date Description */
- /* --- ----------------- ----- -------- --------------------------------- */
- /* 2.0 Kevin Leong KKL 30/12/91 Creation */
- /* 3.0 Kevin Leong KKL 01/08/92 Modify for V3.0 classes */
- /* 3.1 Philippe Gregoire PHG 10/09/92 Add more stuff for demo */
- /**************************************************************************/
-
- /* include IBMCLASS headers */
- #include <iapp.hpp> // IApplication
- #include <ireslib.hpp> // IResourceLibrary/IResourceId
-
- #include <itrace.hpp> // ITrace
-
- #include <idrgsrch.hpp>
-
- /* include our classes definitions */
- #include "win.hpp"
-
- /* include our symbols definitions */
- #include "win.h"
-
-
- /**************************************************************************/
- /* main KKL 01/08 */
- /* Application entry point */
- /**************************************************************************/
- void main()
- {
-
- // create our main window has child of the desktop
- MyWindow myWin(WND_MAIN);
-
- // run the aplication
- IApplication::current.run();
-
- }/* end main */
-
- /**************************************************************************/
- /* MyWindow::MyWindow KKL 01/08 */
- /* Constructor for our main window */
- /**************************************************************************/
- MyWindow::MyWindow( unsigned long windowId)
- : IFrameWindow(windowId)
- {
- // set ourselves as event handler, since we multiple-inherit
- addHandler((IHandler *)this);
-
- // set main menu
- IActionBarMenu* pabmnMain=new IActionBarMenu(WND_MAIN,this);
-
- // Create client fill-box and set as client
- pMyClient = new MyClientWindow(MY_CLIENT,this);
- setClient(pMyClient);
-
- // Create static text status area
- psttxtStatus = new IStaticText(ST_STATUS, this, this, IRectangle());
- psttxtStatus->setText(STR_NOSTATUS);
-
- // set status line on top of client fill-box
- addControl(psttxtStatus,
- IFrCtlAttr::placeTop | IFrCtlAttr::splitBar,
- pMyClient, None, 30);
-
- // Create titlebar icon
- pbcTBIcon = new IBitmapControl(BM_TBICON, this, this, IRectangle(),
- BM_TBICON);
-
- // set this one as extension, left of titlebar
- addControl(pbcTBIcon,
- IFrCtlAttr::placeLeft | IFrCtlAttr::thinSepLine,
- 0, Titlebar, 30);
-
- // Create D&D source handler for titlebar icon
- psrchTBIcon=new IDragSourceHandler();
- IDragItem* pdrgitmTBIcon= new IDragItem(pbcTBIcon,
- 0L,
- "IBMICON", "<CUSTOMER,NONE>",
- IDragItem::moveable);
- pdrgitmTBIcon->setDragImage(new IDragImage(IResourceId(BM_TBICON),
- ISize(0,0),ISize(0,0),
- false));
- psrchTBIcon->dragItemList().add(pdrgitmTBIcon);
- pbcTBIcon->addHandler(psrchTBIcon);
-
- // Create list-box
- plbCustList=new IListBox(LB_CUSTLIST, this, this, IRectangle());
-
- // set this one as extension, right of client, 1/3 size
- addControl(plbCustList,
- IFrCtlAttr::placeRight | IFrCtlAttr::splitBar,
- pMyClient, 0, IPair(1,3));
-
- // size and show main frame window
- sizeTo(ISize(400,300));
- moveTo(ISize(100,100));
- show();
-
- }/* end MyWindow :: MyWindow(...) */
-
-
- /**************************************************************************/
- /* MyWindow :: command PHG 10/09 */
- /* Handle menu commands */
- /**************************************************************************/
- Boolean MyWindow :: command(ICommandEvent& cmdevt)
- {
- switch(cmdevt.commandId()) {
- case MI_NEXT:
- psttxtStatus->setText(STR_LOADCUST);
- psttxtStatus->setText(pMyClient->nextCustomer());
- return(true);
- break;
-
- case MI_PREVIOUS:
- psttxtStatus->setText(STR_LOADCUST);
- psttxtStatus->setText(pMyClient->previousCustomer());
- return(true);
- break;
- }/* end switch */
-
- return(false);
- }/* end MyWindow :: command(...) */