Print Page | Close Window

Apply msstyle skin

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=5845
Printed Date: 27 April 2024 at 8:12pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Apply msstyle skin
Posted By: aamirzia
Subject: Apply msstyle skin
Date Posted: 20 December 2006 at 2:08am
Hi All,
 
I am trying to apply a MsStyle skin to my sdi application but have not been able to do so.
Also, i have seen the skin framework samples for ITUNES skin and successfully used it but facing problems with MSStyle skinning of application
 
Please note that ITUNES skin is not using any MSStyles files
 
thanx
 
Aamir



Replies:
Posted By: Oleg
Date Posted: 20 December 2006 at 3:02am
Hi,
What code you tried?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: aamirzia
Date Posted: 20 December 2006 at 4:30am

i have tried the same code given in the Sample Skin FrameWork sample and in the line where we give the path and name of INI file, i have given the path and name of MSSTYLES file. like

XTPSkinManager()->LoadSkin(m_strStylesPath + _T("mySkin"), _T("mySkin.msstyles"))

Following is the code of my MainFrame.cpp, i have applied skin in the constructor.
 

// MainFrm.cpp : implementation of the CMainFrame class

//

//#pragma comment(lib, "log4cppD.lib")

#include "stdafx.h"

#include "Insight.h"

#include "MainFrm.h"

#ifdef _DEBUG

#define new DEBUG_NEW

#endif

// CMainFrame

bool CMainFrame::m_bMinimized = false;

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)

ON_WM_CREATE()

ON_WM_CLOSE()

//}}AFX_MSG_MAP

ON_COMMAND(XTP_ID_CUSTOMIZE, OnCustomize)

ON_COMMAND(IDR_RESTORE, OnRestore)

ON_WM_SIZE()

END_MESSAGE_MAP()

static UINT uHideCmds[] =

{

ID_FILE_PRINT,

ID_FILE_PRINT_PREVIEW,

};

static UINT indicators[] =

{

ID_SEPARATOR, // status line indicator

ID_INDICATOR_CAPS,

ID_INDICATOR_NUM,

ID_INDICATOR_SCRL,

};

 

UINT balloonIcon[] =

{

NIIF_ERROR, // Error icon.

NIIF_INFO, // Information icon.

NIIF_NONE, // No icon.

NIIF_WARNING // Warning icon.

};

// CMainFrame construction/destruction

CMainFrame::CMainFrame()

{

// TODO: add member initialization code here

TCHAR szStylesPath[_MAX_PATH];

VERIFY(::GetModuleFileName(

AfxGetApp()->m_hInstance, szStylesPath, _MAX_PATH));

CString csStylesPath(szStylesPath);

int nIndex = csStylesPath.ReverseFind(_T('\\'));

if (nIndex > 0) {

csStylesPath = csStylesPath.Left(nIndex);

}

else {

csStylesPath.Empty();

}

m_strStylesPath = csStylesPath + _T("\\Styles\\");

 

XTPSkinManager()->SetApplyOptions(xtpSkinApplyFrame | xtpSkinApplyColors | xtpSkinApplyMetrics);

LoadSkin(1);

}

CMainFrame::~CMainFrame()

{

}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)

{

if (CFrameWnd::OnCreate(lpCreateStruct) == -1)

return -1;

if (!m_TrayIcon.Create(

_T("INSIGHT Agent Cockpit!"), // Toolktip text

this, // Parent window

IDR_InsightTYPE, // Icon resource ID

IDR_POPUP_TRAY, // Resource ID of popup menu

IDR_RESTORE, // Default menu item for popup menu

false)) // True if default menu item is located by position

{

TRACE0("Failed to create tray icon\n");

return -1;

}else{

m_TrayIcon.ShowBalloonTip("Hello World","Insight",balloonIcon[1],10);

}

 

PostMessage(WM_SYSCOLORCHANGE);

return 0;

}

 

 

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)

{

if( !CFrameWnd::PreCreateWindow(cs) )

return FALSE;

// TODO: Modify the Window class or styles here by modifying

// the CREATESTRUCT cs

cs.style = FWS_ADDTOTITLE |WS_SYSMENU | WS_CAPTION;

/*cs.x = 770;

cs.y=50;

cs.cx=250;

cs.cy=650;*/

cs.x = 0;

cs.y=0;

cs.cx=250;

cs.cy=650;

return TRUE;

}

 

