#if wxUSE_CHECKLISTBOX
#include "wx/checklst.h"
+#include "wx/arrstr.h"
#include "wx/mac/uma.h"
-#include "Appearance.h"
+#include <Appearance.h>
// ============================================================================
// implementation of wxCheckListBox
Cell cell, short dataOffset, short dataLength,
ListHandle listHandle )
{
+ wxCheckListBox* list;
+ list = (wxCheckListBox*) GetControlReference( (ControlRef) GetListRefCon(listHandle) );
+ if ( list == NULL )
+ return ;
+
GrafPtr savePort;
GrafPtr grafPtr;
RgnHandle savedClipRegion;
SInt32 savedPenMode;
- wxCheckListBox* list;
GetPort(&savePort);
SetPort((**listHandle).port);
grafPtr = (**listHandle).port ;
// typecast our refCon
- list = (wxCheckListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
// Calculate the cell rect.
ClipRect( drawRect );
EraseRect( drawRect );
- wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ;
-
- if ( font )
+ const wxFont& font = list->GetFont();
+ if ( font.Ok() )
{
- ::TextFont( font->m_macFontNum ) ;
- ::TextSize( font->m_macFontSize) ;
- ::TextFace( font->m_macFontStyle ) ;
+ ::TextFont( font.MacGetFontNum() ) ;
+ ::TextSize( font.MacGetFontSize()) ;
+ ::TextFace( font.MacGetFontStyle() ) ;
}
ThemeButtonDrawInfo info ;
{
}
+bool wxCheckListBox::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ const wxArrayString& choices,
+ long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ wxCArrayString chs(choices);
+
+ return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
+ style, validator, name);
+}
+
bool wxCheckListBox::Create(wxWindow *parent,
wxWindowID id,
const wxPoint &pos,
const wxValidator& validator,
const wxString &name)
{
+ m_macIsUserPane = FALSE ;
+
+ if ( !wxCheckListBoxBase::Create(parent, id, pos, size,
+ n, choices, style, validator, name) )
+ return false;
+
m_noItems = 0 ; // this will be increased by our append command
m_selected = 0;
GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth);
GetThemeMetric(kThemeMetricCheckBoxHeight,&h);
#endif
- wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
+
+ const wxFont& font = GetFont();
FontInfo finfo;
- FetchFontInfo(font->m_macFontNum,short(font->m_macFontSize),font->m_macFontStyle,&finfo);
+ FetchFontInfo(font.MacGetFontNum(),font.MacGetFontSize(),font.MacGetFontStyle(),&finfo);
m_TextBaseLineOffset= finfo.leading+finfo.ascent;
m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent;
m_checkBoxHeight= h;
}
- Rect bounds ;
- Str255 title ;
-
- MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
+
+ Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
ListDefSpec listDef;
listDef.defType = kListDefUserProcType;
Size asize;
- CreateListBoxControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, false, 0, 1, false, true,
+ CreateListBoxControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, false, 0, 1, false, true,
m_checkBoxHeight+2, 14, false, &listDef, (ControlRef *)&m_macControl );
- GetControlData( (ControlHandle) m_macControl, kControlNoPart, kControlListBoxListHandleTag,
+ GetControlData( (ControlRef) m_macControl, kControlNoPart, kControlListBoxListHandleTag,
sizeof(ListHandle), (Ptr) &m_macList, &asize);
- SetControlReference( (ControlHandle) m_macControl, (long) this);
- SetControlVisibility( (ControlHandle) m_macControl, false, false);
+ SetControlReference( (ControlRef) m_macControl, (long) this);
+ SetControlVisibility( (ControlRef) m_macControl, false, false);
#else
long result ;
wxStAppResource resload ;
- m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false ,
+ m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true ,
kwxMacListWithVerticalScrollbar , 0 , 0,
kControlListBoxProc , (long) this ) ;
- ::GetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlListBoxListHandleTag ,
+ ::GetControlData( (ControlRef) m_macControl , kControlNoPart , kControlListBoxListHandleTag ,
sizeof( ListHandle ) , (char*) &m_macList , &result ) ;
HLock( (Handle) m_macList ) ;
}
SetListSelectionFlags((ListHandle)m_macList, options);
- MacPostControlCreate() ;
+ MacPostControlCreate(pos,size) ;
for ( int i = 0 ; i < n ; i++ )
{