Process Hacker
options.c
Go to the documentation of this file.
1 /*
2  * Process Hacker ToolStatus -
3  * rebar code
4  *
5  * Copyright (C) 2011-2015 dmex
6  * Copyright (C) 2010-2013 wj32
7  *
8  * This file is part of Process Hacker.
9  *
10  * Process Hacker is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * Process Hacker is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #include "toolstatus.h"
25 
26 INT_PTR CALLBACK OptionsDlgProc(
27  _In_ HWND hwndDlg,
28  _In_ UINT uMsg,
29  _In_ WPARAM wParam,
30  _In_ LPARAM lParam
31  )
32 {
33  switch (uMsg)
34  {
35  case WM_INITDIALOG:
36  {
37  HWND toolbarCombo = GetDlgItem(hwndDlg, IDC_DISPLAYSTYLECOMBO);
38  HWND searchboxCombo = GetDlgItem(hwndDlg, IDC_SEARCHBOX_DISPLAYSTYLECOMBO);
39 
40  ComboBox_AddString(toolbarCombo, L"No Text Labels"); // Displays no text label for the toolbar buttons.
41  ComboBox_AddString(toolbarCombo, L"Selective Text"); // (Selective Text On Right) Displays text for just the Refresh, Options, Find Handles and Sysinfo toolbar buttons.
42  ComboBox_AddString(toolbarCombo, L"Show Text Labels"); // Displays text labels for the toolbar buttons.
43  ComboBox_SetCurSel(toolbarCombo, PhGetIntegerSetting(SETTING_NAME_TOOLBARDISPLAYSTYLE));
44 
45  ComboBox_AddString(searchboxCombo, L"Always show");
46  ComboBox_AddString(searchboxCombo, L"Hide when inactive");
47  //ComboBox_AddString(searchboxCombo, L"Auto-hide");
48  ComboBox_SetCurSel(searchboxCombo, PhGetIntegerSetting(SETTING_NAME_SEARCHBOXDISPLAYMODE));
49 
50  Button_SetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_TOOLBAR),
51  PhGetIntegerSetting(SETTING_NAME_ENABLE_TOOLBAR) ? BST_CHECKED : BST_UNCHECKED);
52  Button_SetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_SEARCHBOX),
53  PhGetIntegerSetting(SETTING_NAME_ENABLE_SEARCHBOX) ? BST_CHECKED : BST_UNCHECKED);
54  Button_SetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_STATUSBAR),
55  PhGetIntegerSetting(SETTING_NAME_ENABLE_STATUSBAR) ? BST_CHECKED : BST_UNCHECKED);
56  Button_SetCheck(GetDlgItem(hwndDlg, IDC_RESOLVEGHOSTWINDOWS),
57  PhGetIntegerSetting(SETTING_NAME_ENABLE_RESOLVEGHOSTWINDOWS) ? BST_CHECKED : BST_UNCHECKED);
58  }
59  break;
60  case WM_COMMAND:
61  {
62  switch (GET_WM_COMMAND_ID(wParam, lParam))
63  {
64  case IDCANCEL:
65  EndDialog(hwndDlg, IDCANCEL);
66  break;
68  PostMessage(ToolBarHandle, TB_CUSTOMIZE, 0, 0);
69  break;
70  case IDOK:
71  {
73  (DisplayStyle = (TOOLBAR_DISPLAY_STYLE)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_DISPLAYSTYLECOMBO))));
75  (SearchBoxDisplayMode = (SEARCHBOX_DISPLAY_MODE)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_SEARCHBOX_DISPLAYSTYLECOMBO))));
77  (EnableToolBar = Button_GetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_TOOLBAR)) == BST_CHECKED));
79  (EnableSearchBox = Button_GetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_SEARCHBOX)) == BST_CHECKED));
81  (EnableStatusBar = Button_GetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_STATUSBAR)) == BST_CHECKED));
83  Button_GetCheck(GetDlgItem(hwndDlg, IDC_RESOLVEGHOSTWINDOWS)) == BST_CHECKED);
84 
86  InvalidateRect(ToolBarHandle, NULL, TRUE);
87 
88  EndDialog(hwndDlg, IDOK);
89  }
90  break;
91  }
92  }
93  break;
94  }
95 
96  return FALSE;
97 }