// CMainFrame diagnostics

#ifdef _DEBUG

void CMainFrame::AssertValid() const

{

CFrameWnd::AssertValid();

}

void CMainFrame::Dump(CDumpContext& dc) const

{

CFrameWnd::Dump(dc);

}

#endif //_DEBUG

 

// CMainFrame message handlers

void CMainFrame::OnClose()

{

CXTPFrameWnd::OnClose();

//OnRestore();

}

 

void CMainFrame::OnCustomize()

{

// Get a pointer to the command bars object.

CXTPCommandBars* pCommandBars = GetCommandBars();

if(pCommandBars != NULL)

{

// Instanciate the customize dialog object.

CXTPCustomizeSheet dlg(pCommandBars);

// Add the keyboard page to the customize dialog.

CXTPCustomizeKeyboardPage pageKeyboard(&dlg);

dlg.AddPage(&pageKeyboard);

pageKeyboard.AddCategories(IDR_MAINFRAME);

// Add the options page to the customize dialog.

CXTPCustomizeOptionsPage pageOptions(&dlg);

dlg.AddPage(&pageOptions);

// Add the commands page to the customize dialog.

CXTPCustomizeCommandsPage* pCommands = dlg.GetCommandsPage();

pCommands->AddCategories(IDR_MAINFRAME);

// Use the command bar manager to initialize the

// customize dialog.

pCommands->InsertAllCommandsCategory();

pCommands->InsertBuiltInMenus(IDR_MAINFRAME);

pCommands->InsertNewMenuCategory();

// Dispaly the dialog.

dlg.DoModal();

}

}

 

void CMainFrame::OnSkinChanged()

{

XTPPaintManager()->RefreshMetrics();

OnSysColorChange();

RedrawWindow(0, 0, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ALLCHILDREN);

GetCommandBars()->GetPaintManager()->RefreshMetrics();

GetCommandBars()->RedrawCommandBars();

}

void CMainFrame::LoadSkin(int nSkin)

{

switch (nSkin)

{

case 1:

XTPSkinManager()->LoadSkin(m_strStylesPath + _T("mySkin"), _T("mySkin.msstyles"));

break;

case 0:

XTPSkinManager()->LoadSkin(m_strStylesPath + _T("Le5"), _T("NormalBlue.INI"));

break;

default:

XTPSkinManager()->LoadSkin(_T(""), _T(""));

}

if (m_hWnd) OnSkinChanged();

}

void CMainFrame::SetTheme(int nTheme)

{

switch (nTheme)

{

case 0:

CXTPPaintManager::SetTheme(xtpThemeOffice2003);

break;

case 1:

CXTPPaintManager::SetTheme(xtpThemeNativeWinXP);

break;

}

XTPPaintManager()->GetIconsInfo()->bUseFadedIcons = FALSE;

GetCommandBars()->RedrawCommandBars();

RedrawWindow( NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN);

}

 

void CMainFrame::OnRestore()

{

CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();

ASSERT_VALID(pMainFrame);

m_bMinimized = !m_bMinimized;

if (m_bMinimized)

{

pMainFrame->m_TrayIcon.MinimizeToTray(pMainFrame);

m_TrayIcon.ShowBalloonTip("Hello World","Insight",balloonIcon[1],10);

}

else

{

pMainFrame->m_TrayIcon.MaximizeFromTray(pMainFrame);

}

}

void CMainFrame::OnExit()

{

CFrameWnd::OnClose();

}

void CMainFrame::OnSize(UINT nType, int cx, int cy)

{

CXTPFrameWnd::OnSize(nType, cx, cy);

// TODO: Add your message handler code here

}



Posted By: aamirzia
Date Posted: 21 December 2006 at 2:47am

Hi Oleg,

Can you kindly answer my query, i have posted the code u have asked for.

thanx



Posted By: Oleg
Date Posted: 21 December 2006 at 3:52am
problem in line
XTPSkinManager()->LoadSkin(m_strStylesPath + _T("mySkin"), _T("mySkin.msstyles"));
 
first parameter must be style path, second ini name.
 
Try run SkinMdiSamples and put this skin to Styles folder. Sample will automatically find skin and show available skins.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: aamirzia
Date Posted: 21 December 2006 at 8:36am
Hi Oleg,
 
