Debian Codegraph @

editor/EditLineDialog.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 // EditLineDialog.h : header file
20 //
21
22 /////////////////////////////////////////////////////////////////////////////
23 // CEditLineDialog dialog
24
25 class CEditLineDialog : public CDialog {
26 // Construction
27 public:
28 CEditLineDialog(char *caption, char *title, char *initial, bool numeric, CWnd *pParent); // standard constructor
29 CEditLineDialog(char *caption, CWnd *pParent); // standard constructor
30
31 // Dialog Data
32 //{{AFX_DATA(CEditLineDialog)
33 enum { IDD = IDD_EDITLINEDLG };
34 // NOTE: the ClassWizard will add data members here
35 //}}AFX_DATA
36
37 // Overrides
38 // ClassWizard generated virtual function overrides
39 //{{AFX_VIRTUAL(CEditLineDialog)
40 protected:
41 virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
42 //}}AFX_VIRTUAL
43
44 // Implementation
45 protected:
46 // Generated message map functions
47 //{{AFX_MSG(CEditLineDialog)
48 virtual void OnOK();
49 virtual BOOL OnInitDialog();
50 //}}AFX_MSG
51 DECLARE_MESSAGE_MAP()
52
53 private:
54 CString m_EditBuf;
55 // char m_Caption[64];
56 int size;
57 char *m_Buffer;
58 char *m_Caption;
59 char *m_Initial;
60 char *m_Title;
61
62 bool m_Numeric; // flag for whether this is numeric
63
64 public:
65 // returns a pointer to the inputted text.
66 LPCSTR GetText() const { return (LPCSTR)m_EditBuf; };
67 };
68
69 // Gets a string from the user
70 // Parameters: buf - buffer the string is written to. should be initialized to default value
71 // maxsize - the length of buf
72 // title - the title for the input window
73 // prompt - the prompt for the input box
74 // Returns: false if cancel was pressed on the dialog, else true
75 // If false returned, buf is unchanged
76 bool InputString(char *buf, int maxsize, char *title, char *prompt, CWnd *wnd = NULL);
77
78 // Gets a number from the user
79 // Parameters: n - filled in the with return value
80 // title - the title for the input window
81 // prompt - the prompt for the input box
82 // Returns: false if cancel was pressed on the dialog, else true
83 // If false returned, n is unchanged
84 bool InputNumber(int *n, char *title, char *prompt, CWnd *wnd = NULL);