mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
fix filter popup menu in file picker (save dialog, etc.). b=412680 r=kreeger sr=roc
This commit is contained in:
parent
78f85b804e
commit
8a58c19ab4
@ -131,20 +131,30 @@ NSView* nsFilePicker::GetAccessoryView()
|
||||
PRInt32 numMenuItems = mTitles.Count();
|
||||
for (int i = 0; i < numMenuItems; i++) {
|
||||
const nsString& currentTitle = *mTitles[i];
|
||||
NSString *titleString = [[NSString alloc] initWithCharacters:currentTitle.get()
|
||||
NSString *titleString;
|
||||
if (currentTitle.IsEmpty()) {
|
||||
const nsString& currentFilter = *mFilters[i];
|
||||
titleString = [[NSString alloc] initWithCharacters:currentFilter.get()
|
||||
length:currentFilter.Length()];
|
||||
}
|
||||
else {
|
||||
titleString = [[NSString alloc] initWithCharacters:currentTitle.get()
|
||||
length:currentTitle.Length()];
|
||||
}
|
||||
[popupButton addItemWithTitle:titleString];
|
||||
[titleString release];
|
||||
}
|
||||
[popupButton setTag:kSaveTypeControlTag];
|
||||
[popupButton sizeToFit];
|
||||
[popupButton sizeToFit]; // we have to do sizeToFit to get the height calculated for us
|
||||
// This is just a default width that works well, doesn't truncate the vast majority of
|
||||
// things that might end up in the menu.
|
||||
[popupButton setFrameSize:NSMakeSize(180, [popupButton frame].size.height)];
|
||||
|
||||
// position everything based on control sizes with kAccessoryViewPadding pix padding
|
||||
// on each side kAccessoryViewPadding pix horizontal padding between controls
|
||||
float greatestHeight = [textField frame].size.height;
|
||||
if ([popupButton frame].size.height > greatestHeight)
|
||||
greatestHeight = [popupButton frame].size.height;
|
||||
|
||||
float totalViewHeight = greatestHeight + kAccessoryViewPadding * 2;
|
||||
float totalViewWidth = [textField frame].size.width + [popupButton frame].size.width + kAccessoryViewPadding * 3;
|
||||
[accessoryView setFrameSize:NSMakeSize(totalViewWidth, totalViewHeight)];
|
||||
|
Loading…
Reference in New Issue
Block a user