File: wx-2.8.7-mac-listctrl-attributes.patch

package info (click to toggle)
poedit 1.4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 6,688 kB
  • ctags: 1,229
  • sloc: cpp: 9,686; sh: 3,951; makefile: 269; ansic: 10
file content (80 lines) | stat: -rw-r--r-- 2,493 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Index: include/wx/mac/carbon/listctrl.h
===================================================================
--- include/wx/mac/carbon/listctrl.h	(revision 51611)
+++ include/wx/mac/carbon/listctrl.h	(working copy)
@@ -365,6 +365,17 @@
   void MacSetDrawingContext(void* context) { m_cgContext = context; }
   void* MacGetDrawingContext() { return m_cgContext; }
 
+
+#if wxABI_VERSION >= 20808
+  virtual wxVisualAttributes GetDefaultAttributes() const
+  {
+      return GetClassDefaultAttributes(GetWindowVariant());
+  }
+
+  static wxVisualAttributes
+  GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+#endif // wxABI_VERSION >= 20808
+
 protected:
 
   // protected overrides needed for pimpl approach
Index: src/mac/carbon/listctrl_mac.cpp
===================================================================
--- src/mac/carbon/listctrl_mac.cpp	(revision 52040)
+++ src/mac/carbon/listctrl_mac.cpp	(working copy)
@@ -752,6 +752,12 @@
             (EventHandlerRef *)&m_macListCtrlEventHandler);
     }
 
+    // set the default font to slightly smaller font that the native
+    // DataBrowser control uses:
+    wxFont font;
+    font.MacCreateThemeFont(kThemeViewsFont);
+    m_font = font;
+
     return true;
 }
 
@@ -772,6 +778,18 @@
     delete m_renameTimer;
 }
 
+/*static*/
+wxVisualAttributes wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
+{
+    wxVisualAttributes attr;
+
+    attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+    attr.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
+    attr.font.MacCreateThemeFont(kThemeViewsFont);
+
+    return attr;
+}
+
 // ----------------------------------------------------------------------------
 // set/get/change style
 // ----------------------------------------------------------------------------
@@ -2707,9 +2725,8 @@
     if (bgColor == wxNullColour)
         bgColor = listBgColor;
 
-    wxFont listFont = list->GetFont();
-    if (font == wxNullFont)
-        font = listFont;
+    if (!font.Ok())
+        font = list->GetFont();
 
     wxMacCFStringHolder cfString;
     cfString.Assign( text, wxLocale::GetSystemEncoding() );
@@ -2832,8 +2849,7 @@
 
     if (font.Ok())
     {
-        if (font.GetFamily() != wxFONTFAMILY_DEFAULT)
-            info.fontID = font.MacGetThemeFontID();
+        info.fontID = font.MacGetThemeFontID();
 
         ::TextSize( (short)(font.MacGetFontSize()) ) ;
         ::TextFace( font.MacGetFontStyle() ) ;