]> git.saurik.com Git - wxWidgets.git/commitdiff
Have wxPGTextCtrlEditor::UpdateControl() update wxTextCtrl font boldness based on...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Fri, 26 Dec 2008 18:46:08 +0000 (18:46 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Fri, 26 Dec 2008 18:46:08 +0000 (18:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57568 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/property.h
include/wx/propgrid/propgrid.h
interface/wx/propgrid/propgrid.h
src/propgrid/editors.cpp
src/propgrid/property.cpp
src/propgrid/propgrid.cpp
src/propgrid/propgridiface.cpp

index 38019dfe9b43117d829d16ddf92b6256dcbc18c7..28535bb6445768c83a752bf33298726378ed12da 100644 (file)
@@ -1550,8 +1550,6 @@ public:
     */
     wxDEPRECATED( wxString GetValueString( int argFlags = 0 ) const );
 
-    void UpdateControl( wxWindow* primary );
-
     /**
         Returns wxPGCell of given column.
     */
@@ -2224,6 +2222,8 @@ protected:
     // moved to it.
     void SubPropsChanged( int oldSelInd = -1 );
 
+    void UpdateControl( wxWindow* editorWnd );
+
     int GetY2( int lh ) const;
 
     wxString                    m_label;
index 650bacbb4165abe0ddd721391aa706a922b6111c..4456641a4ad35b0ad7b714825c1b085f13aeed45 100644 (file)
@@ -1179,6 +1179,11 @@ public:
         return m_wndEditor2;
     }
 
+    /**
+        Refreshes any active editor control.
+    */
+    void RefreshEditor();
+
     // Events from editor controls are forward to this function
     void HandleCustomEditorEvent( wxEvent &event );
 
index 253c252f637e77b7082c702c1b8231ddc2b9cd98..97ea3eb379623a87f47d60fdf651493c722ebc0e 100644 (file)
@@ -658,6 +658,11 @@ public:
     */
     bool IsFrozen() const;
 
+    /**
+        Refreshes any active editor control.
+    */
+    void RefreshEditor();
+
     /**
         Redraws given property.
     */
index d3a4418c6b3079daf8e264898ad26002ff49437c..570ec33a80fe1326058b74de69ef467a60f8c1bb 100644 (file)
@@ -283,9 +283,22 @@ void wxPGTextCtrlEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl )
     else
         s = property->GetDisplayedString();
 
-    tc->SetValue(s);    
-}
+    tc->SetValue(s);
+
+    // Update font boldness
+    wxPropertyGrid* pg = property->GetGrid();
+    if ( pg->HasFlag(wxPG_BOLD_MODIFIED) )
+    {
+        if ( property->HasFlag(wxPG_PROP_MODIFIED) )
+            tc->SetFont(pg->GetCaptionFont());
+        else
+            tc->SetFont(pg->GetFont());
 
+#if defined(__WXMSW__) && !defined(__WXWINCE__)
+        ::SendMessage(GetHwndOf(tc), EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
+#endif
+    }
+}
 
 // Provided so that, for example, ComboBox editor can use the same code
 // (multiple inheritance would get way too messy).
index addc80c0c20af351f4585859df050a027bfcde36..1897d12761cc5797cf581fc14cf5284a57b0654c 100644 (file)
@@ -639,10 +639,10 @@ int wxPGProperty::Index( const wxPGProperty* p ) const
     return wxNOT_FOUND;
 }
 
-void wxPGProperty::UpdateControl( wxWindow* primary )
+void wxPGProperty::UpdateControl( wxWindow* editorWnd )
 {
-    if ( primary )
-        GetEditorClass()->UpdateControl(this, primary);
+    if ( editorWnd )
+        GetEditorClass()->UpdateControl(this, editorWnd);
 }
 
 bool wxPGProperty::ValidateValue( wxVariant& WXUNUSED(value), wxPGValidationInfo& WXUNUSED(validationInfo) ) const
@@ -1336,18 +1336,13 @@ void wxPGProperty::SetFlagRecursively( FlagType flag, bool set )
 
 void wxPGProperty::RefreshEditor()
 {
-    if ( m_parent && GetParentState() )
-    {
-        wxPropertyGrid* pg = GetParentState()->GetGrid();
-        if ( pg->GetSelectedProperty() == this )
-        {
-            wxWindow* editor = pg->GetEditorControl();
-            if ( editor )
-                GetEditorClass()->UpdateControl( this, editor );
-        }
-    }
-}
+    if ( !m_parent )
+        return;
 
+    wxPropertyGrid* pg = GetGrid();
+    if ( pg && pg->GetSelectedProperty() == this )
+        UpdateControl(pg->GetEditorControl());
+}
 
 wxVariant wxPGProperty::GetDefaultValue() const
 {
index cbc0bd7ad6029cdc0184cd61df72f1ad458d56a1..a2ba810891633d8a6be1a048304d8121f114be0f 100644 (file)
@@ -3636,6 +3636,15 @@ bool wxPropertyGrid::UnfocusEditor()
 
 // -----------------------------------------------------------------------
 
+void wxPropertyGrid::RefreshEditor()
+{
+    if ( !m_selected || !m_wndEditor || m_frozen )
+        return;
+    m_selected->UpdateControl(m_wndEditor);
+}
+
+// -----------------------------------------------------------------------
+
 // This method is not inline because it called dozens of times
 // (i.e. two-arg function calls create smaller code size).
 bool wxPropertyGrid::DoClearSelection()
index f762133260cf0fa54bc596752e7063a57c67db6e..603fc34ec06676083bbe9c9c3639c2053056d21c 100644 (file)
@@ -523,6 +523,9 @@ void wxPropertyGridInterface::ClearModifiedStatus()
 
         pageIndex++;
     }
+
+    // Update active editor control, if any
+    GetPropertyGrid()->RefreshEditor();
 }
 
 // -----------------------------------------------------------------------