Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 81703 Details for
Bug 125499
wxaui - new ebuild
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Adds modern looks to wxaui
modern.patch (text/plain), 17.71 KB, created by
Rodolfo Schulz de Lima
on 2006-03-08 10:08:12 UTC
(
hide
)
Description:
Adds modern looks to wxaui
Filename:
MIME Type:
Creator:
Rodolfo Schulz de Lima
Created:
2006-03-08 10:08:12 UTC
Size:
17.71 KB
patch
obsolete
>diff -ur wxaui-0.9.1/include/manager.h wxaui-0.9.1.modern/include/manager.h >--- wxaui-0.9.1/include/manager.h 2006-01-10 15:11:39.000000000 -0200 >+++ wxaui-0.9.1.modern/include/manager.h 2006-02-22 16:39:11.000000000 -0300 >@@ -54,7 +54,9 @@ > wxAUI_ART_BORDER_COLOUR = 13, > wxAUI_ART_GRIPPER_COLOUR = 14, > wxAUI_ART_CAPTION_FONT = 15, >- wxAUI_ART_GRADIENT_TYPE = 16 >+ wxAUI_ART_GRADIENT_TYPE = 16, >+ wxAUI_ART_CAPTION_TEXT_INDENT = 17, >+ wxAUI_ART_PANE_BUTTON_BORDER_SIZE = 18 > }; > > enum wxPaneDockArtGradients >@@ -552,7 +554,7 @@ > virtual void DrawCaption(wxDC& dc, > const wxString& text, > const wxRect& rect, >- wxPaneInfo& pane) = 0; >+ wxPaneInfo& pane, unsigned int flags) = 0; > > virtual void DrawGripper(wxDC& dc, > const wxRect& rect, >@@ -566,7 +568,7 @@ > int button, > int button_state, > const wxRect& rect, >- wxPaneInfo& pane) = 0; >+ wxPaneInfo& pane, unsigned int flags) = 0; > }; > > >@@ -598,7 +600,7 @@ > void DrawCaption(wxDC& dc, > const wxString& text, > const wxRect& rect, >- wxPaneInfo& pane); >+ wxPaneInfo& pane, unsigned int flags); > > void DrawGripper(wxDC& dc, > const wxRect& rect, >@@ -612,11 +614,11 @@ > int button, > int button_state, > const wxRect& rect, >- wxPaneInfo& pane); >+ wxPaneInfo& pane, unsigned int flags = 0); > > protected: > >- void DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active); >+ virtual void DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active); > > protected: > >@@ -640,8 +642,10 @@ > wxColour m_inactive_caption_text_colour; > int m_border_size; > int m_caption_size; >+ int m_caption_text_indent; > int m_sash_size; > int m_button_size; >+ int m_button_border_size; > int m_gripper_size; > int m_gradient_type; > }; >@@ -746,6 +750,28 @@ > }; > > >+class ModernDockArt : public wxDefaultDockArt >+{ >+public: >+ ModernDockArt(wxWindow* win); >+ >+ void DrawPaneButton(wxDC& dc, >+ int button, >+ int button_state, >+ const wxRect& rect, >+ wxPaneInfo& pane, unsigned int flags = 0); >+ >+ void DrawCaption(wxDC& dc, >+ const wxString& text, >+ const wxRect& rect, >+ wxPaneInfo& pane, unsigned int flags); >+ >+protected: >+ void DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active, unsigned int flags); >+ >+private: >+ wxWindow* m_win; >+}; > > > // wx event machinery >Somente em wxaui-0.9.1.modern: .libs >Somente em wxaui-0.9.1.modern: manager.loT >diff -ur wxaui-0.9.1/src/manager.cpp wxaui-0.9.1.modern/src/manager.cpp >--- wxaui-0.9.1/src/manager.cpp 2006-01-10 15:11:39.000000000 -0200 >+++ wxaui-0.9.1.modern/src/manager.cpp 2006-02-22 17:10:05.000000000 -0300 >@@ -12,8 +12,17 @@ > #include <wx/wx.h> > #include <wx/minifram.h> > #include <wx/image.h> >+#include <wx/renderer.h> >+ > #include "manager.h" > >+#ifndef __WIN32__ >+#undef wxUSE_UXTHEME >+#endif >+ >+#if wxUSE_UXTHEME >+ #include "wx/msw/uxtheme.h" // XP theme handling >+#endif > > // -- various array and event implementations -- > >@@ -49,18 +58,18 @@ > wxMin((g*percent)/100,255), > wxMin((b*percent)/100,255)); > } >- >-static wxColor LightContrastColour(const wxColour& c) >-{ >- int amount = 120; >- >- // if the color is especially dark, then >- // make the contrast even lighter >- if (c.Red() < 128 && c.Green() < 128 && c.Blue() < 128) >- amount = 160; >- >- return StepColour(c, amount); >-} >+ >+static wxColor LightContrastColour(const wxColour& c) >+{ >+ int amount = 120; >+ >+ // if the color is especially dark, then >+ // make the contrast even lighter >+ if (c.Red() < 128 && c.Green() < 128 && c.Blue() < 128) >+ amount = 160; >+ >+ return StepColour(c, amount); >+} > > // BitmapFromBits() is a utility function that creates a > // masked bitmap from raw bits (XBM format) >@@ -122,7 +131,7 @@ > m_active_caption_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); > m_inactive_caption_colour = StepColour(darker1_color, 80); > m_inactive_caption_gradient_colour = darker1_color; >- m_inactive_caption_text_colour = *wxBLACK; >+ m_inactive_caption_text_colour = *wxBLACK; > > m_sash_brush = wxBrush(base_color); > m_background_brush = wxBrush(base_color); >@@ -153,8 +162,10 @@ > // default metric values > m_sash_size = 4; > m_caption_size = 17; >+ m_caption_text_indent = 3; > m_border_size = 1; > m_button_size = 14; >+ m_button_border_size = 0; > m_gripper_size = 9; > m_gradient_type = wxAUI_GRADIENT_VERTICAL; > } >@@ -163,13 +174,15 @@ > { > switch (id) > { >- case wxAUI_ART_SASH_SIZE: return m_sash_size; >- case wxAUI_ART_CAPTION_SIZE: return m_caption_size; >- case wxAUI_ART_GRIPPER_SIZE: return m_gripper_size; >- case wxAUI_ART_PANE_BORDER_SIZE: return m_border_size; >- case wxAUI_ART_PANE_BUTTON_SIZE: return m_button_size; >- case wxAUI_ART_GRADIENT_TYPE: return m_gradient_type; >- default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; >+ case wxAUI_ART_SASH_SIZE: return m_sash_size; >+ case wxAUI_ART_CAPTION_SIZE: return m_caption_size; >+ case wxAUI_ART_CAPTION_TEXT_INDENT: return m_caption_size; >+ case wxAUI_ART_GRIPPER_SIZE: return m_gripper_size; >+ case wxAUI_ART_PANE_BORDER_SIZE: return m_border_size; >+ case wxAUI_ART_PANE_BUTTON_SIZE: return m_button_size; >+ case wxAUI_ART_PANE_BUTTON_BORDER_SIZE: return m_button_border_size; >+ case wxAUI_ART_GRADIENT_TYPE: return m_gradient_type; >+ default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; > } > > return 0; >@@ -179,13 +192,15 @@ > { > switch (id) > { >- case wxAUI_ART_SASH_SIZE: m_sash_size = new_val; break; >- case wxAUI_ART_CAPTION_SIZE: m_caption_size = new_val; break; >- case wxAUI_ART_GRIPPER_SIZE: m_gripper_size = new_val; break; >- case wxAUI_ART_PANE_BORDER_SIZE: m_border_size = new_val; break; >- case wxAUI_ART_PANE_BUTTON_SIZE: m_button_size = new_val; break; >- case wxAUI_ART_GRADIENT_TYPE: m_gradient_type = new_val; break; >- default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; >+ case wxAUI_ART_SASH_SIZE: m_sash_size = new_val; break; >+ case wxAUI_ART_CAPTION_SIZE: m_caption_size = new_val; break; >+ case wxAUI_ART_CAPTION_TEXT_INDENT: m_caption_text_indent = new_val; break; >+ case wxAUI_ART_GRIPPER_SIZE: m_gripper_size = new_val; break; >+ case wxAUI_ART_PANE_BORDER_SIZE: m_border_size = new_val; break; >+ case wxAUI_ART_PANE_BUTTON_SIZE: m_button_size = new_val; break; >+ case wxAUI_ART_PANE_BUTTON_BORDER_SIZE: m_button_border_size = new_val; break; >+ case wxAUI_ART_GRADIENT_TYPE: m_gradient_type = new_val; break; >+ default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; > } > } > >@@ -328,7 +343,7 @@ > void wxDefaultDockArt::DrawCaption(wxDC& dc, > const wxString& text, > const wxRect& rect, >- wxPaneInfo& pane) >+ wxPaneInfo& pane, unsigned int flags) > { > dc.SetPen(*wxTRANSPARENT_PEN); > dc.SetFont(m_caption_font); >@@ -346,7 +361,7 @@ > dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h); > > dc.SetClippingRegion(rect); >- dc.DrawText(text, rect.x+3, rect.y+(rect.height/2)-(h/2)-1); >+ dc.DrawText(text, rect.x+m_caption_text_indent, rect.y+(rect.height/2)-(h/2)-1); > dc.DestroyClippingRegion(); > } > >@@ -382,7 +397,7 @@ > int button, > int button_state, > const wxRect& _rect, >- wxPaneInfo& pane) >+ wxPaneInfo& pane, unsigned int flags) > { > wxRect rect = _rect; > >@@ -394,16 +409,16 @@ > > if (button_state == wxAUI_BUTTON_STATE_HOVER || > button_state == wxAUI_BUTTON_STATE_PRESSED) >- { >- if (pane.state & wxPaneInfo::optionActive) >- { >- dc.SetBrush(wxBrush(StepColour(m_active_caption_colour, 120))); >- dc.SetPen(wxPen(StepColour(m_active_caption_colour, 70))); >- } >- else >- { >- dc.SetBrush(wxBrush(StepColour(m_inactive_caption_colour, 120))); >- dc.SetPen(wxPen(StepColour(m_inactive_caption_colour, 70))); >+ { >+ if (pane.state & wxPaneInfo::optionActive) >+ { >+ dc.SetBrush(wxBrush(StepColour(m_active_caption_colour, 120))); >+ dc.SetPen(wxPen(StepColour(m_active_caption_colour, 70))); >+ } >+ else >+ { >+ dc.SetBrush(wxBrush(StepColour(m_inactive_caption_colour, 120))); >+ dc.SetPen(wxPen(StepColour(m_inactive_caption_colour, 70))); > } > > // draw the background behind the button >@@ -1607,6 +1622,7 @@ > int gripper_size = m_art->GetMetric(wxAUI_ART_GRIPPER_SIZE); > int pane_border_size = m_art->GetMetric(wxAUI_ART_PANE_BORDER_SIZE); > int pane_button_size = m_art->GetMetric(wxAUI_ART_PANE_BUTTON_SIZE); >+ int pane_button_border_size = m_art->GetMetric(wxAUI_ART_PANE_BUTTON_BORDER_SIZE); > > // find out the orientation of the item (orientation for panes > // is the same as the dock's orientation) >@@ -1661,9 +1677,7 @@ > { > wxPaneButton& button = pane.buttons.Item(i); > >- sizer_item = caption_sizer->Add(pane_button_size, >- caption_size, >- 0, wxEXPAND); >+ sizer_item = caption_sizer->Add(pane_button_size, pane_button_size, 0, wxALIGN_TOP|wxTOP|wxRIGHT|wxBOTTOM, pane_button_border_size); > > part.type = wxDockUIPart::typePaneButton; > part.dock = &dock; >@@ -3214,17 +3228,17 @@ > } > > return; >- } >- >- >- // if a key modifier is pressed while dragging the frame, >- // don't dock the window >- if (wxGetKeyState(WXK_ALT)) >- { >- HideHint(); >- return; > } >- >+ >+ >+ // if a key modifier is pressed while dragging the frame, >+ // don't dock the window >+ if (wxGetKeyState(WXK_ALT)) >+ { >+ HideHint(); >+ return; >+ } >+ > > DrawHintRect(wnd, client_pt, action_offset); > >@@ -3253,16 +3267,16 @@ > // of the frame to the mouse pointer > wxPoint frame_pos = pane.frame->GetPosition(); > wxPoint action_offset(pt.x-frame_pos.x, pt.y-frame_pos.y); >- >- >- // if a key modifier is pressed while dragging the frame, >- // don't dock the window >- if (wxGetKeyState(WXK_ALT)) >- { >- HideHint(); >- return; >- } >- >+ >+ >+ // if a key modifier is pressed while dragging the frame, >+ // don't dock the window >+ if (wxGetKeyState(WXK_ALT)) >+ { >+ HideHint(); >+ return; >+ } >+ > > // do the drop calculation > DoDrop(m_docks, m_panes, pane, client_pt, action_offset); >@@ -3346,19 +3360,19 @@ > break; > case wxDockUIPart::typeBackground: > m_art->DrawBackground(*dc, part.orientation, part.rect); >+ break; >+ case wxDockUIPart::typePaneBorder: >+ m_art->DrawBorder(*dc, part.rect, *part.pane); > break; >- case wxDockUIPart::typeCaption: >- m_art->DrawCaption(*dc, part.pane->caption, part.rect, *part.pane); >+ case wxDockUIPart::typeCaption: >+ m_art->DrawCaption(*dc, part.pane->caption, part.rect, *part.pane, m_flags); > break; > case wxDockUIPart::typeGripper: > m_art->DrawGripper(*dc, part.rect, *part.pane); >- break; >- case wxDockUIPart::typePaneBorder: >- m_art->DrawBorder(*dc, part.rect, *part.pane); >- break; >+ break; > case wxDockUIPart::typePaneButton: > m_art->DrawPaneButton(*dc, part.button->button_id, >- wxAUI_BUTTON_STATE_NORMAL, part.rect, *part.pane); >+ wxAUI_BUTTON_STATE_NORMAL, part.rect, *part.pane, m_flags); > break; > } > } >@@ -3484,7 +3498,7 @@ > button_ui_part->button->button_id, > state, > button_ui_part->rect, >- *hit_test->pane); >+ *hit_test->pane, m_flags); > } > > void wxFrameManager::OnLeftDown(wxMouseEvent& event) >@@ -3982,3 +3996,178 @@ > Update(); > } > } >+ >+ >+ModernDockArt::ModernDockArt(wxWindow* win) : wxDefaultDockArt(), m_win(win) >+{ >+ bool usingTheme = false; >+ >+ // Get the size of a small close button (themed) >+#if wxUSE_UXTHEME >+ if (wxUxThemeEngine::Get()) >+ { >+ wxUxThemeHandle hTheme(m_win, L"WINDOW"); >+ if (hTheme) >+ { >+ usingTheme = true; >+ >+ wxClientDC dc(m_win); >+ HDC hdc = GetHdcOf(dc); >+ wxSize size(13, 15); >+ SIZE sz; >+ wxUxThemeEngine::Get()->GetThemePartSize(hTheme, hdc, 19 /*WP_SMALLCLOSEBUTTON*/, >+ 1 /* CBS_NORMAL */, NULL, TS_TRUE, &sz); >+ >+ m_button_size = sz.cx; >+ } >+ } >+#endif // wxUSE_UXTHEME >+ >+ m_button_border_size = 3; >+ m_caption_text_indent = 6; >+ m_caption_size = 22; >+ >+ // We only highlight the active pane with the caption text being in bold. >+ // So we do not want a special colour for active elements. >+ m_active_caption_colour = m_inactive_caption_colour; >+ m_active_close_bitmap = m_inactive_close_bitmap; >+}; >+ >+void ModernDockArt::DrawCaption(wxDC& dc, >+ const wxString& text, >+ const wxRect& rect, >+ wxPaneInfo& pane, unsigned int flags) >+{ >+ dc.SetPen(*wxTRANSPARENT_PEN); >+ >+ DrawCaptionBackground(dc, rect, >+ (pane.state & wxPaneInfo::optionActive)?true:false, flags); >+ >+ // Active captions are drawn with bold text >+ // if (pane.state & wxPaneInfo::optionActive) >+ m_caption_font.SetWeight(wxFONTWEIGHT_BOLD); >+ // else >+ //m_caption_font.SetWeight(wxFONTWEIGHT_NORMAL); >+ dc.SetFont(m_caption_font); >+ >+ m_active_caption_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); >+ dc.SetTextForeground(m_active_caption_text_colour); >+ >+ wxCoord w,h; >+ dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h); >+ >+ dc.SetClippingRegion(rect); >+ dc.DrawText(text, rect.x+m_caption_text_indent, rect.y+(rect.height/2)-(h/2)-1); >+ dc.DestroyClippingRegion(); >+} >+ >+void ModernDockArt::DrawCaptionBackground(wxDC& dc, >+ const wxRect& rect, >+ bool active, unsigned int flags) >+{ >+ // Clear the background >+ dc.SetBrush(m_background_brush); >+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); >+ >+ bool usingTheme = false; >+ >+#if wxUSE_UXTHEME >+ >+ if (wxUxThemeEngine::Get()) >+ { >+ wxUxThemeHandle hTheme(m_win, L"WINDOW"); >+ >+ if (hTheme) >+ { >+ usingTheme = true; >+ >+ RECT rc; >+ wxRect rectangle = rect; >+ rectangle.x--; >+ rectangle.y--; >+ rectangle.width+=2; >+ rectangle.height+=2; >+ wxCopyRectToRECT(rectangle, rc); >+ >+ if( active || !(flags & wxAUI_MGR_ALLOW_ACTIVE_PANE) ) >+ wxUxThemeEngine::Get()->DrawThemeBackground(hTheme, GetHdcOf(dc), 5, 1, &rc, NULL); >+ else >+ wxUxThemeEngine::Get()->DrawThemeBackground(hTheme, GetHdcOf(dc), 5, 2, &rc, NULL); >+ } >+ } >+ >+#endif >+ >+ if (!usingTheme) wxRendererNative::Get().DrawHeaderButton(m_win, dc, rect, wxCONTROL_FOCUSED); >+} >+ >+ >+void ModernDockArt::DrawPaneButton(wxDC& dc,int button, >+ int button_state, >+ const wxRect& _rect, >+ wxPaneInfo& pane, unsigned int flags) >+{ >+ bool usingTheme = false; >+ >+#if wxUSE_UXTHEME >+ if (wxUxThemeEngine::Get()) >+ { >+ wxUxThemeHandle hTheme(m_win, L"WINDOW"); >+ if (hTheme) >+ { >+ usingTheme = true; >+ >+ // Get the real button position (compensating for borders) >+ const wxRect rect(_rect.x, _rect.y+m_button_border_size, m_button_size, m_button_size); >+ >+ // Draw the themed close button >+ RECT rc; >+ wxCopyRectToRECT(rect, rc); >+ >+ int state = 4; // CBS_DISABLED >+ >+ if( (pane.state & wxPaneInfo::optionActive) || !(flags & wxAUI_MGR_ALLOW_ACTIVE_PANE) ) // active pane >+ { >+ switch (button_state) >+ { >+ case wxAUI_BUTTON_STATE_NORMAL: >+ state = 1; // CBS_NORMAL >+ break; >+ case wxAUI_BUTTON_STATE_HOVER: >+ state = 2; // CBS_HOT >+ break; >+ case wxAUI_BUTTON_STATE_PRESSED: >+ state = 3; // CBS_PUSHED >+ break; >+ default: >+ wxASSERT_MSG(false, wxT("Unknown state")); >+ } >+ } >+ else // inactive pane >+ { >+ switch (button_state) >+ { >+ case wxAUI_BUTTON_STATE_NORMAL: >+ state = 5; // CBS_NORMAL >+ break; >+ case wxAUI_BUTTON_STATE_HOVER: >+ state = 6; // CBS_HOT >+ break; >+ case wxAUI_BUTTON_STATE_PRESSED: >+ state = 7; // CBS_PUSHED >+ break; >+ default: >+ wxASSERT_MSG(false, wxT("Unknown state")); >+ } >+ } >+ >+ wxUxThemeEngine::Get()->DrawThemeBackground(hTheme, GetHdcOf(dc), 19 /*WP_SMALLCLOSEBUTTON*/, >+ state, &rc, NULL); >+ >+ } >+ } >+#endif // wxUSE_UXTHEME >+ >+ // Fallback to default closebutton if themes are not enabled >+ if (!usingTheme) wxDefaultDockArt::DrawPaneButton(dc, button, button_state, _rect, pane); >+} >Somente em wxaui-0.9.1.modern/src: .manager.cpp.swp
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 125499
:
81700
|
81701
|
81702
| 81703