home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / APPLAUNC.PAK / DIALOGS.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  4KB  |  174 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1991, 1993 by Borland International
  3. //----------------------------------------------------------------------------
  4. #if !defined(__DIALOGS_H)
  5. #define __DIALOGS_H
  6.  
  7. #include <owl\dialog.h>
  8. #include <owl\edit.h>
  9. #include <owl\radiobut.h>
  10. #include <owl\checkbox.h>
  11. #include <owl\groupbox.h>
  12. #include <owl\static.h>
  13. #include <owl\opensave.h>
  14. #include <owl\listbox.h>
  15. #include <owl\combobox.h>
  16. #include <dir.h>
  17.  
  18. #include "appmgr.h"
  19. #include "applaunc.rh"
  20.  
  21. typedef TCVectorImp<string> StringList;
  22. typedef TCVectorImp<int>    NumberList;
  23.  
  24. #define ProgramPathLen MAXPATH
  25. #define ProgramArgsLen 256
  26. #define IconPathLen    MAXPATH
  27.  
  28. //
  29. // Record to communicate the properties of an application to the dialog
  30. // and back to AppLauncher.
  31. //
  32. struct TAppPropertiesData
  33. {
  34.   TAppPropertiesData(TAppRec* ar)
  35.     : AppRec(ar), ChangeBitmap(FALSE) {}
  36.  
  37.   BOOL      ChangeBitmap;
  38.   TAppRec*  AppRec;
  39. };
  40.  
  41. //
  42. // Allow user to the properties of an application.
  43. //
  44. class TAppPropertiesDialog : public TDialog {
  45.   public:
  46.     TAppPropertiesDialog(TWindow* parent, int resId, TAppPropertiesData& data);
  47.  
  48.     void SetupWindow();
  49.     void CmOk();
  50.  
  51.   protected:
  52.     // Response functions
  53.     //
  54.     void CmBrowseProg();
  55.     void CmBrowseIcon();
  56.     int  GetFilePath(string& path);
  57.  
  58.   private:
  59.     // Controls.
  60.     //
  61.     TEdit*        ProgramPath;
  62.     TEdit*        ProgramArgs;
  63.     TEdit*        IconPath;
  64.     TCheckBox*    PromptForInput;
  65.     TGroupBox*    StartupStyles;
  66.     TRadioButton* RunNormal;
  67.     TRadioButton* RunMinimized;
  68.     TRadioButton* RunMaximized;
  69.  
  70.     // Application properties.
  71.     //
  72.     TAppPropertiesData& AppProperties;
  73.  
  74.     TOpenSaveDialog::TData  FileData;   // save/restore info.
  75.  
  76.   DECLARE_RESPONSE_TABLE(TAppPropertiesDialog);
  77. };
  78.  
  79. //////////////////////////////////////////////////////////////////////
  80.  
  81. //
  82. // Allow user to enter new application.  Can add new application relative to
  83. // another.
  84. //
  85. class TAddAppDialog : public TDialog {
  86.   public:
  87.     TAddAppDialog(TWindow* parent, int resId, string& progPathStr,
  88.                   int& loc, StringList& pathStrs);
  89.  
  90.     void SetupWindow();
  91.     BOOL CanClose();
  92.  
  93.   protected:
  94.     string&               ProgPathStr;
  95.     int&                  Loc;
  96.     StringList&           PathStrs;
  97.     TEdit*                ProgramPath;
  98.     TComboBox*            Paths;
  99.  
  100.     TOpenSaveDialog::TData  FileData;   // save/restore info.
  101.  
  102.     // response functions.
  103.     //
  104.     void CmBrowseProg();
  105.  
  106.   DECLARE_RESPONSE_TABLE(TAddAppDialog);
  107. };
  108.  
  109. //////////////////////////////////////////////////////////////////////
  110.  
  111. //
  112. // Generic dialog which asks the use to select one or more items from a list.
  113. //
  114. class TPickListDialog : public TDialog {
  115.   public:
  116.     TPickListDialog(TWindow* parent, int resId,
  117.                     StringList& strings, NumberList& selections);
  118.  
  119.     void SetupWindow();
  120.     void CmOk();
  121.  
  122.   protected:
  123.     TListBox*  PickList;
  124.  
  125.   private:
  126.     StringList&  Strings;
  127.     NumberList&      Selections;
  128.  
  129.   DECLARE_RESPONSE_TABLE(TPickListDialog);
  130. };
  131.  
  132. //////////////////////////////////////////////////////////////////////
  133.  
  134. //
  135. // Record to communicate AppLauncher's configuration options to the dialog
  136. // and back to AppLauncher.
  137. //
  138. struct TConfigRec {
  139.  
  140.   TConfigRec() : Orientation(0), SaveOnExit(0), ConfirmOnRemove(1),
  141.                  SaveNow(0) {}
  142.   TConfigRec(int o, int soe, int cor) : Orientation(o), SaveOnExit(soe),
  143.     ConfirmOnRemove(cor), SaveNow(0) {}
  144.  
  145.   int Orientation;  // 0 (vertical) or 1 (horizontal).
  146.   int SaveOnExit;
  147.   int ConfirmOnRemove;
  148.   int SaveNow;
  149. };
  150.  
  151. class TConfigDialog : public TDialog {
  152.   public:
  153.     TConfigDialog(TWindow* parent, int resId, TConfigRec& rec);
  154.  
  155.     void SetupWindow();
  156.     void CmOk();
  157.  
  158.   protected:
  159.     void CmSaveNow();
  160.  
  161.   private:
  162.     TGroupBox*      OrientationGroupBox;
  163.     TRadioButton*   Vertical;
  164.     TRadioButton*   Horizontal;
  165.     TCheckBox*      SaveOnExit;
  166.     TCheckBox*      ConfirmOnRemove;
  167.  
  168.     TConfigRec&     ConfigRec;
  169.  
  170.   DECLARE_RESPONSE_TABLE(TConfigDialog);
  171. };
  172.  
  173. #endif // __DIALOGS_H
  174.