ScummVM API documentation
rules.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef HODJNPODJ_HNPLIBS_RULES_H
23 #define HODJNPODJ_HNPLIBS_RULES_H
24 
25 #include "bagel/hodjnpodj/hnplibs/dibdoc.h"
26 
27 namespace Bagel {
28 namespace HodjNPodj {
29 
30 #define IDD_RULES_DIALOG 900
31 #define IDC_RULES_OKAY 900
32 
33 #define IDC_RULES_ARROWDN 901
34 #define IDC_RULES_ARROWUP 902
35 #define IDC_RULES_INVALID 903
36 
37 
38 class CRules : public CDialog {
39 // Construction
40 public:
41  CRules(CWnd *pParent = nullptr, const char *pszPathName = nullptr,
42  CPalette *pPalette = nullptr, const char *pszSoundPath = nullptr);
43 
44  void UpdateScroll(int nPage);
45  void ClearDialogImage();
46  void RefreshBackground();
47 
48 private:
49 
50  bool SetupKeyboardHook();
51  void RemoveKeyboardHook();
52 
53  static CDibDoc *LoadScrollDIB(const char *pSpec, CRect *pRect);
54  static bool PaintScrollDIB(CDC *pDC, CDibDoc *pDibDoc);
55  static CBitmap *CreateScrollBitmap(CDC *pDC, CDibDoc *pDibDoc, CPalette *pPalette);
56  static CDC *SetupMask(CDC *pDC, CDC *pBitmapDC, CBitmap *pMask, CBitmap * &pMaskOld, CRect *pRect);
57  static CDC *SetupCompatibleContext(CDC *pDC, CBitmap *pBitmap, CBitmap * &pBitmapOld, CPalette *pPalette, CPalette * &pPalOld);
58  static void ReleaseCompatibleContext(CDC * &pDC, CBitmap * &pBitmap, CBitmap *pBitmapOld, CPalette *pPalOld);
59 
60  bool CreateWorkAreas(CDC *pDC);
61  void UnfurlScroll(CDC *pDC);
62  void UpdateMore(CDC *pDC);
63  void WritePage(CDC *pDC, int nPage);
64  void ShowWaitCursor();
65  void DoWaitCursor(int nCode) override {
66  CDialog::DoWaitCursor(nCode);
67  }
68  void DoArrowCursor();
69 
70 private:
71  bool m_bKeyboardHook = false; // whether keyboard hook present
72  CRect OkayRect; // rectangle bounding the OKAY button
73  CRect ScrollRect, // x/y (left/right) and dx/dy (right/bottom) for the scroll window
74  ScrollTopRect, // rectangle bounding the scroll top section
75  ScrollBotRect, // rectangle bounding the scroll bottom section
76  ScrollMidRect; // rectangle bounding the scroll middle section
77 
78  CRect ScrollTopCurlRect, // current location of top curl for mouse clicks
79  ScrollBotCurlRect; // current location of bottom curl for mouse clicks
80 
81 // Dialog Data
82  //{{AFX_DATA(CRules)
83  enum { IDD = IDD_RULES_DIALOG };
84  // NOTE: the ClassWizard will add data members here
85  //}}AFX_DATA
86 
87 // Implementation
88 protected:
89  virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
90 
91  // Generated message map functions
92  //{{AFX_MSG(CRules)
93  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
94  virtual bool OnInitDialog() override;
95  afx_msg bool OnEraseBkgnd(CDC *pDC);
96  virtual void OnOK() override;
97  virtual void OnCancel() override;
98  afx_msg void OnDestroy();
99  afx_msg void OnPaint();
100  afx_msg void OnShowWindow(bool bShow, unsigned int nStatus);
101  afx_msg void OnSize(unsigned int nType, int cx, int cy);
102  afx_msg void OnMouseMove(unsigned int nFlags, CPoint point);
103  afx_msg bool OnSetCursor(CWnd *pWnd, unsigned int nHitTest, unsigned int message);
104  afx_msg void OnLButtonDown(unsigned int nFlags, CPoint point);
105  afx_msg void OnActivate(unsigned int nState, CWnd *pWndOther, bool bMinimized) override;
106  //}}AFX_MSG
107  DECLARE_MESSAGE_MAP()
108 };
109 
110 } // namespace HodjNPodj
111 } // namespace Bagel
112 
113 #endif
Definition: afxwin.h:1141
Definition: minwindef.h:292
Definition: afxwin.h:1116
Definition: afxwin.h:1599
virtual void DoWaitCursor(int nCode)
Definition: dibdoc.h:30
Definition: afxwin.h:667
Definition: rules.h:38
Definition: afxwin.h:721
Definition: afxwin.h:27
Definition: atltypes.h:131
Definition: atltypes.h:79
Definition: afxwin.h:635