home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tybc4 / xped3 / xped3app.cpp < prev    next >
C/C++ Source or Header  |  1994-02-13  |  4KB  |  146 lines

  1. /*  Project xped3
  2.     
  3.     Copyright ⌐ 1993. All Rights Reserved.
  4.  
  5.     SUBSYSTEM:    xped3.exe Application
  6.     FILE:         xped3app.cpp
  7.     AUTHOR:       
  8.  
  9.  
  10.     OVERVIEW
  11.     ========
  12.     Source file for implementation of XpEd3App (TApplication).      
  13. */
  14.  
  15.  
  16. #include <owl\owlpch.h>
  17. #pragma hdrstop
  18.  
  19.  
  20. #include "xped3app.h"
  21. #include "xpd3mdic.h"
  22. #include "xped3abd.h"                        // Definition of about dialog.       
  23.  
  24.  
  25. //{{XpEd3App Implementation}}
  26.  
  27. //
  28. // Build a response table for all messages/commands handled
  29. // by the application.
  30. //
  31. DEFINE_RESPONSE_TABLE1(XpEd3App, TApplication)
  32. //{{XpEd3AppRSP_TBL_BEGIN}}
  33.     EV_COMMAND(CM_HELPABOUT, CmHelpAbout),
  34. //{{XpEd3AppRSP_TBL_END}}
  35. END_RESPONSE_TABLE;
  36.  
  37.  
  38. //////////////////////////////////////////////////////////
  39. // XpEd3App
  40. // =====
  41. //
  42. XpEd3App::XpEd3App () : TApplication("xped3")
  43. {
  44.  
  45.     // INSERT>> Your constructor code here.
  46.  
  47. }
  48.  
  49.  
  50. XpEd3App::~XpEd3App ()
  51. {
  52.     // INSERT>> Your destructor code here.
  53.  
  54. }
  55.  
  56.  
  57. void XpEd3App::SetupSpeedBar (TDecoratedMDIFrame *frame)
  58.     //
  59.     // Create default toolbar New and associate toolbar buttons with commands.
  60.     //   
  61.     TControlBar* cb = new TControlBar(frame);
  62.     cb->Insert(*new TButtonGadget(CM_MDIFILENEW, CM_MDIFILENEW));
  63.     cb->Insert(*new TButtonGadget(CM_MDIFILEOPEN, CM_MDIFILEOPEN));
  64.     cb->Insert(*new TButtonGadget(CM_FILESAVE, CM_FILESAVE));
  65.     cb->Insert(*new TSeparatorGadget(6));
  66.     cb->Insert(*new TButtonGadget(CM_EDITCUT, CM_EDITCUT));
  67.     cb->Insert(*new TButtonGadget(CM_EDITCOPY, CM_EDITCOPY));
  68.     cb->Insert(*new TButtonGadget(CM_EDITPASTE, CM_EDITPASTE));
  69.     cb->Insert(*new TSeparatorGadget(6));
  70.     cb->Insert(*new TButtonGadget(CM_EDITUNDO, CM_EDITUNDO));
  71.     cb->Insert(*new TSeparatorGadget(6));
  72.     cb->Insert(*new TButtonGadget(CM_EDITFIND, CM_EDITFIND));
  73.     cb->Insert(*new TButtonGadget(CM_EDITFINDNEXT, CM_EDITFINDNEXT));
  74.  
  75.     // Add fly-over help hints.
  76.     cb->SetHintMode(TGadgetWindow::EnterHints);
  77.  
  78.     frame->Insert(*cb, TDecoratedFrame::Top);
  79. }
  80.  
  81.  
  82. //////////////////////////////////////////////////////////
  83. // XpEd3App
  84. // =====
  85. // Application intialization.
  86. //
  87. void XpEd3App::InitMainWindow ()
  88. {
  89.     TDecoratedMDIFrame* frame = new TDecoratedMDIFrame(Name, MDI_MENU, *(new xped3MDIClient), TRUE);
  90.  
  91.     nCmdShow = (nCmdShow != SW_SHOWMINNOACTIVE) ? SW_SHOWNORMAL : nCmdShow;
  92.  
  93.     //
  94.     // Assign ICON w/ this application.
  95.     //
  96.     frame->SetIcon(this, IDI_MDIAPPLICATION);
  97.  
  98.     //
  99.     // Menu associated with window and accelerator table associated with table.
  100.     //
  101.     frame->AssignMenu(MDI_MENU);
  102.     
  103.     //
  104.     // Associate with the accelerator table.
  105.     //
  106.     frame->Attr.AccelTable = MDI_MENU;
  107.  
  108.  
  109.     SetupSpeedBar(frame);
  110.  
  111.     TStatusBar *sb = new TStatusBar(frame, TGadget::Recessed,
  112.                                     TStatusBar::CapsLock        |
  113.                                     TStatusBar::NumLock         |
  114.                                     TStatusBar::ScrollLock      |
  115.                                     TStatusBar::Overtype);
  116.     frame->Insert(*sb, TDecoratedFrame::Bottom);
  117.   
  118.     MainWindow = frame;
  119.  
  120. }
  121.  
  122.  
  123. //////////////////////////////////////////////////////////
  124. // XpEd3App
  125. // ===========
  126. // Menu Help About xped3.exe command
  127. void XpEd3App::CmHelpAbout ()
  128. {
  129.     //
  130.     // Show the modal dialog.
  131.     //
  132.     XpEd3AboutDlg(MainWindow).Execute();
  133. }
  134.  
  135.  
  136. int OwlMain (int , char* [])
  137. {
  138.     XpEd3App     App;
  139.     int             result;
  140.  
  141.     result = App.Run();
  142.  
  143.     return result;
  144. }
  145.