/* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. */ 

#pragma once
#include "afxcmn.h"
#include "afxwin.h"

#define ITEMNUM		     4 // The number of tab item.
#define PATIENT_ITEMNUM	     5 // The number of attributes under patient.
#define STUDY_ITEMNUM        5 // The number of attributes under study.
#define ACQUISITION_ITEMNUM  5 // The number of attributes under acqusition.

// DisplayAttDlg dialog

class DisplayAttDlg : public CDialog
{
	DECLARE_DYNAMIC(DisplayAttDlg)

public:
        // Constructor of the dialog to display attributes and image of the 
        // given DICOM. If the boolean variable, edit, is true, those 
        // attributes would be updated in the dialog as well as bdb. 
	DisplayAttDlg(DICOM_IMAGE *dicom, BOOL edit, DICOM_DBS *dm_dbs, CWnd* pParent = NULL);  
        // Constructor of the dialog to display attributes and image of 
        // DICOM retrieved by its id. If the boolean variable edit is true,
        // those attributes could be updated. 
	DisplayAttDlg(int id, BOOL edit, DICOM_DBS *dm_dbs, CWnd* pParent =NULL);
	virtual ~DisplayAttDlg();
	BOOL OnInitDialog();

// Dialog Data
	enum { IDD = IDD_DISPLAY_DICOM_ATTRIBUTE };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);  // DDX/DDV support

	DECLARE_MESSAGE_MAP()
private:
	DICOM_DBS *dbs;
	DICOM_IMAGE m_dicom;	// The DICOM_IMAGE being displayed.
	CString m_tabItemName[ITEMNUM];
				// The name of all tabs.
	int m_groupNum[ITEMNUM - 1];
				// Number of attributes in each tab.
	int m_tab;		// Tab being displayed.
	int m_selIndex;		// Index of selected attribute under
				// the tab.
	int m_selAttIndex;	// Index of selected attribute in 
				// all attributes.
	int *m_groupIndex[ITEMNUM - 1];
				// All attributes being displayed.
	BOOL m_edit;		// Whether the dialog is editable.
public:
	CListCtrl pCtrlAtt;	// List control for all attributes.
	CTabCtrl pTabCtrl;	// Tab control to display all tabs.
	CEdit pValueEdit;	// Edit box to display attribute value.
	CButton pUpdateButton;	// Update button.
	
	// Click on tabs to display different groups of attributes.
	afx_msg void OnTcnSelchangeAttributeGroupTab(NMHDR *pNMHDR, 
            LRESULT *pResult);
   void DisplayAttDlg::init(DICOM_IMAGE *dicom, BOOL edit, DICOM_DBS *dm_dbs);         
        // Double click on item in the list control. If the DICOM is 
	// editable, the value of the selected attribute is displayed 
	// in the edit box.
	afx_msg void OnNMDblclkAttributeList(NMHDR *pNMHDR, 
	    LRESULT *pResult);
	    
	// Click update button to update selected attribute with the 
	// new value in edit box.
	afx_msg void OnBnClickedUpdateButton();
};
