~ubuntu-branches/ubuntu/warty/openafs/warty

« back to all changes in this revision

Viewing changes to src/WINNT/afsusrmgr/usr_tab.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2004-01-10 16:37:33 UTC
  • Revision ID: james.westby@ubuntu.com-20040110163733-jvr0n1uahshlb1uu
Tags: upstream-1.2.11
ImportĀ upstreamĀ versionĀ 1.2.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2000, International Business Machines Corporation and others.
 
3
 * All Rights Reserved.
 
4
 * 
 
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
 */
 
9
 
 
10
extern "C" {
 
11
#include <afs/param.h>
 
12
#include <afs/stds.h>
 
13
}
 
14
 
 
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"
 
21
 
 
22
 
 
23
/*
 
24
 * RESIZING WINDOWS ___________________________________________________________
 
25
 *
 
26
 */
 
27
 
 
28
rwWindowData awdUsersTab[] = {
 
29
    { IDC_USERS_TITLE, raRepaint | raSizeX },
 
30
    { IDC_ADVANCED, raMoveX },
 
31
    { IDC_USERS_PATTERN, raMoveX },
 
32
    { IDC_USERS_PATTERN_PROMPT, raRepaint | raMoveX },
 
33
    { IDC_USERS_LIST, raSizeX | raSizeY },
 
34
    { M_USER_CREATE, raMoveX | raMoveY },
 
35
    { M_MEMBERSHIP, raMoveX | raMoveY },
 
36
    { M_PROPERTIES, raMoveX | raMoveY },
 
37
    { IDC_STATIC, raRepaint },
 
38
    { idENDLIST, 0 }
 
39
 };
 
40
 
 
41
 
 
42
/*
 
43
 * DEFINITIONS ________________________________________________________________
 
44
 *
 
45
 */
 
46
 
 
47
#define ID_SEARCH_TIMER     0
 
48
 
 
49
#define msecSEARCH_TIMER  650
 
50
 
 
51
static struct
 
52
   {
 
53
   DWORD dwTickLastType;
 
54
   } l;
 
55
 
 
56
 
 
57
/*
 
58
 * PROTOTYPES _________________________________________________________________
 
59
 *
 
60
 */
 
61
 
 
62
void Users_EnableButtons (HWND hDlg);
 
63
 
 
64
 
 
65
/*
 
66
 * ROUTINES ___________________________________________________________________
 
67
 *
 
68
 */
 
69
 
 
70
BOOL CALLBACK Users_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
 
71
{
 
72
   if (Display_HandleColumnNotify (hDlg, msg, wp, lp, &gr.viewUsr))
 
73
      return FALSE;
 
74
 
 
75
   switch (msg)
 
76
      {
 
77
      case WM_INITDIALOG:
 
78
         {
 
79
         RECT rTab;
 
80
         GetClientRect (GetParent(hDlg), &rTab);
 
81
         TabCtrl_AdjustRect (GetParent (hDlg), FALSE, &rTab); 
 
82
         ResizeWindow (hDlg, awdUsersTab, rwaMoveToHere, &rTab);
 
83
 
 
84
         HIMAGELIST hSmall = AfsAppLib_CreateImageList (FALSE);
 
85
         HIMAGELIST hLarge = AfsAppLib_CreateImageList (TRUE);
 
86
         FastList_SetImageLists (GetDlgItem (hDlg, IDC_USERS_LIST), hSmall, hLarge);
 
87
 
 
88
         FastList_SetSortFunction (GetDlgItem (hDlg, IDC_USERS_LIST), General_ListSortFunction);
 
89
 
 
90
         FL_RestoreView (GetDlgItem (hDlg, IDC_USERS_LIST), &gr.viewUsr);
 
91
         FastList_SetTextCallback (GetDlgItem (hDlg, IDC_USERS_LIST), Display_GetItemText, (DWORD)&gr.viewUsr);
 
92
         SetDlgItemText (hDlg, IDC_USERS_PATTERN, g.szPatternUsers);
 
93
         Users_EnableButtons(hDlg);
 
94
         Display_PopulateUserList();
 
95
 
 
96
         l.dwTickLastType = 0;
 
97
         }
 
98
         break;
 
99
 
 
100
      case WM_HELP:
 
101
         WinHelp (hDlg, cszHELPFILENAME, HELP_FINDER, 0);
 
102
         break;
 
103
 
 
104
      case WM_DESTROY:
 
105
         FL_StoreView (GetDlgItem (hDlg, IDC_USERS_LIST), &gr.viewUsr);
 
106
         break;
 
107
 
 
108
      case WM_SIZE:
 
109
         // if (lp==0), we're minimizing--don't call ResizeWindow().
 
110
         //
 
111
         if (lp != 0)
 
112
            ResizeWindow (hDlg, awdUsersTab, rwaFixupGuts);
 
113
         break;
 
114
 
 
115
      case WM_TIMER:
 
116
         switch (wp)
 
117
            {
 
118
            case ID_SEARCH_TIMER:
 
119
               if ( (l.dwTickLastType) && (GetTickCount() > l.dwTickLastType + msecSEARCH_TIMER) )
 
120
                  {
 
121
                  KillTimer (hDlg, ID_SEARCH_TIMER);
 
122
                  Display_PopulateUserList();
 
123
                  }
 
124
               break;
 
125
            }
 
126
         break;
 
127
 
 
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;
 
134
 
 
135
      case WM_COMMAND:
 
136
         switch (LOWORD(wp))
 
137
            {
 
138
            case IDC_USERS_PATTERN:
 
139
               if (HIWORD(wp) == EN_UPDATE)
 
140
                  {
 
141
                  l.dwTickLastType = GetTickCount();
 
142
                  KillTimer (hDlg, ID_SEARCH_TIMER);
 
143
                  SetTimer (hDlg, ID_SEARCH_TIMER, msecSEARCH_TIMER +15, NULL);
 
144
                  }
 
145
               break;
 
146
 
 
147
            case IDC_ADVANCED:
 
148
               Users_ShowAdvancedSearch (g.hMain);
 
149
               break;
 
150
 
 
151
            default:
 
152
               OnContextCommand (LOWORD(wp));
 
153
               break;
 
154
            }
 
155
         break;
 
156
 
 
157
      case WM_NOTIFY:
 
158
         switch (((LPNMHDR)lp)->code)
 
159
            {
 
160
            case FLN_ITEMSELECT:
 
161
               Main_SetMenus();
 
162
               Users_EnableButtons(hDlg);
 
163
               break;
 
164
 
 
165
            case FLN_LDBLCLICK:
 
166
               PostMessage (hDlg, WM_COMMAND, MAKELONG(M_PROPERTIES,BN_CLICKED), (LPARAM)GetDlgItem (hDlg, M_PROPERTIES));
 
167
               break;
 
168
            }
 
169
         break;
 
170
      }
 
171
 
 
172
   return FALSE;
 
173
}
 
174
 
 
175
 
 
176
void Users_EnableButtons (HWND hDlg)
 
177
{
 
178
   BOOL fEnable = (Display_GetSelectedCount() != 0) ? TRUE : FALSE;
 
179
   EnableWindow (GetDlgItem (hDlg, M_PROPERTIES), fEnable);
 
180
   EnableWindow (GetDlgItem (hDlg, M_MEMBERSHIP), fEnable);
 
181
}
 
182