Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Manual skinning of the component Collapse All
Subject Author Date
Ivan Surzhenko Oct 17, 2007 - 9:07 AM

What I must do for manual skinning of component? For example, I like create button1(CExtButton or child) with one skin and button2(CExtButton or child) with other. IN my mean I must create child from CExtButton and override method, what responsable for definition of SkinItem name. What I must override?

Thanks.

Ivan Surzhenko Nov 9, 2007 - 10:35 AM

Step 1 - Make images
Make new images for additional skinning(as \Button\ControlPushButton directory in Aqua skin). And name it for example \Button\MyControlPushButton

Step 2 - Make changes in XML file
Search Skin name with "Simple" at SkinItem Button. Find sub SkinItem PushButton. Copy&Paste. Change name as template PushButton_<your_name> (for example: PushButton_My). Change path in all sub items to your images.

Thats all!

You can create new button with caption "_My" and it will be skinned with your SkinItems.

P.S.: For example I provide my XML-code for manual skinning button:

......................
<Glyph
Name="Disabled"
To="3" Bo="2" Ro="-2"
Image="Aqua\Button\FrameNcButton\Inactive\SC_CLOSE-disabled.png"
/>
</SkinItem>
</SkinItem>
</SkinItem>
<SkinItem Name="Simple">
<SkinItem Name="PushButton_All">
<Glyph
Name="PushButton"
DrawMethod="Hollow"
Ctp="2" Clp="12" Cbp="1" Crp="12"
/>
<SkinItem Name="Control">
<SkinItem Name="Normal">
<Glyph
Name="PushButton"
Tp="12" Lp="14" Bp="11" Rp="14"
Ctp="2" Clp="12" Cbp="1" Crp="12"
Image="Aqua\Button\ControlPushButtonAll\Normal.png"
/>
</SkinItem>
<SkinItem Name="Disabled">
<Glyph
Name="PushButton"
Tp="12" Lp="14" Bp="11" Rp="14"
Ctp="2" Clp="12" Cbp="1" Crp="12"
Image="Aqua\Button\ControlPushButtonAll\Disabled.png"
/>
</SkinItem>
<SkinItem Name="Hover">
<Glyph
Name="PushButton"
Tp="12" Lp="14" Bp="11" Rp="14"
Ctp="2" Clp="12" Cbp="1" Crp="12"
Image="Aqua\Button\ControlPushButtonAll\Hover.png"
/>
</SkinItem>
<SkinItem Name="Pressed">
<Glyph
Name="PushButton"
Tp="12" Lp="14" Bp="11" Rp="14"
Ctp="2" Clp="12" Cbp="1" Crp="12"
Image="Aqua\Button\ControlPushButtonAll\Pressed.png"
/>
</SkinItem>
<SkinItem Name="Default">
<Glyph
Name="PushButton"
Tp="12" Lp="14" Bp="11" Rp="14"
Ctp="2" Clp="12" Cbp="1" Crp="12"
Image="Aqua\Button\ControlPushButtonAll\Default.png"
/>
</SkinItem>
</SkinItem>
</SkinItem>

<SkinItem Name="PushButton">
<Glyph
Name="PushButton"
DrawMethod="Hollow"
Ctp="2" Clp="12" Cbp="1" Crp="12"
/>
<SkinItem Name="Control"
......................

T P Nov 7, 2007 - 3:57 AM

Hi,

I tried this solution and think it is very nice but I get an error when I try to load the skin file. Can you please tell me how I have to modify the XML to get this working? I’m a bit confused about the file structure.

Thanks

Timo

Ivan Surzhenko Oct 26, 2007 - 6:57 AM

So we solve our problem with next edition of CExtSkinPaintManager(v 2.80):

All editions made in
void CExtPaintManagerSkin::PaintPushButton(
    CDC & dc,
    CExtPaintManager::PAINTPUSHBUTTONDATA & _ppbd
    )


Edition 1:

After strings

LPCTSTR strState = _T("Normal");
    if( ! _ppbd.m_bEnabled )
        strState = _T("Disabled");
//    else if( _ppbd.m_bPushed )
    else if( _ppbd.m_bPushed || _ppbd.m_bIndeterminate )
        strState = _T("Pressed");
    else if( _ppbd.m_bHover || _ppbd.m_bDrawFocusRect )
        strState = _T("Hover");
//    else if( _ppbd.m_bIndeterminate )
//        strState = _T("Indeterminate");
    else if( _ppbd.m_bDefaultPushButton )
        strState = _T("Default");


we add

    LPCTSTR style_id;

    if(CString(_ppbd.m_sText).GetAt(0) == ’_’)
    {
        style_id = _ppbd.m_sText;
    }
    else
    {
        style_id = _T("");
    }


Edition 2:

String

pPushButton = &(*pButton)[_T("PushButton")][_T("Control")][strState];

was replaced by

pPushButton = &(*pButton)[CString(_T("PushButton"))+CString(style_id)][_T("Control")][strState];

Edition 3:

String(near line #2130)

dc.DrawText( sBtn, 1, rcTextLocation, nDtMeasureFlags);

was replaced by

if(CString(style_id).GetAt(0) != ’_’)
{
    dc.DrawText(sBtn, -1, rcTextLocation, nDtMeasureFlags);
}



So as result we have powerful skinning of buttons. We can make buttons as control buttons in media players and etc.

With best regards, Ivan Surzhenko, "Software Systems and Applications Limitted"

Technical Support Oct 24, 2007 - 7:06 AM

You can always count on our help.

Ivan Surzhenko Oct 24, 2007 - 3:30 AM

Thanks.

Hmmm... I like create some changes in ProfSkin. If I will need to help about CExtPaintManager then I can expect it from you?

Technical Support Oct 23, 2007 - 3:15 PM

Unfortunately, different per-button skin items are not supported at present. The skinable paint manager simply detects CExtButton objects (and any other objects) by its MFC’s run-time type information and then paints buttons using appropriate skin item located at know tree brunch. We can assume your message as feature request and add some mechanism which will allow each UI item to tell the skinable paint manager its skinable data.

Ivan Surzhenko Oct 23, 2007 - 6:50 AM

I like create GUI with manual skinning of all components. Skin system must based on ProfSkin. In ProfSkin for painting CExtButton used member(SkinItem) in XML with name "Button". But I like include in skin other views of CExtButton.

For example:
In WinAmp any GUI component have itself view. You can customize any component for your mean.

So I like make alternative SkinItem for button.

Technical Support Oct 22, 2007 - 12:25 PM

We are sorry for the delay with this reply. You can use different paint managers for different Prof-UIS controls. Most classes have CExtPmBridge as one of parent classes. So you can override the CExtPmBridge::PmBridge_GetPM() virtual method in your CExtButton-derived class and return a pointer to the paint manager that you would like to use in your button. Of course, you can also re-paint each control or any of its parts manually by overriding its virtual methods. Please provide more details about what you want to achieve (e.g. a screenshot) so we can help you more efficiently.

Ivan Surzhenko Oct 22, 2007 - 10:10 AM

I can receive answer for my question?