2 * Copyright 2000, International Business Machines Corporation and others.
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
11 #include <afs/param.h>
15 #include "TaAfsUsrMgr.h"
18 #include "usr_search.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
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
))
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();
101 WinHelp (hDlg
, cszHELPFILENAME
, HELP_FINDER
, 0);
105 FL_StoreView (GetDlgItem (hDlg
, IDC_USERS_LIST
), &gr
.viewUsr
);
109 // if (lp==0), we're minimizing--don't call ResizeWindow().
112 ResizeWindow (hDlg
, awdUsersTab
, rwaFixupGuts
);
118 case ID_SEARCH_TIMER
:
119 if ( (l
.dwTickLastType
) && (GetTickCount() > l
.dwTickLastType
+ msecSEARCH_TIMER
) )
121 KillTimer (hDlg
, ID_SEARCH_TIMER
);
122 Display_PopulateUserList();
130 ptScreen
.x
= LOWORD(lp
);
131 ptScreen
.y
= HIWORD(lp
);
132 OnRightClick (pmUSER
, GetDlgItem (hDlg
, IDC_USERS_LIST
), &ptScreen
);
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
);
148 Users_ShowAdvancedSearch (g
.hMain
);
152 OnContextCommand (LOWORD(wp
));
158 switch (((LPNMHDR
)lp
)->code
)
162 Users_EnableButtons(hDlg
);
166 PostMessage (hDlg
, WM_COMMAND
, MAKELONG(M_PROPERTIES
,BN_CLICKED
), (LPARAM
)GetDlgItem (hDlg
, M_PROPERTIES
));
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
);