blob: ada820b3ab02c60a2c8dd4bd9ac159ddf848646d [file] [log] [blame]
Constantin Kaplinsky729598c2006-05-25 05:12:25 +00001/* Copyright (C) 2004 TightVNC Team. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19// -=- ChoosePixelFormatDialog.h
20
21#include <rfb_win32/Dialog.h>
22
23class ChoosePixelFormatDialog : public rfb::win32::Dialog {
24public:
25 ChoosePixelFormatDialog(PixelFormatList *_supportedPF)
26 : Dialog(GetModuleHandle(0)), supportedPF(_supportedPF), combo(0) {}
27 // - Show the dialog and return true if OK was clicked,
28 // false in case of error or Cancel
29 virtual bool showDialog(HWND parent) {
30 return Dialog::showDialog(MAKEINTRESOURCE(IDD_PIXELFORMAT), parent);
31 }
32 const long getPFIndex() const {return pfIndex;}
33 bool isBigEndian() {return isItemChecked(IDC_BIG_ENDIAN);}
34protected:
35
36 // Dialog methods (protected)
37 virtual void initDialog() {
38 combo = GetDlgItem(handle, IDC_PIXELFORMAT);
39 SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)("Auto"));
40 for (int i = 0; i < supportedPF->count(); i++) {
41 SendMessage(combo, CB_ADDSTRING,
42 0, (LPARAM)(LPCTSTR)(((*supportedPF)[i])->format_name));
43 }
44 SendMessage(combo, CB_SETCURSEL, pfIndex + 1, 0);
45 setItemChecked(IDC_BIG_ENDIAN, bigEndian);
46 }
47 virtual bool onOk() {
48 pfIndex = SendMessage(combo, CB_GETCURSEL, 0, 0) - 1;
49 bigEndian = isItemChecked(IDC_BIG_ENDIAN);
50 return true;
51 }
52 virtual bool onCancel() {
53 return false;
54 }
55 static long pfIndex;
56 static bool bigEndian;
57 PixelFormatList *supportedPF;
58 HWND combo;
59};