| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import <Cocoa/Cocoa.h> | |
| 6 | |
| 7 #import "base/mac/cocoa_protocols.h" | |
| 8 #include "base/scoped_nsobject.h" | |
| 9 #include "chrome/browser/prefs/pref_member.h" | |
| 10 | |
| 11 class Profile; | |
| 12 | |
| 13 // Used to keep track of which type of font the user is currently selecting. | |
| 14 enum FontSettingType { | |
| 15 FontSettingSerif, | |
| 16 FontSettingSansSerif, | |
| 17 FontSettingFixed | |
| 18 }; | |
| 19 | |
| 20 // Keys for the dictionaries in the |encodings_| array. | |
| 21 extern NSString* const kCharacterInfoEncoding; // NSString value. | |
| 22 extern NSString* const kCharacterInfoName; // NSString value. | |
| 23 extern NSString* const kCharacterInfoID; // NSNumber value. | |
| 24 | |
| 25 // A window controller that allows the user to change the default WebKit fonts | |
| 26 // and language encodings for web pages. This window controller is meant to be | |
| 27 // used as a modal sheet on another window. | |
| 28 @interface FontLanguageSettingsController : NSWindowController | |
| 29 <NSWindowDelegate> { | |
| 30 @private | |
| 31 // The font that we are currently changing. | |
| 32 NSFont* currentFont_; // weak | |
| 33 FontSettingType currentType_; | |
| 34 | |
| 35 IBOutlet NSButton* serifButton_; | |
| 36 IBOutlet NSTextField* serifField_; | |
| 37 scoped_nsobject<NSFont> serifFont_; | |
| 38 IBOutlet NSTextField* serifLabel_; | |
| 39 BOOL changedSerif_; | |
| 40 | |
| 41 IBOutlet NSButton* sansSerifButton_; | |
| 42 IBOutlet NSTextField* sansSerifField_; | |
| 43 scoped_nsobject<NSFont> sansSerifFont_; | |
| 44 IBOutlet NSTextField* sansSerifLabel_; | |
| 45 BOOL changedSansSerif_; | |
| 46 | |
| 47 IBOutlet NSButton* fixedWidthButton_; | |
| 48 IBOutlet NSTextField* fixedWidthField_; | |
| 49 scoped_nsobject<NSFont> fixedWidthFont_; | |
| 50 IBOutlet NSTextField* fixedWidthLabel_; | |
| 51 BOOL changedFixedWidth_; | |
| 52 | |
| 53 // The actual preference members. | |
| 54 StringPrefMember serifName_; | |
| 55 StringPrefMember sansSerifName_; | |
| 56 StringPrefMember fixedWidthName_; | |
| 57 IntegerPrefMember serifSize_; | |
| 58 IntegerPrefMember sansSerifSize_; | |
| 59 IntegerPrefMember fixedWidthSize_; | |
| 60 | |
| 61 // Array of dictionaries that contain the canonical encoding name, human- | |
| 62 // readable name, and the ID. See the constants defined at the top of this | |
| 63 // file for the keys. | |
| 64 scoped_nsobject<NSMutableArray> encodings_; | |
| 65 | |
| 66 IBOutlet NSPopUpButton* encodingsMenu_; | |
| 67 NSInteger defaultEncodingIndex_; | |
| 68 StringPrefMember defaultEncoding_; | |
| 69 BOOL changedEncoding_; | |
| 70 | |
| 71 Profile* profile_; // weak | |
| 72 } | |
| 73 | |
| 74 // Profile cannot be NULL. Caller is responsible for showing the window as a | |
| 75 // modal sheet. | |
| 76 - (id)initWithProfile:(Profile*)profile; | |
| 77 | |
| 78 // Action for all the font changing buttons. This starts the font picker. | |
| 79 - (IBAction)selectFont:(id)sender; | |
| 80 | |
| 81 // Sent by the FontManager after the user has selected a font. | |
| 82 - (void)changeFont:(id)fontManager; | |
| 83 | |
| 84 // Performs the closing of the window. This is used by both the cancel button | |
| 85 // and |-save:| after it persists the settings. | |
| 86 - (IBAction)closeSheet:(id)sender; | |
| 87 | |
| 88 // Persists the new values into the preferences and closes the sheet. | |
| 89 - (IBAction)save:(id)sender; | |
| 90 | |
| 91 // Returns the |encodings_| array. This is used by bindings for KVO/KVC. | |
| 92 - (NSArray*)encodings; | |
| 93 | |
| 94 @end | |
| OLD | NEW |