home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / code / wxwin140 / utils / wxhelp / src / wxhelp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-19  |  3.9 KB  |  139 lines

  1. /*
  2.  * File:     wxhelp.h
  3.  * Purpose:  wxWindows help system
  4.  *
  5.  *                       wxWindows 1.40
  6.  * Copyright (c) 1993 Artificial Intelligence Applications Institute,
  7.  *                   The University of Edinburgh
  8.  *
  9.  *                     Author: Julian Smart
  10.  *                        Date: 18-4-93
  11.  *
  12.  * Permission to use, copy, modify, and distribute this software and its
  13.  * documentation for any purpose is hereby granted without fee, provided
  14.  * that the above copyright notice, author statement and this permission
  15.  * notice appear in all copies of this software and related documentation.
  16.  *
  17.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS,
  18.  * IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
  19.  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  20.  *
  21.  * IN NO EVENT SHALL THE ARTIFICIAL INTELLIGENCE APPLICATIONS INSTITUTE OR THE
  22.  * UNIVERSITY OF EDINBURGH BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR
  23.  * CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM
  24.  * LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF
  25.  * DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
  26.  * THE USE OR PERFORMANCE OF THIS SOFTWARE.
  27.  */
  28.  
  29. #include <windows.h> // Included only for using MS C/C++ precompiled headers
  30. #include "wx.h"
  31. #include "hytext.h"
  32.  
  33. // Define a new application
  34. class MyApp: public wxApp
  35. {
  36.   public:
  37.     wxFrame *OnInit(void);
  38. };
  39.  
  40.  
  41. class HelpWindow: public wxHyperTextWindow
  42. {
  43.  public:
  44.   HelpWindow(wxFrame *frame, int x, int y, int w, int h, int style);
  45.   ~HelpWindow(void);
  46.  
  47.   // Derived members
  48.   void OnLeftClick(float x, float y, int char_pos, int line, long block_id, int keys);
  49.   void OnRightClick(float x, float y, int char_pos, int line, long block_id, int keys);
  50.   void OnSelectBlock(long block_id, Bool select);
  51.   void ClearBlock(long block_id);
  52.  
  53.   // New members
  54.   void DisplaySection(void);
  55.   void StoreHypertextItem(long block_id);
  56.   void HistoryBack(void);
  57.   void DisplayHistory(void);
  58. };
  59.  
  60. // Define a new frame
  61. class MyFrame: public wxFrame
  62. {
  63.   public:
  64.     HelpWindow *window;
  65.     wxPanel *panel;
  66.     MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
  67.     Bool OnClose(void);
  68.     void OnSize(int x, int y);
  69.     void OnMenuCommand(int id);
  70. };
  71.  
  72. #define HELP_OPEN        100
  73. #define HELP_EXIT        101
  74. #define HELP_TEST        102
  75. #define HELP_CLEAR_SELECTION 103
  76. #define HELP_CLEAR_BLOCK 104
  77. #define HELP_SAVE        105
  78. #define HELP_RUN_EDITOR  106
  79. #define HELP_SET_TITLE   107
  80. #define HELP_HELP_CONTENTS 108
  81. #define HELP_ABOUT       109
  82.  
  83. // Special blocks
  84. #define HELP_MARK_LARGE_VISIBLE_SECTION 200
  85. #define HELP_MARK_SMALL_VISIBLE_SECTION 201
  86. #define HELP_MARK_INVISIBLE_SECTION 202
  87.  
  88. // Cosmetic stuff
  89. #define HELP_MARK_LARGE_HEADING 203
  90. #define HELP_MARK_SMALL_HEADING 204
  91. #define HELP_MARK_SMALL_TEXT 205
  92.  
  93. #define HELP_MARK_BOLD   220
  94. #define HELP_MARK_ITALIC 221
  95.  
  96. #define HELP_MARK_RED    230
  97. #define HELP_MARK_BLUE   231
  98. #define HELP_MARK_GREEN  232
  99.  
  100. #define HELP_MARK_RED_ITALIC 240
  101.  
  102. void hyErrorMsg(char *msg);
  103. void HelpSearch(void);
  104.  
  105. class SearchBox: public wxDialogBox
  106. {
  107.  public:
  108.   wxText *search_item;
  109.   wxListBox *titles_item;
  110.   SearchBox(wxFrame *parent);
  111.   void DoSearch(wxList *string_list = NULL);
  112. };
  113.  
  114. class HelpConnection;
  115. extern HelpConnection *TheHelpConnection;
  116.  
  117. // Communication with applications
  118. class HelpConnection: public wxConnection
  119. {
  120.  public:
  121.   HelpConnection(void)
  122.     { TheHelpConnection = this; }
  123.   ~HelpConnection(void)
  124.     { TheHelpConnection = NULL; }
  125.   Bool OnExecute(char *topic, char *data, int size, int format);
  126.   Bool OnDisconnect(void);
  127. //  char *OnRequest(char *topic, char *item, int *size, int format);
  128. //  Bool OnPoke(char *topic, char *item, char *data, int size, int format);
  129. };
  130.  
  131. class HelpServer: public wxServer
  132. {
  133.  public:
  134.   wxConnection *OnAcceptConnection(char *topic)
  135.     { if (strcmp(topic, "WXHELP") == 0 && (!TheHelpConnection))
  136.         return new HelpConnection;
  137.       else return NULL; }
  138. };
  139.