|
/*
$Workfile:$
$Header:$
Copyright � 2003 Friedrich Brunzema.
All rights reserved.
@doc
@module DSOP_Filter.cpp - Source for the Filter Dialog |
Revision History:
$Log$
*/
#include "stdafx.h"
#include "SelectUsersOrGroups.h"
#include "DSOP_Filter.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/*
Begin and end of the id's of the checkboxes in the dialog
Note: these have to be consecutive and match the User Interface.
Also: the UI has been set up to match the ObjSel.h as shown below:
The flMixedModeOnly/flNativeModeOnly member of an uplevel scope can
contain one or more of the following flags (at least one must be specified):
DSOP_FILTER_INCLUDE_ADVANCED_VIEW
Include objects which have the attribute showInAdvancedViewOnly set to
true.
DSOP_FILTER_USERS
Include user objects.
DSOP_FILTER_BUILTIN_GROUPS
Include group objects with a groupType value having the flag
GROUP_TYPE_BUILTIN_LOCAL_GROUP.
DSOP_FILTER_WELL_KNOWN_PRINCIPALS
Include the contents of the WellKnown Security Principals container.
DSOP_FILTER_UNIVERSAL_GROUPS_DL
Include distribution list universal groups.
DSOP_FILTER_UNIVERSAL_GROUPS_SE
Include security enabled universal groups.
DSOP_FILTER_GLOBAL_GROUPS_DL
Include distribution list global groups.
DSOP_FILTER_GLOBAL_GROUPS_SE
Include security enabled global groups.
DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL
Include distribution list domain global groups.
DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE
Include security enabled domain local groups.
DSOP_FILTER_CONTACTS
Include contact objects.
DSOP_FILTER_COMPUTERS
Include computer objects.
#define DSOP_FILTER_INCLUDE_ADVANCED_VIEW 0x00000001
#define DSOP_FILTER_USERS 0x00000002
#define DSOP_FILTER_BUILTIN_GROUPS 0x00000004
#define DSOP_FILTER_WELL_KNOWN_PRINCIPALS 0x00000008
#define DSOP_FILTER_UNIVERSAL_GROUPS_DL 0x00000010
#define DSOP_FILTER_UNIVERSAL_GROUPS_SE 0x00000020
#define DSOP_FILTER_GLOBAL_GROUPS_DL 0x00000040
#define DSOP_FILTER_GLOBAL_GROUPS_SE 0x00000080
#define DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL 0x00000100
#define DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE 0x00000200
#define DSOP_FILTER_CONTACTS 0x00000400
#define DSOP_FILTER_COMPUTERS 0x00000800
*/
const UINT LOW_CHECKBOX = IDC_CHECK121; // first checkbox
const UINT HI_CHECKBOX = IDC_CHECK132; // last checkbox (matching the
// DSOP_FILTER* above
CDSOP_Filter::CDSOP_Filter(CWnd* pParent)
: CDialog(CDSOP_Filter::IDD, pParent)
{
//{{AFX_DATA_INIT(CDSOP_Filter)
//}}AFX_DATA_INIT
}
void CDSOP_Filter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDSOP_Filter)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDSOP_Filter, CDialog)
//{{AFX_MSG_MAP(CDSOP_Filter)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*
Name: CDSOP_Filter::OnInitDialog
Type: Protected
Override: No
@mfunc
Description:
Called before the dialog is shown
@rdesc BOOL - true
*/
BOOL CDSOP_Filter::OnInitDialog()
{
int i; // loop counter
int ct; // bit position count
DWORD mask; // mask
// initialize bit position
ct = 0;
// required by framework
CDialog::OnInitDialog();
// loop to set our checkboxes according to bit pattern in
// the m_flags variable
for (i=LOW_CHECKBOX; i<=HI_CHECKBOX; i++)
{
// figure out what the mask is
mask = (DWORD)1 << ct;
// if the bit is set, set the corresponding checkbox
if (mask & m_flags)
{
((CButton*)GetDlgItem(i))->SetCheck(i);
}
else // otherwise reset it
{
((CButton*)GetDlgItem(i))->SetCheck(0);
}
++ct; // increment bit position
}
return TRUE;
}
/*
Name: CDSOP_Filter::OnOK
Type: Protected
Override: No
@mfunc
Description:
Called to validate the dialog
@rdesc void - n/a
*/
void CDSOP_Filter::OnOK()
{
int i; // loop counter
int ct; // bit position
DWORD mask; // mask
BOOL fCheck; // bit
// initialize
ct = 0;
m_flags = 0;
// figure out the new bit pattern according to what the checkboxes say
for (i=LOW_CHECKBOX; i<=HI_CHECKBOX; i++)
{
// get the checkbox state
fCheck = ((CButton*)GetDlgItem(i))->GetCheck();
// if we're checked, set the corresponding bit in the m_flags
if (fCheck)
{
mask = (DWORD)1 << ct;
m_flags |= mask;
}
++ct; // increment bit position
}
// call EndDialog()
CDialog::OnOK();
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I was born and grew up in Northern Germany grew up in Quebec in a French Language environment. I finished High School in Fergus, Ontario. After a 4 year training as a Pipe Organ Builder in Germany, I returned to Canada to get a B.Sc. in Computer Science. I'm currently working for a company called AB SCIEX working on Mass Spectrometer Software, am married, and have three often wonderful children. What you believe in matters - I am a follower of Jesus Christ - we attend a German-Lutheran congregation in downtown
Toronto.