| 1 | /* | 
|---|
| 2 | * synergy -- mouse and keyboard sharing utility | 
|---|
| 3 | * Copyright (C) 2003 Chris Schoeneman | 
|---|
| 4 | * | 
|---|
| 5 | * This package is free software; you can redistribute it and/or | 
|---|
| 6 | * modify it under the terms of the GNU General Public License | 
|---|
| 7 | * found in the file COPYING that should have accompanied this file. | 
|---|
| 8 | * | 
|---|
| 9 | * This package is distributed in the hope that it will be useful, | 
|---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 12 | * GNU General Public License for more details. | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | #ifndef CADDSCREEN_H | 
|---|
| 16 | #define CADDSCREEN_H | 
|---|
| 17 |  | 
|---|
| 18 | #include "CString.h" | 
|---|
| 19 |  | 
|---|
| 20 | #define WINDOWS_LEAN_AND_MEAN | 
|---|
| 21 | #include <windows.h> | 
|---|
| 22 |  | 
|---|
| 23 | class CConfig; | 
|---|
| 24 |  | 
|---|
| 25 | //! Add screen dialog for Microsoft Windows launcher | 
|---|
| 26 | class CAddScreen { | 
|---|
| 27 | public: | 
|---|
| 28 | CAddScreen(HWND parent, CConfig*, const CString& name); | 
|---|
| 29 | ~CAddScreen(); | 
|---|
| 30 |  | 
|---|
| 31 | //! @name manipulators | 
|---|
| 32 | //@{ | 
|---|
| 33 |  | 
|---|
| 34 | //! Run dialog | 
|---|
| 35 | /*! | 
|---|
| 36 | Display and handle the dialog until closed by the user.  Return | 
|---|
| 37 | \c true if the user accepted the changes, false otherwise. | 
|---|
| 38 | */ | 
|---|
| 39 | bool                            doModal(); | 
|---|
| 40 |  | 
|---|
| 41 | //@} | 
|---|
| 42 | //! @name accessors | 
|---|
| 43 | //@{ | 
|---|
| 44 |  | 
|---|
| 45 | CString                         getName() const; | 
|---|
| 46 |  | 
|---|
| 47 | //@} | 
|---|
| 48 |  | 
|---|
| 49 | private: | 
|---|
| 50 | typedef std::vector<CString> CStringList; | 
|---|
| 51 |  | 
|---|
| 52 | void                            getAliases(CStringList&) const; | 
|---|
| 53 | void                            getOptions(CConfig::CScreenOptions&) const; | 
|---|
| 54 |  | 
|---|
| 55 | static void                     tokenize(CStringList& tokens, const CString& src); | 
|---|
| 56 | static bool                     isNameInList(const CStringList& tokens, | 
|---|
| 57 | const CString& src); | 
|---|
| 58 |  | 
|---|
| 59 | void                            init(HWND hwnd); | 
|---|
| 60 | bool                            save(HWND hwnd); | 
|---|
| 61 |  | 
|---|
| 62 | // message handling | 
|---|
| 63 | BOOL                            doDlgProc(HWND, UINT, WPARAM, LPARAM); | 
|---|
| 64 | static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM); | 
|---|
| 65 |  | 
|---|
| 66 | private: | 
|---|
| 67 | static CAddScreen*      s_singleton; | 
|---|
| 68 |  | 
|---|
| 69 | HWND                            m_parent; | 
|---|
| 70 | CConfig*                        m_config; | 
|---|
| 71 | CString                         m_name; | 
|---|
| 72 | }; | 
|---|
| 73 |  | 
|---|
| 74 | #endif | 
|---|