newntui/activex/groupscombo/src/groupscomboctl.cpp
//---------------------------------------------------------------------------------
// Creates NewSelectionList list vier to show complete set of groups and toolbar 
// control which will select the the mode to obtain elements.
//---------------------------------------------------------------------------------
Creates NewSelectionList list vier to show complete set of groups and toolbar
control which will select the the mode to obtain elements.
Creates NewSelectionList list vier to show complete set of groups and toolbar control which will select the the mode to obtain elements .
int CGroupsComboCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)  {
	if (COleControl::OnCreate(lpCreateStruct) == -1)
		return -1;
	m_ElementsList.Create( LVS_SHAREIMAGELISTS | 
		               LVS_LIST | 
					   WS_CHILD | 
					   WS_VISIBLE | 
					   LVS_NOCOLUMNHEADER | 
					   LVS_AUTOARRANGE |
					   LVS_SHOWSELALWAYS |
					   LVS_SORTASCENDING |
					   LVS_EDITLABELS,
		               CRect(lpCreateStruct->x, 
		                     lpCreateStruct->y,
			                 lpCreateStruct->x+lpCreateStruct->cx,
					         lpCreateStruct->y+lpCreateStruct->cy-10),
			       this,
				   IDC_GROUPSLIST); 
	m_ElementsList.ModifyStyleEx( 0, WS_EX_CLIENTEDGE);
    LV_COLUMN lvColumn;
	lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
	lvColumn.fmt=LVCFMT_LEFT;
	lvColumn.cx=150;
	lvColumn.iSubItem=0;
	lvColumn.pszText="Groups";
    m_ElementsList.InsertColumn(0,&lvColumn);
	m_ListImageList.Create(16,16,TRUE,1,0);
	CBitmap group;
	group.LoadBitmap(IDB_GROUP);
	m_ListImageList.Add(&group, RGB(255,255,255));
	m_ElementsList.SetImageList(&m_ListImageList,LVSIL_SMALL); 
    m_OpTools.Create(WS_CHILD | WS_VISIBLE | CCS_BOTTOM,
		                CRect(lpCreateStruct->x, 
		                      lpCreateStruct->y+lpCreateStruct->cy-0,
			                  lpCreateStruct->x+lpCreateStruct->cx,
					          lpCreateStruct->y+lpCreateStruct->cy),
			          this,
				      IDC_GROUPTOOLS);
	m_OpTools.SetBitmapSize(CSize(16,10));
	m_OpTools.SetButtonSize(CSize(18,12));
    TBBUTTON tbbutton;
    tbbutton.iBitmap  = 0;
    tbbutton.idCommand = IDB_ALL;
    tbbutton.fsState  = TBSTATE_ENABLED | TBSTATE_CHECKED;
    tbbutton.fsStyle  = TBSTYLE_CHECKGROUP;
    tbbutton.iString  = 0; 
	m_OpTools.AddButtons(1,&tbbutton);
    tbbutton.iBitmap  = 1;
    tbbutton.idCommand = IDB_INTERSECT;
    tbbutton.fsState  = TBSTATE_ENABLED;
    tbbutton.fsStyle  = TBSTYLE_CHECKGROUP;
    tbbutton.iString  = 1; 
	m_OpTools.AddButtons(1,&tbbutton);
    tbbutton.iBitmap  = 2;
    tbbutton.idCommand = IDB_DIFF;
    tbbutton.fsState  = TBSTATE_ENABLED;
    tbbutton.fsStyle  = TBSTYLE_CHECKGROUP;
    tbbutton.iString  = 2; 
	m_OpTools.AddButtons(1,&tbbutton);
    tbbutton.iBitmap  = -1;
    tbbutton.idCommand = -1;
    tbbutton.fsState  = 0;
    tbbutton.fsStyle  = TBSTYLE_SEP;
    tbbutton.iString  = -1; 
	m_OpTools.AddButtons(1,&tbbutton);
	tbbutton.iBitmap   = 3;
    tbbutton.idCommand = IDB_NEWGROUP;
    tbbutton.fsState   = TBSTATE_ENABLED;
    tbbutton.fsStyle   = TBSTYLE_BUTTON;
    tbbutton.iString   = 3; 
	m_OpTools.AddButtons(1,&tbbutton);
	tbbutton.iBitmap   = 4;
    tbbutton.idCommand = IDB_REMOVEGROUP;
    tbbutton.fsState   = TBSTATE_ENABLED;
    tbbutton.fsStyle   = TBSTYLE_BUTTON;
    tbbutton.iString   = 4; 
	m_OpTools.AddButtons(1,&tbbutton);
    tbbutton.iBitmap  = -1;
    tbbutton.idCommand = -1;
    tbbutton.fsState  = 0;
    tbbutton.fsStyle  = TBSTYLE_SEP;
    tbbutton.iString  = -1; 
	m_OpTools.AddButtons(1,&tbbutton);
	tbbutton.iBitmap   = 5;
    tbbutton.idCommand = IDB_REMOVESEL;
    tbbutton.fsState   = TBSTATE_ENABLED;
    tbbutton.fsStyle   = TBSTYLE_BUTTON;
    tbbutton.iString   = 5; 
	m_OpTools.AddButtons(1,&tbbutton);
    tbbutton.iBitmap  = -1;
    tbbutton.idCommand = -1;
    tbbutton.fsState  = 0;
    tbbutton.fsStyle  = TBSTYLE_SEP;
    tbbutton.iString  = -1; 
	m_OpTools.AddButtons(1,&tbbutton);
	tbbutton.iBitmap   = 6;
    tbbutton.idCommand = IDB_FINDFIRSTGROUP;
    tbbutton.fsState   = TBSTATE_ENABLED;
    tbbutton.fsStyle   = TBSTYLE_BUTTON;
    tbbutton.iString   = 6; 
	m_OpTools.AddButtons(1,&tbbutton);
	tbbutton.iBitmap   = 7;
    tbbutton.idCommand = IDB_FINDNEXTGROUP;
    tbbutton.fsState   = TBSTATE_ENABLED;
    tbbutton.fsStyle   = TBSTYLE_BUTTON;
    tbbutton.iString   = 7; 
	m_OpTools.AddButtons(1,&tbbutton);
	m_OpTools.AddBitmap(1,IDB_ALL);
	m_OpTools.AddBitmap(1,IDB_INTERSECT);
	m_OpTools.AddBitmap(1,IDB_DIFF);
	m_OpTools.AddBitmap(1,IDB_NEWGROUP);
	m_OpTools.AddBitmap(1,IDB_REMOVEGROUP);
	m_OpTools.AddBitmap(1,IDB_REMOVESEL);
	m_OpTools.AddBitmap(1,IDB_FINDFIRSTGROUP);
	m_OpTools.AddBitmap(1,IDB_FINDNEXTGROUP);
   CRect buttonRect;
   m_ToolTips.Create(this);
   m_OpTools.GetItemRect(0,buttonRect);
   m_ToolTips.AddTool(&m_OpTools,IDS_ALLELEMETS,buttonRect,IDB_ALL);
   m_OpTools.GetItemRect(1,buttonRect);
   m_ToolTips.AddTool(&m_OpTools,IDS_DIFFELEMENTS,buttonRect,IDB_DIFF);
   m_OpTools.GetItemRect(2,buttonRect);
   m_ToolTips.AddTool(&m_OpTools,IDS_COMMONELEMENTS,buttonRect,IDB_INTERSECT);
   m_OpTools.GetItemRect(4,buttonRect);
   m_ToolTips.AddTool(&m_OpTools,IDS_NEWGROUP,buttonRect,IDB_NEWGROUP);
   m_OpTools.GetItemRect(5,buttonRect);
   m_ToolTips.AddTool(&m_OpTools,IDS_REMOVEGROUP,buttonRect,IDB_REMOVEGROUP);
   m_OpTools.GetItemRect(7,buttonRect);
   m_ToolTips.AddTool(&m_OpTools,IDS_REMOVESEL,buttonRect,IDB_REMOVESEL);
   m_OpTools.GetItemRect(9,buttonRect);
   m_ToolTips.AddTool(&m_OpTools,IDS_FINDFIRSTGROUP,buttonRect,IDB_FINDFIRSTGROUP);
   m_OpTools.GetItemRect(10,buttonRect);
   m_ToolTips.AddTool(&m_OpTools,IDS_FINDNEXTGROUP,buttonRect,IDB_FINDNEXTGROUP);
   m_OpTools.SetToolTips(&m_ToolTips);
   SetToolbarStatus();
   return 0;
}
int CGroupsComboCtrl :: OnCreate ( LPCREATESTRUCT lpCreateStruct ) { if ( COleControl :: OnCreate ( lpCreateStruct ) == -1 ) return -1 ; m_ElementsList . Create ( LVS_SHAREIMAGELISTS | LVS_LIST | WS_CHILD | WS_VISIBLE | LVS_NOCOLUMNHEADER | LVS_AUTOARRANGE | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_EDITLABELS , CRect ( lpCreateStruct -> x , lpCreateStruct -> y , lpCreateStruct -> x + lpCreateStruct -> cx , lpCreateStruct -> y + lpCreateStruct -> cy - 10 ) , this , IDC_GROUPSLIST ) ; m_ElementsList . ModifyStyleEx ( 0 , WS_EX_CLIENTEDGE ) ; LV_COLUMN lvColumn ; lvColumn . mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT ; lvColumn . fmt = LVCFMT_LEFT ; lvColumn . cx = 150 ; lvColumn . iSubItem = 0 ; lvColumn . pszText = " " ; m_ElementsList . InsertColumn ( 0 , & lvColumn ) ; m_ListImageList . Create ( 16 , 16 , TRUE , 1 , 0 ) ; CBitmap group ; group . LoadBitmap ( IDB_GROUP ) ; m_ListImageList . Add ( & group , RGB ( 255 , 255 , 255 ) ) ; m_ElementsList . SetImageList ( & m_ListImageList , LVSIL_SMALL ) ; m_OpTools . Create ( WS_CHILD | WS_VISIBLE | CCS_BOTTOM , CRect ( lpCreateStruct -> x , lpCreateStruct -> y + lpCreateStruct -> cy - 0 , lpCreateStruct -> x + lpCreateStruct -> cx , lpCreateStruct -> y + lpCreateStruct -> cy ) , this , IDC_GROUPTOOLS ) ; m_OpTools . SetBitmapSize ( CSize ( 16 , 10 ) ) ; m_OpTools . SetButtonSize ( CSize ( 18 , 12 ) ) ; TBBUTTON tbbutton ; tbbutton . iBitmap = 0 ; tbbutton . idCommand = IDB_ALL ; tbbutton . fsState = TBSTATE_ENABLED | TBSTATE_CHECKED ; tbbutton . fsStyle = TBSTYLE_CHECKGROUP ; tbbutton . iString = 0 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; tbbutton . iBitmap = 1 ; tbbutton . idCommand = IDB_INTERSECT ; tbbutton . fsState = TBSTATE_ENABLED ; tbbutton . fsStyle = TBSTYLE_CHECKGROUP ; tbbutton . iString = 1 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; tbbutton . iBitmap = 2 ; tbbutton . idCommand = IDB_DIFF ; tbbutton . fsState = TBSTATE_ENABLED ; tbbutton . fsStyle = TBSTYLE_CHECKGROUP ; tbbutton . iString = 2 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; tbbutton . iBitmap = -1 ; tbbutton . idCommand = -1 ; tbbutton . fsState = 0 ; tbbutton . fsStyle = TBSTYLE_SEP ; tbbutton . iString = -1 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; tbbutton . iBitmap = 3 ; tbbutton . idCommand = IDB_NEWGROUP ; tbbutton . fsState = TBSTATE_ENABLED ; tbbutton . fsStyle = TBSTYLE_BUTTON ; tbbutton . iString = 3 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; tbbutton . iBitmap = 4 ; tbbutton . idCommand = IDB_REMOVEGROUP ; tbbutton . fsState = TBSTATE_ENABLED ; tbbutton . fsStyle = TBSTYLE_BUTTON ; tbbutton . iString = 4 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; tbbutton . iBitmap = -1 ; tbbutton . idCommand = -1 ; tbbutton . fsState = 0 ; tbbutton . fsStyle = TBSTYLE_SEP ; tbbutton . iString = -1 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; tbbutton . iBitmap = 5 ; tbbutton . idCommand = IDB_REMOVESEL ; tbbutton . fsState = TBSTATE_ENABLED ; tbbutton . fsStyle = TBSTYLE_BUTTON ; tbbutton . iString = 5 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; tbbutton . iBitmap = -1 ; tbbutton . idCommand = -1 ; tbbutton . fsState = 0 ; tbbutton . fsStyle = TBSTYLE_SEP ; tbbutton . iString = -1 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; tbbutton . iBitmap = 6 ; tbbutton . idCommand = IDB_FINDFIRSTGROUP ; tbbutton . fsState = TBSTATE_ENABLED ; tbbutton . fsStyle = TBSTYLE_BUTTON ; tbbutton . iString = 6 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; tbbutton . iBitmap = 7 ; tbbutton . idCommand = IDB_FINDNEXTGROUP ; tbbutton . fsState = TBSTATE_ENABLED ; tbbutton . fsStyle = TBSTYLE_BUTTON ; tbbutton . iString = 7 ; m_OpTools . AddButtons ( 1 , & tbbutton ) ; m_OpTools . AddBitmap ( 1 , IDB_ALL ) ; m_OpTools . AddBitmap ( 1 , IDB_INTERSECT ) ; m_OpTools . AddBitmap ( 1 , IDB_DIFF ) ; m_OpTools . AddBitmap ( 1 , IDB_NEWGROUP ) ; m_OpTools . AddBitmap ( 1 , IDB_REMOVEGROUP ) ; m_OpTools . AddBitmap ( 1 , IDB_REMOVESEL ) ; m_OpTools . AddBitmap ( 1 , IDB_FINDFIRSTGROUP ) ; m_OpTools . AddBitmap ( 1 , IDB_FINDNEXTGROUP ) ; CRect buttonRect ; m_ToolTips . Create ( this ) ; m_OpTools . GetItemRect ( 0 , buttonRect ) ; m_ToolTips . AddTool ( & m_OpTools , IDS_ALLELEMETS , buttonRect , IDB_ALL ) ; m_OpTools . GetItemRect ( 1 , buttonRect ) ; m_ToolTips . AddTool ( & m_OpTools , IDS_DIFFELEMENTS , buttonRect , IDB_DIFF ) ; m_OpTools . GetItemRect ( 2 , buttonRect ) ; m_ToolTips . AddTool ( & m_OpTools , IDS_COMMONELEMENTS , buttonRect , IDB_INTERSECT ) ; m_OpTools . GetItemRect ( 4 , buttonRect ) ; m_ToolTips . AddTool ( & m_OpTools , IDS_NEWGROUP , buttonRect , IDB_NEWGROUP ) ; m_OpTools . GetItemRect ( 5 , buttonRect ) ; m_ToolTips . AddTool ( & m_OpTools , IDS_REMOVEGROUP , buttonRect , IDB_REMOVEGROUP ) ; m_OpTools . GetItemRect ( 7 , buttonRect ) ; m_ToolTips . AddTool ( & m_OpTools , IDS_REMOVESEL , buttonRect , IDB_REMOVESEL ) ; m_OpTools . GetItemRect ( 9 , buttonRect ) ; m_ToolTips . AddTool ( & m_OpTools , IDS_FINDFIRSTGROUP , buttonRect , IDB_FINDFIRSTGROUP ) ; m_OpTools . GetItemRect ( 10 , buttonRect ) ; m_ToolTips . AddTool ( & m_OpTools , IDS_FINDNEXTGROUP , buttonRect , IDB_FINDNEXTGROUP ) ; m_OpTools . SetToolTips ( & m_ToolTips ) ; SetToolbarStatus ( ) ; return 0 ; }
Creates NewSelectionList list vier to show complete set of groups and toolbar
control which will select the the mode to obtain elements.
Creates NewSelectionList list vier to show complete set of groups and toolbar control which will select the the mode to obtain elements .
// List view to show all available groups // We will need only one column // And we will need image list with only one image which represents the group // Toolbar creation //Adding buttons to the toolbar // Adding bitmaps to the toolbar // Tool tips for the toolbar