void CEmoticonDlg::OnButtonEdit() { m_bHideWhenInactive = FALSE; if (m_listEmoticon.GetSelectedCount() == 0) { MessageBox("select emoticon!"); } else { POSITION pos = m_listEmoticon.GetFirstSelectedItemPosition(); if (pos) { LVITEM item = {0}; item.iItem = m_listEmoticon.GetNextSelectedItem(pos); item.mask = LVIF_PARAM; m_listEmoticon.GetItem(&item); Pattern* pPattern = (Pattern*) item.lParam; CPatternDlg dlg; dlg.m_pattern = *pPattern; if (dlg.DoModal() == IDOK) { CImageList* pImageList = m_listEmoticon.GetImageList(LVSIL_NORMAL); pImageList->Replace(item.iImage, pPattern->pIconBitmap, NULL); *pPattern = dlg.m_pattern; } } } m_bHideWhenInactive = TRUE; SaveEmoticons(); SetFocus(); }
// Handles clicking on different colors on the menu void CNoteDlg::OnChangeBkgndColor(COLORREF clrColor) { ATLASSERT(m_brBkgnd.m_hBrush); // Change the dialog's background color m_brBkgnd.DeleteObject(); m_brBkgnd.CreateSolidBrush(clrColor); Invalidate(); // Change the background color of the control displaying date and time m_wndStaticDateTime.ChangeBkgndColor(clrColor); // Change the background color of the edit control m_wndEdit.ChangeBkgndColor(clrColor); // Change the background color of the 'Note' bitmap HBITMAP hBmpOldNote = m_wndStaticNote.GetBitmap(); m_hBmpNote = NULL; m_hBmpNote = ReplaceColor(hBmpOldNote, GetNoteColor(), clrColor); // Change the background color of the 'Close' button m_wndBtnClose.SetColor(clrColor); // Change the background color of the 'Pin' bitmaps CImageList imageList = m_wndBtnPin.GetImageList(); m_hBmpPinopen = ReplaceColor(m_hBmpPinopen, GetNoteColor(), clrColor); m_hBmpPinclose = ReplaceColor(m_hBmpPinclose, GetNoteColor(), clrColor); m_hBmpPinhoover = ReplaceColor(m_hBmpPinhoover, GetNoteColor(), clrColor); // Replace the images in the image list imageList.Replace(0, m_hBmpPinopen, 0); imageList.Replace(1, m_hBmpPinclose, 0); imageList.Replace(2, m_hBmpPinhoover, 0); // Draw the new 'Note' bitmap in the static control m_wndStaticNote.SetBitmap(m_hBmpNote); // Delete the old bitmaps DeleteObject(hBmpOldNote); // Save the color SetNoteColor(clrColor); }
BOOL CDlgObjectManager::OnInitDialog() { CDialog::OnInitDialog(); m_tree.ModifyStyle( TVS_CHECKBOXES, 0 ); m_tree.ModifyStyle( 0, TVS_CHECKBOXES ); m_tree.DeleteAllItems(); CImageList* pImLst; pImLst = m_tree.GetImageList(TVSIL_STATE); pImLst->Replace(0, AfxGetApp()->LoadIcon(IDI_ICON_IMG_NONE) ); pImLst->Replace(1, AfxGetApp()->LoadIcon(IDI_ICON_IMG_UNCHECKED) ); pImLst->Replace(2, AfxGetApp()->LoadIcon(IDI_ICON_IMG_CHECKED) ); if( m_pDoc == NULL) return 0; m_pObPtrArray = m_pDoc->GetObjArray(); HTREEITEM hBod; // bodies HTREEITEM hMap; // map bitmaps HTREEITEM hPrf; // profile bitmaps HTREEITEM hGrd; // grids HTREEITEM hGul; // guidelines HTREEITEM hWel; // wells HTREEITEM hD3d; // 3D data HTREEITEM hIt; CMyObject* pObj; hBod = m_tree.InsertItem("Model Bodies"); hMap = m_tree.InsertItem("Map pictures"); hPrf = m_tree.InsertItem("Profile profile pictures"); hGrd = m_tree.InsertItem("Grids"); hGul = m_tree.InsertItem("Giudelines"); hWel = m_tree.InsertItem("Wells"); hD3d = m_tree.InsertItem("3D Data"); for( int i=0; i<m_pObPtrArray->GetSize(); i++) { pObj = m_pObPtrArray->GetAt(i); if( pObj->IsKindOf( RUNTIME_CLASS( CImgReferenced ) ) ) { CImgReferenced* pIm = (CImgReferenced*) pObj; switch( pIm->m_nType ) { case IMG_MAP: hIt = m_tree.InsertItem(pObj->GetIdName(), hMap); pIm->m_hTreeItem = hIt; if( pIm->IsVisible() ) m_tree.SetCheck(hIt, TRUE); break; case IMG_PRF: hIt = m_tree.InsertItem(pObj->GetIdName(), hPrf); pIm->m_hTreeItem = hIt; m_tree.SetCheck(hIt, pIm->IsVisible() ); break; } } if( pObj->IsKindOf( RUNTIME_CLASS(CGridObj) ) ) { CGridObj* pOb = (CGridObj*) pObj; switch( pOb->GetType() ) { case CGridObj::leadingHorizon: hIt = m_tree.InsertItem(pObj->GetIdName(), hGrd); if( pOb->IsVisible() ) m_tree.SetCheck(hIt, TRUE); break; } } if( pObj->IsKindOf( RUNTIME_CLASS(CGuideMark) ) ) { CGuideMark* pOb = (CGuideMark*) pObj; hIt = m_tree.InsertItem(pObj->GetIdName(), hGul); if( pOb->IsVisible() ) m_tree.SetCheck(hIt, TRUE); } if( pObj->IsKindOf( RUNTIME_CLASS(CWell) ) ) { CWell* pOb = (CWell*) pObj; hIt = m_tree.InsertItem(pObj->GetIdName(), hWel); if( pOb->IsVisible() ) m_tree.SetCheck(hIt, TRUE); } if( pObj->IsKindOf( RUNTIME_CLASS(CData3D) ) ) { CData3D* pOb = (CData3D*) pObj; hIt = m_tree.InsertItem(pObj->GetIdName(), hD3d); if( pOb->IsVisible() ) m_tree.SetCheck(hIt, TRUE); } } BodyPtrArray* pBds; pBds = m_pDoc->GetModel()->GetBodies(); if( pBds != NULL ) { for(int i=0; i<pBds->GetSize(); i++) { CBody* pBd = pBds->GetAt(i); hIt = m_tree.InsertItem(pBd->GetStrIdName(), hBod); m_tree.SetCheck(hIt, pBd->IsVisisble()); } } m_tree.Expand(hBod, TVE_EXPAND); m_tree.Expand(hMap, TVE_EXPAND); m_tree.Expand(hPrf, TVE_EXPAND); m_tree.Expand(hGrd, TVE_EXPAND); m_tree.Expand(hGul, TVE_EXPAND); m_tree.Expand(hWel, TVE_EXPAND); m_tree.Expand(hD3d, TVE_EXPAND); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }