propagating font to the individual columns, changing row heights according to font size, fixes #14578
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -314,6 +314,25 @@ protected:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setFont:(NSFont *)aFont
|
||||||
|
{
|
||||||
|
NSArray *tableColumns = [self tableColumns];
|
||||||
|
unsigned int columnIndex = [tableColumns count];
|
||||||
|
while (columnIndex--)
|
||||||
|
[[(NSTableColumn *)[tableColumns objectAtIndex:columnIndex] dataCell] setFont:aFont];
|
||||||
|
|
||||||
|
// todo introduce a common NSLayoutManager instance for all and use new method
|
||||||
|
[self setRowHeight:[aFont defaultLineHeightForFont]+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setControlSize:(NSControlSize) size
|
||||||
|
{
|
||||||
|
NSArray *tableColumns = [self tableColumns];
|
||||||
|
unsigned int columnIndex = [tableColumns count];
|
||||||
|
while (columnIndex--)
|
||||||
|
[[(NSTableColumn *)[tableColumns objectAtIndex:columnIndex] dataCell] setControlSize:size];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -369,6 +388,11 @@ wxListWidgetColumn* wxListWidgetCocoaImpl::InsertTextColumn( unsigned pos, const
|
|||||||
[col1 setWidth:1000];
|
[col1 setWidth:1000];
|
||||||
}
|
}
|
||||||
[col1 setResizingMask: NSTableColumnAutoresizingMask];
|
[col1 setResizingMask: NSTableColumnAutoresizingMask];
|
||||||
|
|
||||||
|
wxListBox *list = static_cast<wxListBox*> ( GetWXPeer());
|
||||||
|
if ( list != NULL )
|
||||||
|
[[col1 dataCell] setFont:list->GetFont().OSXGetNSFont()];
|
||||||
|
|
||||||
wxCocoaTableColumn* wxcol = new wxCocoaTableColumn( col1, editable );
|
wxCocoaTableColumn* wxcol = new wxCocoaTableColumn( col1, editable );
|
||||||
[col1 setColumn:wxcol];
|
[col1 setColumn:wxcol];
|
||||||
|
|
||||||
@@ -388,6 +412,39 @@ wxListWidgetColumn* wxListWidgetCocoaImpl::InsertCheckColumn( unsigned pos , con
|
|||||||
[checkbox setTitle:@""];
|
[checkbox setTitle:@""];
|
||||||
[checkbox setButtonType:NSSwitchButton];
|
[checkbox setButtonType:NSSwitchButton];
|
||||||
[col1 setDataCell:checkbox] ;
|
[col1 setDataCell:checkbox] ;
|
||||||
|
|
||||||
|
wxListBox *list = static_cast<wxListBox*> ( GetWXPeer());
|
||||||
|
if ( list != NULL )
|
||||||
|
{
|
||||||
|
NSControlSize size = NSRegularControlSize;
|
||||||
|
|
||||||
|
switch ( list->GetWindowVariant() )
|
||||||
|
{
|
||||||
|
case wxWINDOW_VARIANT_NORMAL :
|
||||||
|
size = NSRegularControlSize;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case wxWINDOW_VARIANT_SMALL :
|
||||||
|
size = NSSmallControlSize;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case wxWINDOW_VARIANT_MINI :
|
||||||
|
size = NSMiniControlSize;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case wxWINDOW_VARIANT_LARGE :
|
||||||
|
size = NSRegularControlSize;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[col1 dataCell] setControlSize:size];
|
||||||
|
// although there is no text, it may help to get the correct vertical layout
|
||||||
|
[[col1 dataCell] setFont:list->GetFont().OSXGetNSFont()];
|
||||||
|
}
|
||||||
|
|
||||||
[checkbox release];
|
[checkbox release];
|
||||||
|
|
||||||
unsigned formerColCount = [m_tableView numberOfColumns];
|
unsigned formerColCount = [m_tableView numberOfColumns];
|
||||||
|
Reference in New Issue
Block a user