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

  1. /*
  2.  * File:     wx_privt.h
  3.  * Purpose:  Private class declarations.
  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. #ifndef wx_privth
  30. #define wx_privth
  31.  
  32. #ifdef wx_motif
  33. #include <Xm/Xm.h>
  34. #include "wx_hash.h"
  35. extern wxHashTable *wxWidgetHashTable;
  36.  
  37. void wxWidgetResizeProc(Widget w, XConfigureEvent *event, String args[], int *num_args);
  38. // void wxWidgetRepaintProc(Widget w, XtPointer clientData, XtPointer);
  39. #endif
  40.  
  41. #ifdef wx_msw
  42.  
  43. /*
  44.  * This is a generic Windows 3 window.
  45.  * I derive from this to create windows for panels, canvases,
  46.  * status bar, text window, frame etc.
  47.  */
  48.  
  49. class wxWnd : public wxObject
  50. {
  51. public:
  52.     UINT last_msg;
  53.     WPARAM last_wparam;
  54.     LPARAM last_lparam;
  55.     Bool x_scrolling_enabled;
  56.     Bool y_scrolling_enabled;
  57.  
  58.     int xscroll_pixels_per_line;
  59.     int yscroll_pixels_per_line;
  60.     int xscroll_lines;
  61.     int yscroll_lines;
  62.     int xscroll_lines_per_page;
  63.     int yscroll_lines_per_page;
  64.     int xscroll_position;
  65.     int yscroll_position;
  66.     float last_x_pos;
  67.     float last_y_pos;
  68.     int last_event;
  69.     HWND handle;
  70.     HANDLE accelerator_table;
  71.  
  72.     Bool is_canvas;
  73.     Bool is_dialog;
  74.     HDC cdc;
  75.     HBRUSH background_brush;
  76.  
  77.     wxWindow *wx_window;
  78.  
  79.     wxWnd(void);
  80.     ~wxWnd(void);
  81.  
  82.     void Create(wxWnd *parent, char *wclass, wxWindow *wx_win, char *title,
  83.                int x, int y, int width, int height,
  84.                DWORD style, char *dialog_template = NULL);
  85.  
  86.     // Calculates the position of a point on the window
  87.     // taking into account the position of scrollbars.
  88.     // Windows doesn't automatically reflect the position of the
  89.     // scrollbars - (0, 0) is always the top left of the visible window,
  90.     // whereas in XView, (0, 0) moves according to scrollbar positions.
  91.     virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy);
  92.  
  93.     // Actually defined in wx_canvs.cc since requires wxCanvas declaration
  94.     void DeviceToLogical(float *x, float *y);
  95.  
  96.     // Calculate logical (scroll-bar/scaling aware) position from
  97.     // device (pixel) position
  98.     virtual void CalcUnscrolledPosition(int x, int y, float *xx, float *yy);
  99.  
  100.     // Handlers
  101.     virtual void OnCreate(LPCREATESTRUCT cs);
  102.     virtual BOOL OnPaint(void);
  103.     virtual void OnSize(int x, int y, UINT flag);
  104.     virtual void OnHScroll(WORD nSBCode, WORD pos, HWND control);
  105.     virtual void OnVScroll(WORD nSBCode, WORD pos, HWND control);
  106.     virtual BOOL OnCommand(WORD id, WORD cmd, HWND control);
  107.     virtual HBRUSH OnCtlColor(HDC dc, HWND pWnd, UINT nCtlColor);
  108.     virtual BOOL OnEraseBkgnd(HDC pDC);
  109.     virtual void OnMenuSelect(WORD item, WORD flags, HMENU sysmenu);
  110.     virtual BOOL OnClose(void);
  111.     virtual BOOL OnDestroy(void);
  112.     virtual BOOL OnSetFocus(HWND wnd);
  113.     virtual BOOL OnKillFocus(HWND wnd);
  114.  
  115.     // Canvas-type events
  116.     virtual void OnLButtonDown(int x, int y, UINT flags);
  117.     virtual void OnLButtonUp(int x, int y, UINT flags);
  118.  
  119.     virtual void OnRButtonDown(int x, int y, UINT flags);
  120.     virtual void OnRButtonUp(int x, int y, UINT flags);
  121.  
  122.     virtual void OnMouseMove(int x, int y, UINT flags);
  123.  
  124.     virtual void OnChar(WORD wParam);
  125.  
  126.     virtual BOOL OnActivate(BOOL flag, BOOL minimized, HWND activate);
  127.     virtual BOOL OnMDIActivate(BOOL flag, HWND activate, HWND deactivate);
  128.  
  129.     virtual LONG DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
  130.     virtual BOOL ProcessMessage(MSG* pMsg);
  131.     virtual void DestroyWindow(void);
  132. };
  133.  
  134.  
  135. /*
  136.  * This is a Windows 3 subwindow - panel or canvas
  137.  */
  138.  
  139. class wxSubWnd : public wxWnd
  140. {
  141. public:
  142.     wxSubWnd(wxWnd *parent, char *wclass, wxWindow *wx_win,
  143.                 int x, int y, int width, int height,
  144.                 DWORD style, char *dialog_template = NULL);
  145.     ~wxSubWnd(void);
  146.  
  147.     // Handlers
  148.     BOOL OnPaint(void);
  149.     void OnSize(int x, int y, UINT flag);
  150.     BOOL OnCommand(WORD id, WORD cmd, HWND control);
  151.  
  152.     // Canvas-type events
  153.     void OnLButtonDown(int x, int y, UINT flags);
  154.     void OnLButtonUp(int x, int y, UINT flags);
  155.  
  156.     void OnRButtonDown(int x, int y, UINT flags);
  157.     void OnRButtonUp(int x, int y, UINT flags);
  158.  
  159.     void OnMouseMove(int x, int y, UINT flags);
  160.  
  161.     void OnChar(WORD wParam);
  162.  
  163.     void OnHScroll(WORD nSBCode, WORD pos, HWND control);
  164.     void OnVScroll(WORD nSBCode, WORD pos, HWND control);
  165. };
  166.  
  167. class wxCanvasWnd : public wxSubWnd
  168. {
  169. public:
  170.   wxCanvasWnd(wxWnd *parent, wxWindow *wx_win,
  171.               int x, int y, int width, int height,
  172.               DWORD style);
  173.  
  174.   // Handlers
  175.   BOOL OnEraseBkgnd(HDC pDC);
  176. };
  177.  
  178. class wxFrameWnd : public wxWnd
  179. {
  180. public:
  181.     Bool iconized;
  182.     HICON icon;
  183.  
  184.     wxFrameWnd(wxWnd *parent, char *wclass, wxWindow *wx_win, char *title,
  185.                    int x, int y, int width, int height,
  186.                    DWORD style);
  187.     ~wxFrameWnd(void);
  188.  
  189.     // Handlers
  190.     BOOL OnPaint(void);
  191.     void OnSize(int x, int y, UINT flag);
  192.     BOOL OnCommand(WORD id, WORD cmd, HWND control);
  193.     BOOL OnClose(void);
  194.     void OnMenuSelect(WORD item, WORD flags, HMENU sysmenu);
  195. };
  196.  
  197. class wxStatusWnd : public wxWnd
  198. {
  199. public:
  200.     char *status_text;
  201.     int height;
  202.     HBRUSH light_grey_brush;
  203.  
  204.     wxStatusWnd(wxFrameWnd *parent, int the_height);
  205.     ~wxStatusWnd(void);
  206.  
  207.     BOOL OnPaint(void);
  208. };
  209.  
  210. class wxMDIFrame : public wxWnd
  211. {
  212. public:
  213.     HWND client_hwnd;
  214.     wxWnd *current_child;
  215.     Bool iconized;
  216.     HICON icon;
  217.     HMENU window_menu;
  218.     Bool parent_frame_active; // TRUE if MDI Frame is intercepting
  219.                               // commands, not child
  220.  
  221.     wxMDIFrame(wxWnd *parent, wxWindow *wx_win, char *title=NULL,
  222.                 int x=-1, int y=-1, int width=-1, int height=-1);
  223.     ~wxMDIFrame(void);
  224.  
  225.     void OnCreate(LPCREATESTRUCT cs);
  226.     BOOL OnPaint(void);
  227.     BOOL OnClose(void);
  228.     void OnSize(int x, int y, UINT);
  229.     BOOL OnCommand(WORD id, WORD cmd, HWND control);
  230.     void OnMenuSelect(WORD, WORD, HMENU);
  231.     long DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  232.     BOOL ProcessMessage(MSG *msg);
  233.     BOOL OnEraseBkgnd(HDC pDC);
  234. };
  235.  
  236. class wxMDIChild : public wxWnd
  237. {
  238. public:
  239.     Bool active;
  240.     Bool iconized;
  241.     HICON icon;
  242.     wxMDIChild(wxMDIFrame *parent, wxWindow *wx_win, char *title=NULL,
  243.                 int x=-1, int y=-1, int width=-1, int height=-1);
  244.     ~wxMDIChild(void);
  245.  
  246.     BOOL OnMDIActivate(BOOL bActivate, HWND, HWND);
  247.     BOOL OnPaint(void);
  248.     BOOL OnClose(void);
  249.     void OnSize(int x, int y, UINT);
  250.     BOOL OnCommand(WORD id, WORD cmd, HWND control);
  251.     void OnMenuSelect(WORD, WORD, HMENU);
  252.     long DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  253.     BOOL ProcessMessage(MSG *msg);
  254.     void DestroyWindow(void);
  255. };
  256.  
  257. #define         wxTYPE_XWND              1
  258. #define         wxTYPE_HWND              2
  259. #define         wxTYPE_HMENU             3
  260. #define         wxTYPE_MDICHILD          4
  261.  
  262. void wxGetCharSize(HWND wnd, int *x, int *y);
  263. void wxSliderEvent(HWND control, WORD wParam, WORD pos);
  264. wxWnd *wxFindWinFromHandle(HWND hWnd);
  265. extern HICON wxSTD_FRAME_ICON;
  266. #endif
  267.  
  268. #ifdef wx_xview
  269. #include <xview/server.h>
  270. extern Xv_Server xview_server;
  271. #endif
  272.  
  273.  
  274. #endif // wx_privth
  275.  
  276.