|
// CSSSandboxDlg.h : header file
//
#pragma once
#include "afxcmn.h"
#include "afxwin.h"
class CControlSplitter;
class SimpleBrowser;
class MyRichEditCtrl;
// CSSSandboxDlg dialog
class CSSSandboxDlg : public CDialogEx
{
// Construction
public:
CSSSandboxDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CSSSandboxDlg();
// Dialog Data
enum { IDD = IDD_CSSSANDBOX_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
double vertSplitterRatio; // left edge of splitter (in client coords) / client width, tracks splitter pos when window is resized
int splitterPadding; // dist between edge of adjacent control and splitter, maintained after resize
int splitterWidth; // width of the splitter, maintained after resize
CSize clientMargin; // margin outside the controls and the edge of the client area
CRect initialWndRect; // the size of the dialog initially (based on size in dialog resource) used for minimum allowable size
int editorBottomOffset; // offset from bottom of editor window to bottom of client area, used during resize
// the anchors store the relative position between the buttons and the bottom left corner of the window rect in screen coords.
// they allow maintaining the button positions (relative to the bottom left corner of the window) during resizing
CSize anchorNewBtn;
CSize anchorLoadBtn;
CSize anchorSaveBtn;
CSize anchorSaveAsBtn;
CSize anchorRefreshBtn;
CSize anchorAutoRefreshCheck;
CSize anchorColorsBtn;
CSize anchorFontBtn;
MyRichEditCtrl& editor; // code editor window
CControlSplitter& vertSplitter; // vertical splitter control
SimpleBrowser& browser; // browser window used to render the code
CString curFilePath; // path to the file currently being edited or empty if no file (file hasn't been saved yet)
// get splitter vars (width, ratio, padding) based on current control positions
void UpdateSplitterVars();
// TRUE if mods have been made to the currently open file
BOOL isModified;
// used to set the modified flag
void SetModified(BOOL isModified);
// formats titlebar text based on current open file and whether or not its been modified. also includes product name and version.
void UpdateTitlebar();
// if current file modified, prompt user to save first - call this before doing anything destructive to the current doc
void DoSaveCheck();
void SaveOptions(); // save options to the registry
void LoadOptions(); // load options from the registry
// load the specified file into the editor
BOOL LoadFile(LPCTSTR filePath, CString& errDesc);
// get current editor settings
void GetEditorSettings(CString& fontName, int& pointSize, COLORREF& bgColor, COLORREF& fgColor);
// set editor settings to whats specified
void SetEditorSettings(LPCTSTR fontName, int pointSize, COLORREF bgColor, COLORREF fgColor);
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
CButton NewBtn;
CButton LoadBtn;
CButton SaveBtn;
CButton SaveAsBtn;
afx_msg void OnBnClickedNewButton();
afx_msg void OnBnClickedLoadButton();
afx_msg void OnBnClickedSaveButton();
afx_msg void OnBnClickedSaveasButton();
CButton RefreshBtn;
afx_msg void OnBnClickedRefreshButton();
afx_msg void OnEnChangeEditor();
virtual BOOL PreTranslateMessage(MSG* pMsg);
afx_msg void OnClose();
afx_msg void OnDestroy();
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
afx_msg LRESULT OnAfterInit(WPARAM wParam, LPARAM lParam);
CButton AutoRefreshCheck;
afx_msg void OnBnClickedAutoRefresh();
afx_msg void OnBnClickedFontButton();
CButton FontBtn;
CButton ColorsBtn;
afx_msg void OnBnClickedColorsButton();
};
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.