]> git.sesse.net Git - vlc/commitdiff
Change the searchField in NSSearchField when macos >= 10.3
authorJérome Decoodt <djc@videolan.org>
Wed, 11 May 2005 12:19:05 +0000 (12:19 +0000)
committerJérome Decoodt <djc@videolan.org>
Wed, 11 May 2005 12:19:05 +0000 (12:19 +0000)
Move MACOS_VERSION macro to intf.h

modules/gui/macosx/intf.h
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m
modules/gui/macosx/prefs_widgets.m

index 437db45492ca3a94791979ce752329c3876f76b4..fca91a13baa72288dddcdd952a2618099f07e98a 100644 (file)
@@ -45,6 +45,10 @@ unsigned int CocoaKeyToVLC( unichar i_key );
  * the translated string. the translation should be '1:translatedstring' though */
 #define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
 
+#define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
+            @"/System/Library/CoreServices/SystemVersion.plist"] \
+            objectForKey: @"ProductVersion"] floatValue]
+
 /*****************************************************************************
  * intf_sys_t: description and status of the interface
  *****************************************************************************/
index 0da71a09350e457b4152cbc38b37d5b8181d0047..340076f3af6b46f168c03db0374d065ed12e2be8 100644 (file)
@@ -78,6 +78,7 @@
 }
 
 - (void)initStrings;
+- (void)searchfieldChanged:(NSNotification *)o_notification;
 - (NSMenu *)menuForEvent:(NSEvent *)o_event;
 - (NSOutlineView *)outlineView;
 
index 28b5b395d1d6a48b7dbbcc7b4c5ef05328c8ddbf..0e17edf68e6ad07219c21ca11aeb727f036b47d2 100644 (file)
@@ -187,10 +187,35 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     vlc_list_release( p_list );
     vlc_object_release( p_playlist );
 
+    /* Change the simple textfield into a searchField if we can... */
+    if( MACOS_VERSION >= 10.3 )
+    {
+        NSView *o_parentview = [o_status_field superview];
+        NSSearchField *o_better_search_field = [[NSSearchField alloc]initWithFrame:[o_search_field frame]];
+        [o_better_search_field setRecentsAutosaveName:@"VLC media player search"];
+        [o_better_search_field setDelegate:self];
+        [[NSNotificationCenter defaultCenter] addObserver: self
+            selector: @selector(searchfieldChanged:)
+            name: NSControlTextDidChangeNotification
+            object: o_better_search_field];
+
+        [o_better_search_field setTarget:self];
+        [o_better_search_field setAction:@selector(searchItem:)];
+
+        [o_better_search_field setAutoresizingMask:NSViewMinXMargin];
+        [o_parentview addSubview:o_better_search_field];
+        [o_search_field setHidden:YES];
+    }
+    
     [self initStrings];
     //[self playlistUpdated];
 }
 
+- (void)searchfieldChanged:(NSNotification *)o_notification
+{
+    [o_search_field setStringValue:[[o_notification object] stringValue]];
+}
+
 - (void)initStrings
 {
     [o_mi_save_playlist setTitle: _NS("Save Playlist...")];
@@ -838,7 +863,6 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 
     if( p_playlist == NULL )
         return;
-
     p_view = playlist_ViewFind( p_playlist, i_current_view );
 
     if( p_view )
index f5f6713caf88fb7f57f525886bd7360d381064a5..6dfc8c290072483f08a95a3ae2b8111bd641bef5 100644 (file)
 #define OFFSET_RIGHT 20
 #define OFFSET_BETWEEN 2
 
-#define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
-            @"/System/Library/CoreServices/SystemVersion.plist"] \
-            objectForKey: @"ProductVersion"] floatValue]
-
 #define UPWARDS_WHITE_ARROW                 "\xE2\x87\xA7" 
 #define OPTION_KEY                          "\xE2\x8C\xA5"
 #define UP_ARROWHEAD                        "\xE2\x8C\x83"