[dad864]: DialogLink.cpp  Maximize  Restore  History

Download this file

148 lines (125 with data), 2.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// DialogLink.cpp : implementation file
//
#include "stdafx.h"
#include "chitem.h"
#include "DialogLink.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialogLink dialog
CDialogLink::CDialogLink(CWnd* pParent /*=NULL*/)
: CDialog(CDialogLink::IDD, pParent)
{
//{{AFX_DATA_INIT(CDialogLink)
m_dialogres = _T("");
m_state = 0;
m_internal = FALSE;
m_leafnode = FALSE;
//}}AFX_DATA_INIT
}
void CDialogLink::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialogLink)
DDX_Control(pDX, IDC_DIALOG, m_dialogres_control);
DDX_Text(pDX, IDC_DIALOG, m_dialogres);
DDV_MaxChars(pDX, m_dialogres, 8);
DDX_Text(pDX, IDC_STATE, m_state);
DDX_Check(pDX, IDC_INTERNAL, m_internal);
DDX_Check(pDX, IDC_REMOVE, m_leafnode);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialogLink, CDialog)
//{{AFX_MSG_MAP(CDialogLink)
ON_BN_CLICKED(IDC_INTERNAL, OnInternal)
ON_EN_KILLFOCUS(IDC_DIALOG, OnKillfocusDialog)
ON_EN_KILLFOCUS(IDC_STATE, OnKillfocusState)
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
ON_BN_CLICKED(IDC_REMOVE, OnRemove)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialogLink message handlers
void CDialogLink::OnInternal()
{
if(m_internal) //was internal
{
m_dialogres="";
}
else m_dialogres=SELF_REFERENCE;
RefreshDialog();
UpdateData(UD_DISPLAY);
}
void CDialogLink::OnRemove()
{
if(!m_leafnode) //was normal node
{
m_internal=TRUE;
m_dialogres="";
m_state=0;
}
else
{
m_internal=TRUE;
m_dialogres=SELF_REFERENCE;
}
m_leafnode=!m_leafnode;
RefreshDialog();
UpdateData(UD_DISPLAY);
}
void CDialogLink::OnKillfocusDialog()
{
UpdateData(UD_RETRIEVE);
if(m_dialogres==itemname)
{
m_dialogres=SELF_REFERENCE;
}
RefreshDialog();
UpdateData(UD_DISPLAY);
}
void CDialogLink::OnKillfocusState()
{
UpdateData(UD_RETRIEVE);
UpdateData(UD_DISPLAY);
}
void CDialogLink::OnOK()
{
UpdateData(UD_RETRIEVE);
CDialog::OnOK();
}
static int dialogboxids[]={IDC_DIALOG, IDC_STATE,0};
void CDialogLink::RefreshDialog()
{
CWnd *cw;
int i;
m_internal=(m_dialogres==SELF_REFERENCE);
for(i=0;dialogboxids[i];i++)
{
cw=GetDlgItem(dialogboxids[i]);
if(cw) cw->EnableWindow(!m_leafnode);
}
m_dialogres_control.EnableWindow(!m_internal && !m_leafnode);
}
BOOL CDialogLink::OnInitDialog()
{
CDialog::OnInitDialog();
RefreshDialog();
UpdateData(UD_DISPLAY);
return TRUE;
}
void CDialogLink::OnBrowse()
{
int res;
pickerdlg.m_restype=REF_DLG;
pickerdlg.m_picked=m_dialogres;
res=pickerdlg.DoModal();
if(res==IDOK)
{
m_dialogres=pickerdlg.m_picked;
}
RefreshDialog();
UpdateData(UD_DISPLAY);
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks