]> git.saurik.com Git - wxWidgets.git/commitdiff
Make DoGetBestSize() always return a width of 100
authorDavid Elliott <dfe@tgwbd.org>
Sat, 10 Apr 2004 03:11:44 +0000 (03:11 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Sat, 10 Apr 2004 03:11:44 +0000 (03:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26686 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/cocoa/textctrl.h
src/cocoa/textctrl.mm

index 322fb99b48dd3d892e19b962447f36d207e4f228..abca3292dbe9ff3675547effaa674e989b63206c 100644 (file)
@@ -114,6 +114,8 @@ public:
 //    virtual void SelectAll();
     virtual void SetEditable(bool editable);
 
+protected:
+    virtual wxSize DoGetBestSize() const;
 };
 
 #endif // __WX_COCOA_TEXTCTRL_H__
index 6ead7fdd43e175125196f043b083a02fe8b6a5b4..5028866515504efa92d85f21dd772840db1e205e 100644 (file)
@@ -13,6 +13,7 @@
 #ifndef WX_PRECOMP
     #include "wx/app.h"
     #include "wx/textctrl.h"
+    #include "wx/log.h"
 #endif //WX_PRECOMP
 
 #include "wx/cocoa/string.h"
@@ -22,6 +23,8 @@
 #import <Foundation/NSString.h>
 #import <AppKit/NSTextField.h>
 
+#include <math.h>
+
 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
 BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
 END_EVENT_TABLE()
@@ -204,3 +207,16 @@ wxString wxTextCtrl::GetValue() const
     return wxStringWithNSString([GetNSTextField() stringValue]);
 }
 
+wxSize wxTextCtrl::DoGetBestSize() const
+{
+    wxAutoNSAutoreleasePool pool;
+    wxASSERT(GetNSControl());
+    NSCell *cell = [GetNSControl() cell];
+    wxASSERT(cell);
+    NSSize cellSize = [cell cellSize];
+    wxSize size(100,(int)ceilf(cellSize.height));
+
+    wxLogTrace(wxTRACE_COCOA_Window_Size,wxT("wxTextCtrl=%p::DoGetBestSize()==(%d,%d)"),this,size.x,size.y);
+    return size;
+}
+