aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/ScintillaView.mm
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2021-05-10 23:02:05 +1000
committerNeil Hodgson <nyamatongwe@gmail.com>2021-05-10 23:02:05 +1000
commit7b98798ee4047aec150927d3b5fc6a75f78e0273 (patch)
treec1b72ac86262d57c968bd9c0e091777a7732f0f2 /cocoa/ScintillaView.mm
parent8497317864816c0f7a4b5baf3229c7a3336f55d8 (diff)
downloadscintilla-mirror-7b98798ee4047aec150927d3b5fc6a75f78e0273.tar.gz
Implement UpdateBaseElements on Cocoa to update colours to match current system
settings. Trigger UpdateBaseElements when system settings change. This makes Scintilla (by default) track the correct tint to show as the selection background.
Diffstat (limited to 'cocoa/ScintillaView.mm')
-rw-r--r--cocoa/ScintillaView.mm25
1 files changed, 25 insertions, 0 deletions
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm
index 593722c1e..f878a7a6b 100644
--- a/cocoa/ScintillaView.mm
+++ b/cocoa/ScintillaView.mm
@@ -338,6 +338,17 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
//--------------------------------------------------------------------------------------------------
/**
+ * Gets called by the runtime when the effective appearance changes.
+ */
+- (void) viewDidChangeEffectiveAppearance {
+ if (mOwner.backend) {
+ mOwner.backend->UpdateBaseElements();
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+
+/**
* Gets called by the runtime when the view needs repainting.
*/
- (void) drawRect: (NSRect) rect {
@@ -1454,11 +1465,18 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
name: NSWindowWillMoveNotification
object: self.window];
+ [center addObserver: self
+ selector: @selector(defaultsDidChange:)
+ name: NSSystemColorsDidChangeNotification
+ object: self.window];
+
[scrollView.contentView setPostsBoundsChangedNotifications: YES];
[center addObserver: self
selector: @selector(scrollerAction:)
name: NSViewBoundsDidChangeNotification
object: scrollView.contentView];
+
+ mBackend->UpdateBaseElements();
}
return self;
}
@@ -1498,6 +1516,13 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
//--------------------------------------------------------------------------------------------------
+- (void) defaultsDidChange: (NSNotification *) note {
+#pragma unused(note)
+ mBackend->UpdateBaseElements();
+}
+
+//--------------------------------------------------------------------------------------------------
+
- (void) viewDidMoveToWindow {
[super viewDidMoveToWindow];