Click here to Skip to main content
15,897,273 members
Articles / Desktop Programming / MFC

A Java Language IDE

Rate me:
Please Sign up or sign in to vote.
4.33/5 (26 votes)
13 May 2004CPOL3 min read 80.8K   3.4K   41  
This is a partially implemented IDE for the Java platform.
// FileOpenDlgEx.cpp : implementation file
//

#include "stdafx.h"
#include "VisualJava.h"
#include "FileOpenDlgEx.h"
#include <dlgs.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CFileOpenDlgEx

IMPLEMENT_DYNAMIC(CFileOpenDlgEx, CFileDialog)

CFileOpenDlgEx::CFileOpenDlgEx(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
		DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
		CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
    m_ofn.Flags |= OFN_EXPLORER|OFN_ENABLETEMPLATE;
    m_ofn.lpTemplateName = MAKEINTRESOURCE (CFileOpenDlgEx::IDD);


	m_szBigBuffer[0]='\0';
	m_ofn.lpstrFile = m_szBigBuffer;

	if (dwFlags & OFN_ALLOWMULTISELECT)
	{
	    // MFC only provides a 260 character buffer for lpstrFile
		// This is not sufficient when you may be expecting a large number of files.
		m_ofn.nMaxFile  = sizeof(m_szBigBuffer);
		if (lpszFileName != NULL)
			lstrcpyn(m_szBigBuffer, lpszFileName, sizeof(m_szBigBuffer));
	}
	else
	m_ofn.nMaxFile = _MAX_PATH;
}


BEGIN_MESSAGE_MAP(CFileOpenDlgEx, CFileDialog)
	//{{AFX_MSG_MAP(CFileOpenDlgEx)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


void CFileOpenDlgEx::DoDataExchange(CDataExchange* pDX)
{
	CFileDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAppType)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	DDX_Text(pDX,IDC_COMBO_FORMAT, m_szpFormat);
	//}}AFX_DATA_MAP
}

BOOL CFileOpenDlgEx::OnInitDialog() 
{
	CFileDialog::OnInitDialog();
	
	if(m_ofn.Flags & OFN_HIDEREADONLY)
	{
	  GetDlgItem(IDC_COMBO_FORMAT)->ShowWindow(SW_HIDE);
	  GetDlgItem(IDC_STATIC_OPENAS)->ShowWindow(SW_HIDE);

	  GetDlgItem(IDC_STATIC_FOLDER)->ShowWindow(SW_SHOW);
	  GetDlgItem(IDC_STATIC_FOLDER)->SetWindowText(m_folder);
	}
	else
	{
	  CComboBox* wndCombo = (CComboBox*)GetDlgItem(IDC_COMBO_FORMAT);
	  wndCombo->AddString("Auto");
	  wndCombo->AddString("Text");
	  wndCombo->AddString("Binary");
	  wndCombo->AddString("Resource");
	  wndCombo->SetCurSel(0);
	}


	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CFileOpenDlgEx::HideReadOnly(CString szpMsg)
{
	m_folder = szpMsg;
    m_ofn.Flags |= OFN_HIDEREADONLY; 
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
biography? I am not that old yet.

Comments and Discussions