// CustomizePageGeneral.cpp
//
// (c)1998-2025 Codejock Software, All Rights Reserved.
//
// THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
// RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
// CONSENT OF CODEJOCK SOFTWARE.
//
// THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
// IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
// YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
// SINGLE COMPUTER.
//
// CONTACT INFORMATION:
// support@codejock.com
// http://www.codejock.com
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "RibbonSample.h"
#include "CustomizePageGeneral.h"
#include "MainFrm.h"
#ifdef _DEBUG
# define new DEBUG_NEW
# undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCustomizePageGeneral property page
IMPLEMENT_DYNCREATE(CCustomizePageGeneral, CXTPPropertyPage)
CCustomizePageGeneral::CCustomizePageGeneral()
: CXTPPropertyPage(CCustomizePageGeneral::IDD)
{
//{{AFX_DATA_INIT(CCustomizePageGeneral)
m_bShowKeyboardTips = FALSE;
m_bShowMiniToolbar = FALSE;
//}}AFX_DATA_INIT
}
CCustomizePageGeneral::~CCustomizePageGeneral()
{
}
void CCustomizePageGeneral::DoDataExchange(CDataExchange* pDX)
{
CXTPPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCustomizePageGeneral)
DDX_Check(pDX, IDC_CHECK_SHOWEYBOARDTIPS, m_bShowKeyboardTips);
DDX_Check(pDX, IDC_CHECK_SHOWMINITOOLBAR, m_bShowMiniToolbar);
DDX_Control(pDX, IDC_CHECK_SHOWEYBOARDTIPS, m_btnShowKeyboardTips);
DDX_Control(pDX, IDC_CHECK_SHOWMINITOOLBAR, m_btnShowMiniToolbar);
DDX_Control(pDX, IDC_CAPTION_1, m_wndCaption1);
DDX_Control(pDX, IDC_TITLE_ICON, m_wndTitleIcon);
DDX_Control(pDX, IDC_TITLE, m_wndTitle);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCustomizePageGeneral, CXTPPropertyPage)
//{{AFX_MSG_MAP(CCustomizePageGeneral)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCustomizePageGeneral message handlers
BOOL CCustomizePageGeneral::OnInitDialog()
{
CXTPPropertyPage::OnInitDialog();
ModifyStyle(0, WS_CLIPCHILDREN | WS_VSCROLL);
SetResize(IDC_CAPTION_1, XTP_ANCHOR_TOPLEFT, XTP_ANCHOR_TOPRIGHT);
COLORREF clrText = GetXtremeColor(COLOR_WINDOWTEXT);
COLORREF clrBack = 0xf0f2f5;
if (CXTPPropertyPage::m_pSheet)
{
if (CXTPPropertyPage::m_pSheet->GetTheme() != xtpControlThemeDefault)
{
clrText = XTPIniColor(_T("Controls.Edit"), _T("Text"),
GetXtremeColor(COLOR_WINDOWTEXT));
clrBack = XTPIniColor(_T("CommandBars.Toolbar"), _T("Back"), 0xf0f2f5);
}
}
CString foregroundProp, backgroundProp;
foregroundProp.Format(_T("Foreground = '#%02X%02X%02X' "), GetRValue(clrText),
GetGValue(clrText), GetBValue(clrText));
backgroundProp.Format(_T("Background = '#%02X%02X%02X' "), GetRValue(clrBack),
GetGValue(clrBack), GetBValue(clrBack));
CString icon, xaml;
icon += _T("");
icon += _T("");
icon += _T("");
icon += _T("");
icon += _T("");
m_wndTitleIcon.SetMarkupTextEx(icon);
m_wndTitleIcon.SetIgnoreRTL(TRUE);
xaml += _T("");
xaml += _T("%s");
xaml += _T("");
m_wndTitle.SetMarkupTextEx(xaml);
CString xamlCaption;
xamlCaption += _T("");
xamlCaption += _T("%s");
xamlCaption += _T("");
xamlCaption += _T("");
m_wndCaption1.SetMarkupTextEx(xamlCaption);
CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
if (pMainFrame)
{
m_bShowMiniToolbar = pMainFrame->m_bShowMiniToolbar;
m_bShowKeyboardTips =
pMainFrame->GetCommandBars()->GetCommandBarsOptions()->bShowKeyboardTips;
}
UpdateData(FALSE);
#ifdef _XTP_INCLUDE_CONTROLS
if (CXTPPropertyPage::m_pSheet)
{
XTPControlTheme controlTheme = CXTPPropertyPage::m_pSheet->GetTheme();
m_btnShowKeyboardTips.SetTheme(controlTheme);
m_btnShowMiniToolbar.SetTheme(controlTheme);
}
#endif
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCustomizePageGeneral::OnOK()
{
UpdateData();
CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
if (pMainFrame)
{
pMainFrame->m_bShowMiniToolbar = m_bShowMiniToolbar;
pMainFrame->GetCommandBars()->GetCommandBarsOptions()->bShowKeyboardTips =
m_bShowKeyboardTips;
}
CXTPPropertyPage::OnOK();
}