Kirix Support Forums

Changing font properties

Please post all general questions, comments, bug reports, and any other wxAUI feedback here.

Changing font properties

Postby Diego on Sun Jan 07, 2007 8:38 pm

Hi all.
First, let me say this framework is very very cool and useful! (I'm using it through wxPython).

I've a question: How can I change the font for the caption in a given pane ? I can't realize how to do it by SetArtProvider.
Thank you in advance !
Diego
Registered User
 
Posts: 5
Joined: Sun Jan 07, 2007 8:31 pm

Postby Ben on Mon Jan 08, 2007 2:57 am

Try

Code: Select all
m_mgr.GetArtProvider()->SetFont(font);


Please let me know if this works for you.

Thanks,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 522
Joined: Mon Dec 19, 2005 6:29 am

Postby Diego on Mon Jan 08, 2007 10:47 am

bwilliams wrote:Try

Code: Select all
m_mgr.GetArtProvider()->SetFont(font);


Please let me know if this works for you.

Thanks,
Ben


Hi, thank You for the answer...
I've tried it, but:

1- In 'SetFont' (and in each other AuiDockArt methods), the first parameter is 'id', which I don't know what it must be... ?

2 - Just to see if it works, I've tried to do this (Python code) :

ap = self.mgr.GetArtProvider()
self.mgr.SetArtProvider(ap)

but sometimes a system error pops up when closing my application, and sometimes the frame doesn't show at all...

Is there a way to clear up my mind ? :roll: Thanks again!
Diego
Registered User
 
Posts: 5
Joined: Sun Jan 07, 2007 8:31 pm

Postby Ben on Mon Jan 08, 2007 12:47 pm

Hi,

Sorry, I missed a parameter:

It should be

Code: Select all
m_mgr.GetArtProvider()->SetFont(wxAUI_DOCKART_CAPTION_FONT, font);


Regarding your other question, I'm not sure if that will work because, when SetArtProvider() is called, the old art provider is destroyed, which in this case is the one you wish to set. So I would expect in this case some spurious behavior.

Best,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 522
Joined: Mon Dec 19, 2005 6:29 am

Postby Diego on Mon Jan 08, 2007 3:44 pm

Thanks a lot ! It works!

(About the 'SetArtProvider' issue: indeed, I suspected that was a 'dead pointer' problem... just a trivial point :) )

Your tool is very great! (It will be AWESOME when you'll integrate the AuiManager and AuiNotebook's behavior to cooperate in a transparent way :wink: )

Regards, Diego.
Diego
Registered User
 
Posts: 5
Joined: Sun Jan 07, 2007 8:31 pm

Re: Changing font properties

Postby tncalucard on Tue Oct 30, 2007 5:45 am

With that command all panes managed by that manager will be modfied, isn't it?
Is there a way to change the font for a single pane, like the pane with the name _("Dif_Font")?
tncalucard
Registered User
 
Posts: 14
Joined: Mon Oct 08, 2007 9:30 am

Re: Changing font properties

Postby Ben on Tue Nov 06, 2007 1:25 am

Yes, there is. You must create an art provider that is custom-tailored to implement pane-specific drawing routines. This might sound involved, but it's really not that bad. Just derive an art provider from the default art provider which looks for a specific pane.

Best,
Ben
Ben Williams
Kirix Support Team
User avatar
Ben
Kirix Support Team
 
Posts: 522
Joined: Mon Dec 19, 2005 6:29 am

Re: Changing font properties

Postby tncalucard on Tue Nov 06, 2007 5:47 am

Could you give me an exemple, because every time I try to change the font, the manager change in all panes.
tncalucard
Registered User
 
Posts: 14
Joined: Mon Oct 08, 2007 9:30 am

Re: Changing font properties

Postby Ben on Tue Nov 06, 2007 8:44 am

Hello,

I'm sorry, right now I don't have time to program this for you. What you need to do is quite straightforward. You need to create a class derived from wxAuiDefaultDockArt (which is in aui). Override the following method:

Code: Select all
void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window),
                                   const wxString& text,
                                   const wxRect& rect,
                                   wxAuiPaneInfo& pane)


Next you need to look for the pane you want to have the custom font. If the pane matches, use your drawing code, otherwise call the base class version of DrawCaption.

I hope this helps, and wish you luck.

Ben
Ben Williams
Kirix Support Team
User avatar
Ben
Kirix Support Team
 
Posts: 522
Joined: Mon Dec 19, 2005 6:29 am

Return to wxAUI Questions, Thoughts & Feedback