mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-29 15:39:59 +02:00
v108.10
* provide actual display device names in ruby::Video::hasMonitors() * macOS: fixed LineEdit::onChange (fixes state manager state naming) * macOS: fixed RadioLabel height to not clip off bottom of radio icons * macOS: fixed RadioLabel initial check states (fixed input settings focus mode options) * macOS: fixed TableViewItem::setSelected (fixes initial selection on settings/tools windows) * macOS: fixed TextEdit geometry (fixed manifest viewer) * macOS: don't allow multiple TableViewItems to be selected in single-selection mode ** (fixes settings/tools windows selecting multiple items via menubar options)
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
}
|
||||
|
||||
-(IBAction) activate:(id)sender {
|
||||
lineEdit->state.text = [[self stringValue] UTF8String];
|
||||
lineEdit->doActivate();
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ auto pRadioLabel::construct() -> void {
|
||||
cocoaView = cocoaRadioLabel = [[CocoaRadioLabel alloc] initWith:self()];
|
||||
pWidget::construct();
|
||||
|
||||
if(state().checked) setChecked();
|
||||
setGroup(state().group);
|
||||
setText(state().text);
|
||||
}
|
||||
}
|
||||
@@ -41,24 +41,11 @@ auto pRadioLabel::destruct() -> void {
|
||||
|
||||
auto pRadioLabel::minimumSize() const -> Size {
|
||||
Size size = pFont::size(self().font(true), state().text);
|
||||
return {size.width() + 22, size.height()};
|
||||
return {size.width() + 22, size.height() + 2};
|
||||
}
|
||||
|
||||
auto pRadioLabel::setChecked() -> void {
|
||||
@autoreleasepool {
|
||||
if(auto group = state().group) {
|
||||
for(auto& weak : group->state.objects) {
|
||||
if(auto object = weak.acquire()) {
|
||||
if(auto self = object->self()) {
|
||||
if(auto p = dynamic_cast<pRadioLabel*>(self)) {
|
||||
auto state = this == p ? NSOnState : NSOffState;
|
||||
[p->cocoaView setState:state];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setGroup(state().group);
|
||||
}
|
||||
|
||||
auto pRadioLabel::setGeometry(Geometry geometry) -> void {
|
||||
@@ -66,9 +53,26 @@ auto pRadioLabel::setGeometry(Geometry geometry) -> void {
|
||||
geometry.x() - 1, geometry.y(),
|
||||
geometry.width() + 2, geometry.height()
|
||||
});
|
||||
//buttonType:NSRadioButton does not set initial icon via programmatically calling setState:NSOnState.
|
||||
//I can only get the icon to show as checked initially by setting the state on geometry resizes.
|
||||
//adjusting the initWithFrame:NSMakeRect did not help.
|
||||
if(state().checked) setChecked();
|
||||
}
|
||||
|
||||
auto pRadioLabel::setGroup(sGroup group) -> void {
|
||||
@autoreleasepool {
|
||||
if(!group) return;
|
||||
for(auto& weak : group->state.objects) {
|
||||
if(auto object = weak.acquire()) {
|
||||
if(auto self = object->self()) {
|
||||
if(auto p = dynamic_cast<pRadioLabel*>(self)) {
|
||||
auto state = p->state().checked ? NSOnState : NSOffState;
|
||||
[p->cocoaView setState:state];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto pRadioLabel::setText(const string& text) -> void {
|
||||
|
@@ -37,6 +37,17 @@ auto pTableViewItem::setForegroundColor(Color color) -> void {
|
||||
}
|
||||
|
||||
auto pTableViewItem::setSelected(bool selected) -> void {
|
||||
@autoreleasepool {
|
||||
if(auto tableView = _parent()) {
|
||||
auto lock = tableView->acquire();
|
||||
auto indexSet = [[NSMutableIndexSet alloc] init];
|
||||
for(auto& item : tableView->state().items) {
|
||||
if(item->selected()) [indexSet addIndex:item->offset()];
|
||||
}
|
||||
[[tableView->cocoaView content] selectRowIndexes:indexSet byExtendingSelection:NO];
|
||||
[indexSet release];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto pTableViewItem::_parent() -> maybe<pTableView&> {
|
||||
|
@@ -104,6 +104,7 @@
|
||||
}
|
||||
|
||||
-(void) tableViewSelectionDidChange:(NSNotification*)notification {
|
||||
if(tableView->self()->locked()) return;
|
||||
for(auto& tableViewItem : tableView->state.items) {
|
||||
tableViewItem->state.selected = tableViewItem->offset() == [content selectedRow];
|
||||
}
|
||||
|
@@ -87,6 +87,11 @@ auto pTextEdit::setFont(const Font& font) -> void {
|
||||
auto pTextEdit::setForegroundColor(Color color) -> void {
|
||||
}
|
||||
|
||||
auto pTextEdit::setGeometry(Geometry geometry) -> void {
|
||||
pWidget::setGeometry(geometry);
|
||||
[cocoaView configure];
|
||||
}
|
||||
|
||||
auto pTextEdit::setText(const string& text) -> void {
|
||||
@autoreleasepool {
|
||||
[[cocoaView content] setString:[NSString stringWithUTF8String:text]];
|
||||
|
@@ -21,6 +21,7 @@ struct pTextEdit : pWidget {
|
||||
auto setEnabled(bool enabled) -> void override;
|
||||
auto setFont(const Font& font) -> void override;
|
||||
auto setForegroundColor(Color color) -> void;
|
||||
auto setGeometry(Geometry geometry) -> void override;
|
||||
auto setText(const string& text) -> void;
|
||||
auto setTextCursor(TextCursor textCursor) -> void;
|
||||
auto setWordWrap(bool wordWrap) -> void;
|
||||
|
Reference in New Issue
Block a user