LINUX: afs_create infinite fetchStatus loop
[pkg-k5-afs_openafs.git] / src / WINNT / afsusrmgr / usr_tab.cpp
blob16989eddf3d25c9d89fb3be16d02f0a05186ca47
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 extern "C" {
11 #include <afs/param.h>
12 #include <afs/stds.h>
15 #include "TaAfsUsrMgr.h"
16 #include "usr_tab.h"
17 #include "usr_col.h"
18 #include "usr_search.h"
19 #include "command.h"
20 #include "window.h"
24 * RESIZING WINDOWS ___________________________________________________________
28 rwWindowData awdUsersTab[] = {
29 { IDC_USERS_TITLE, raRepaint | raSizeX, 0, 0 },
30 { IDC_ADVANCED, raMoveX, 0, 0 },
31 { IDC_USERS_PATTERN, raMoveX, 0, 0 },
32 { IDC_USERS_PATTERN_PROMPT, raRepaint | raMoveX, 0, 0 },
33 { IDC_USERS_LIST, raSizeX | raSizeY, 0, 0 },
34 { M_USER_CREATE, raMoveX | raMoveY, 0, 0 },
35 { M_MEMBERSHIP, raMoveX | raMoveY, 0, 0 },
36 { M_PROPERTIES, raMoveX | raMoveY, 0, 0 },
37 { IDC_STATIC, raRepaint, 0, 0 },
38 { idENDLIST, 0, 0, 0 }
43 * DEFINITIONS ________________________________________________________________
47 #define ID_SEARCH_TIMER 0
49 #define msecSEARCH_TIMER 650
51 static struct
53 DWORD dwTickLastType;
54 } l;
58 * PROTOTYPES _________________________________________________________________
62 void Users_EnableButtons (HWND hDlg);
66 * ROUTINES ___________________________________________________________________
70 BOOL CALLBACK Users_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
72 if (Display_HandleColumnNotify (hDlg, msg, wp, lp, &gr.viewUsr))
73 return FALSE;
75 switch (msg)
77 case WM_INITDIALOG:
79 RECT rTab;
80 GetClientRect (GetParent(hDlg), &rTab);
81 TabCtrl_AdjustRect (GetParent (hDlg), FALSE, &rTab);
82 ResizeWindow (hDlg, awdUsersTab, rwaMoveToHere, &rTab);
84 HIMAGELIST hSmall = AfsAppLib_CreateImageList (FALSE);
85 HIMAGELIST hLarge = AfsAppLib_CreateImageList (TRUE);
86 FastList_SetImageLists (GetDlgItem (hDlg, IDC_USERS_LIST), hSmall, hLarge);
88 FastList_SetSortFunction (GetDlgItem (hDlg, IDC_USERS_LIST), General_ListSortFunction);
90 FL_RestoreView (GetDlgItem (hDlg, IDC_USERS_LIST), &gr.viewUsr);
91 FastList_SetTextCallback (GetDlgItem (hDlg, IDC_USERS_LIST), Display_GetItemText, &gr.viewUsr);
92 SetDlgItemText (hDlg, IDC_USERS_PATTERN, g.szPatternUsers);
93 Users_EnableButtons(hDlg);
94 Display_PopulateUserList();
96 l.dwTickLastType = 0;
98 break;
100 case WM_HELP:
101 WinHelp (hDlg, cszHELPFILENAME, HELP_FINDER, 0);
102 break;
104 case WM_DESTROY:
105 FL_StoreView (GetDlgItem (hDlg, IDC_USERS_LIST), &gr.viewUsr);
106 break;
108 case WM_SIZE:
109 // if (lp==0), we're minimizing--don't call ResizeWindow().
111 if (lp != 0)
112 ResizeWindow (hDlg, awdUsersTab, rwaFixupGuts);
113 break;
115 case WM_TIMER:
116 switch (wp)
118 case ID_SEARCH_TIMER:
119 if ( (l.dwTickLastType) && (GetTickCount() > l.dwTickLastType + msecSEARCH_TIMER) )
121 KillTimer (hDlg, ID_SEARCH_TIMER);
122 Display_PopulateUserList();
124 break;
126 break;
128 case WM_CONTEXTMENU:
129 POINT ptScreen;
130 ptScreen.x = LOWORD(lp);
131 ptScreen.y = HIWORD(lp);
132 OnRightClick (pmUSER, GetDlgItem (hDlg, IDC_USERS_LIST), &ptScreen);
133 break;
135 case WM_COMMAND:
136 switch (LOWORD(wp))
138 case IDC_USERS_PATTERN:
139 if (HIWORD(wp) == EN_UPDATE)
141 l.dwTickLastType = GetTickCount();
142 KillTimer (hDlg, ID_SEARCH_TIMER);
143 SetTimer (hDlg, ID_SEARCH_TIMER, msecSEARCH_TIMER +15, NULL);
145 break;
147 case IDC_ADVANCED:
148 Users_ShowAdvancedSearch (g.hMain);
149 break;
151 default:
152 OnContextCommand (LOWORD(wp));
153 break;
155 break;
157 case WM_NOTIFY:
158 switch (((LPNMHDR)lp)->code)
160 case FLN_ITEMSELECT:
161 Main_SetMenus();
162 Users_EnableButtons(hDlg);
163 break;
165 case FLN_LDBLCLICK:
166 PostMessage (hDlg, WM_COMMAND, MAKELONG(M_PROPERTIES,BN_CLICKED), (LPARAM)GetDlgItem (hDlg, M_PROPERTIES));
167 break;
169 break;
172 return FALSE;
176 void Users_EnableButtons (HWND hDlg)
178 BOOL fEnable = (Display_GetSelectedCount() != 0) ? TRUE : FALSE;
179 EnableWindow (GetDlgItem (hDlg, M_PROPERTIES), fEnable);
180 EnableWindow (GetDlgItem (hDlg, M_MEMBERSHIP), fEnable);