Thanx for ur prompt reply, i followed your directions and tried the SkinMDI Sample and replaced the CTabCtrl with CXTPTabControl and to my surprise CTabCtrl was getting skinned but CXTPTabControl was not getting skinned, y is it so ??


Posted By: Oleg
Date Posted: 22 December 2006 at 1:14am

Hi,

WinXP color set must be set for CXTPTabControl.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: aamirzia
Date Posted: 22 December 2006 at 1:36am
Hi Oleg,
 
What do you mean by "WinXp color must be set for CXTPTabControl" ?
Can you please elaborate, what is this and will it skin the CXTPTabControl?
 
Also, let me know that how can i skin the CXTPTaskPanel as well because its not getting skinned as well
 
thank you
 


Posted By: aamirzia
Date Posted: 22 December 2006 at 1:43am

Sorry , got ur point, u meant to set

tabControl.SetColor(xtpTabColorWinXP);

its fine but still does not enables image change as mouse hovers above the tab.
 
Also, can you please tell how can i skin the CXTPTaskPanel as well
 
thank you


Posted By: aamirzia
Date Posted: 22 December 2006 at 2:20am
Oleg, i have noticed that if i set my tab position to the left it does not show the mouse hover affect of Tabs but if the tabs are positioned on Top the mouse hover affect is working fine, is this a bug or am i missing something ?
Also, please also tell me how to skin CXTPTaskPanel as well
thanx alot Oleg
God Bless u :)


Posted By: Oleg
Date Posted: 22 December 2006 at 3:41am
I opened TabManager sample,
added
 XTPSkinManager()->LoadSkin("c:\\Source\\ToolkitRoot\\ToolkitPro\\Source\\SkinFramework\\Styles\\Vista.cjstyles");
to skin it,
 
and don't see problem with Left tab position. HotTracking option must be enabled.
 
Try this sample.
 
For TaskPanel check available styles.Think xtpTaskPanelThemeNativeWinXP will look quite good.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: aamirzia
Date Posted: 22 December 2006 at 5:21am
Hi Oleg,
I have tried the tab manager sample as you told and skinned it to ITunes skin and set it to WinXp color set but to my surprise when ever i selected the position of TAB to left, the hot tracking was no more visible and on changing it back to top it was working fine. In my code the tab control's hot tracking was set to TRUE. Is there any way to rotate the Tab's text 180 degrees when the tab's are positioned left?
 
 
Also, setting the panel theme like
searchPanel.SetTheme(xtpTaskPanelThemeNativeWinXP );
but it doesnt changes the collapse/expand buttons to the buttons shown in the skin preview in Style Builder and keeps on showing the traditional button with double arrow heads on task panel. Actually, i want to change the task panel expand/collapse buttons images.
 
thankyou


Posted By: Oleg
Date Posted: 22 December 2006 at 8:55am
Actually it was problem in oru code. :(  When Tab in left/bottom/right  used TIS_FOCSUED instead TIS_HOT. In most skins focused state  looks same as Hot so we didn't notice it.
 
Thank you. You can fix CXTPTabPaintManager::CColorSetWinXP::DrawRotatedButton method and rebuild library.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: aamirzia
Date Posted: 22 December 2006 at 11:05am

Hi Oleg,

Is there any way to make  TabCtrl use TIS_HOT when it is positioned left/bottom or right ? If yes, then tell me precisely that where should i change in library source ?
 
Also, you have not told me the second part of my last post i.e. how can i skin the Task Panel's expand/collapse button. Please see my last post for detail.
 
thankyou


Posted By: aamirzia
Date Posted: 22 December 2006 at 11:46am

Oleg,

i have successfully fixed the problem to make TabCtrl use TIS_HOT when it is positioned left/bottom or right but not been able to rotate the Tab's text 180 degrees when the tab's are positioned left? Can you specify the code change?
 
 
Also, setting the panel theme like
searchPanel.SetTheme(xtpTaskPanelThemeNativeWinXP );
but it doesnt changes the collapse/expand buttons to the buttons shown in the skin preview in Style Builder and keeps on showing the traditional button with double arrow heads on task panel. Actually, i want to change the task panel expand/collapse buttons images.
 
thankyou


Posted By: Oleg
Date Posted: 22 December 2006 at 3:05pm
Hi,
GDI can draw text only from top to bottom.
 
Unfortunatelly TaskPanel don't use this images and generate them using caption color.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net