Make DoGetBestSize() always return a width of 100

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26686 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott 2004-04-10 03:11:44 +00:00
parent 23ffcdc41d
commit 79e1f224d1
2 changed files with 18 additions and 0 deletions

View File

@ -114,6 +114,8 @@ public:
// virtual void SelectAll();
virtual void SetEditable(bool editable);
protected:
virtual wxSize DoGetBestSize() const;
};
#endif // __WX_COCOA_TEXTCTRL_H__

View 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;
}