void btnRemove_OnClick(CCtrlFilterListView *) { int idx = m_lstNotes.GetCurSel(); if (idx != LB_ERR) { if (CNoteItem *pItem = (CNoteItem *)m_lstNotes.GetItemData(idx)) { m_lstNotes.DeleteString(idx); m_proto->m_notes.remove(pItem); } RebuildTree(); } EnableControls(); }
void btnEdit_OnClick(CCtrlFilterListView *) { int idx = m_lstNotes.GetCurSel(); if (idx != LB_ERR) { if (CNoteItem *pItem = (CNoteItem *)m_lstNotes.GetItemData(idx)) { CJabberDlgNoteItem dlg(this, pItem); if (dlg.DoModal()) { m_proto->m_notes.Modify(); RebuildTree(); } } } EnableControls(); }
void ListItems(const TCHAR *tag) { m_lstNotes.ResetContent(); for (int i = 0; i < m_proto->m_notes.getCount(); ++i) if (m_proto->m_notes[i].HasTag(tag)) InsertItem(m_proto->m_notes[i]); EnableControls(); }
void CJabberDlgNotes::OnInitDialog() { CSuper::OnInitDialog(); WindowSetIcon( m_hwnd, m_proto, "notes" ); LOGFONT lf, lfTmp; m_hfntNormal = (HFONT)GetStockObject(DEFAULT_GUI_FONT); GetObject(m_hfntNormal, sizeof(lf), &lf); lfTmp = lf; lfTmp.lfWeight = FW_BOLD; m_hfntBold = CreateFontIndirect(&lfTmp); lfTmp = lf; lfTmp.lfHeight *= 0.8; m_hfntSmall = CreateFontIndirect(&lfTmp); m_lstNotes.SetFonts(m_hfntNormal, m_hfntSmall, m_hfntBold); Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "notesWnd_"); }
void InsertItem(CNoteItem &item) { m_lstNotes.AddString((TCHAR *)item.GetTitle(), (LPARAM)&item); EnableControls(); }
void EnableControls() { m_btnSave.Enable(m_proto->m_bJabberOnline && m_proto->m_notes.IsModified()); m_btnEdit.Enable(m_lstNotes.GetCurSel() != LB_ERR); m_btnRemove.Enable(m_lstNotes.GetCurSel() != LB_ERR); }