Properly implement all key operations: new, delete, rename.
[wine] / programs / regedit / main.h
1 /*
2  * Regedit definitions
3  *
4  * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __MAIN_H__
22 #define __MAIN_H__
23
24 #include "resource.h"
25
26
27 #define STATUS_WINDOW   2001
28 #define TREE_WINDOW     2002
29 #define LIST_WINDOW     2003
30
31 #define SPLIT_WIDTH     5
32
33 #define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
34
35 #define PM_MODIFYVALUE  0
36 #define PM_NEW          1
37
38 #define MAX_NEW_KEY_LEN 128
39
40 extern HINSTANCE hInst;
41
42 /******************************************************************************/
43
44 enum OPTION_FLAGS {
45     OPTIONS_AUTO_REFRESH                   = 0x01,
46     OPTIONS_READ_ONLY_MODE                 = 0x02,
47     OPTIONS_CONFIRM_ON_DELETE              = 0x04,
48     OPTIONS_SAVE_ON_EXIT                   = 0x08,
49     OPTIONS_DISPLAY_BINARY_DATA            = 0x10,
50     OPTIONS_VIEW_TREE_ONLY                 = 0x20,
51     OPTIONS_VIEW_DATA_ONLY                 = 0x40,
52 };
53
54 typedef struct {
55     HWND    hWnd;
56     HWND    hTreeWnd;
57     HWND    hListWnd;
58     int     nFocusPanel;      /* 0: left  1: right */
59     int     nSplitPos;
60     WINDOWPLACEMENT pos;
61     TCHAR   szPath[MAX_PATH];
62 } ChildWnd;
63 extern ChildWnd* g_pChildWnd;
64
65 /*******************************************************************************
66  * Global Variables:
67  */
68 extern HINSTANCE hInst;
69 extern HWND      hFrameWnd;
70 extern HMENU     hMenuFrame;
71 extern HWND      hStatusBar;
72 extern HMENU     hPopupMenus;
73 extern HFONT     hFont;
74 extern enum OPTION_FLAGS Options;
75
76 extern TCHAR szTitle[];
77 extern TCHAR szFrameClass[];
78 extern TCHAR szChildClass[];
79
80 /* about.c */
81 extern void ShowAboutBox(HWND hWnd);
82
83 /* childwnd.c */
84 extern LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
85
86 /* framewnd.c */
87 extern LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
88 extern void SetupStatusBar(HWND hWnd, BOOL bResize);
89 extern void UpdateStatusBar(void);
90
91 /* listview.c */
92 extern HWND CreateListView(HWND hwndParent, int id);
93 extern BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath);
94 extern HWND StartValueRename(HWND hwndLV);
95 extern LPCTSTR GetValueName(HWND hwndLV);
96 extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
97 extern BOOL IsDefaultValue(HWND hwndLV, int i);
98
99 /* treeview.c */
100 extern HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id);
101 extern BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv);
102 extern LPCTSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
103 extern BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem);
104 extern HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPTSTR name);
105 extern HWND StartKeyRename(HWND hwndTV);
106
107 /* edit.c */
108 extern BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPTSTR newKeyName);
109 extern BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, DWORD valueType);
110 extern BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName);
111 extern BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath);
112 extern BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName);
113 extern BOOL RenameValue(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR oldName, LPCTSTR newName);
114 extern BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR newName);
115
116 #endif /* __MAIN_H__ */