00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiSource Application Framework 00004 * Copyright (C) 2004 AbiSource, Inc. 00005 * Copyright (C) 2004 Francis James Franklin <fjf@alinameridon.com> 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00020 * 02111-1307, USA. 00021 */ 00022 00023 00024 #ifndef XAP_COCOATOOLPALETTE_H 00025 #define XAP_COCOATOOLPALETTE_H 00026 00027 #import <Cocoa/Cocoa.h> 00028 00029 #include "ap_Strings.h" 00030 #include "ap_Toolbar_Id.h" 00031 00032 #include "xav_Listener.h" 00033 00034 class XAP_Frame; 00035 class EV_Menu_ActionSet; 00036 class EV_Toolbar_ActionSet; 00037 class FV_View; 00038 00039 @class XAP_CocoaToolPalette; 00040 00041 struct XAP_CocoaPaletteRef 00042 { 00043 NSString * Name; // used internally to identify palette 00044 NSButton * Title; 00045 NSBox * Box; 00046 }; 00047 00048 struct XAP_CocoaToolRef 00049 { 00050 NSButton * button; 00051 XAP_Toolbar_Id tlbrid; 00052 AP_String_Id_Enum ttipid; 00053 }; 00054 00055 class XAP_CocoaToolPaletteListener : public AV_Listener 00056 { 00057 public: 00058 XAP_CocoaToolPaletteListener(XAP_CocoaToolPalette * pPalette); 00059 00060 virtual ~XAP_CocoaToolPaletteListener(); 00061 00062 virtual bool notify(AV_View * pView, const AV_ChangeMask mask); 00063 virtual AV_ListenerType getType(void); 00064 00065 void setCurrentView(AV_View * view); 00066 00067 private: 00068 XAP_CocoaToolPalette * m_pPalette; 00069 00070 AV_View * m_pView; 00071 AV_ListenerId m_lid; 00072 }; 00073 00074 @interface XAP_CocoaPaletteView : NSView 00075 { 00076 NSMutableArray * m_Palette; 00077 } 00078 - (id)init; 00079 - (void)dealloc; 00080 00081 - (void)addPalette:(const struct XAP_CocoaPaletteRef *)palette; 00082 00083 - (void)sync; 00084 @end 00085 00086 @interface XAP_PaletteProperties_DataSource : NSObject 00087 { 00088 NSOutlineView * m_OutlineView; 00089 NSMutableArray * m_PropertyLevels; 00090 } 00091 - (id)initWithOutlineView:(NSOutlineView *)outlineView; 00092 - (void)dealloc; 00093 00094 - (void)syncWithView:(FV_View *)pView; 00095 00096 /* NSOutlineViewDataSource 00097 */ 00098 - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item; 00099 - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item; 00100 - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item; 00101 - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item; 00102 00103 /* NSOutlineView delegate method 00104 */ 00105 - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item; 00106 - (void)outlineView:(NSOutlineView *)outlineView willDisplayOutlineCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item; 00107 @end 00108 00109 @interface XAP_CocoaPreviewPanel : NSWindowController 00110 { 00111 IBOutlet NSTextField *oPreview; 00112 } 00113 - (id)init; 00114 - (void)dealloc; 00115 - (void)windowDidLoad; 00116 - (void)toggleVisibility:(id)sender; 00117 - (BOOL)validateMenuItem:(NSMenuItem *)menuItem; 00118 - (void)setPreviewString:(NSString *)previewString; 00119 @end 00120 00121 @interface XAP_CocoaToolPalette : NSWindowController 00122 { 00123 struct XAP_CocoaToolRef * m_ToolChest; 00124 00125 XAP_CocoaPaletteView * m_PaletteView; 00126 00127 XAP_PaletteProperties_DataSource * m_Properties_DataSource; 00128 00129 IBOutlet XAP_CocoaPreviewPanel * oPreviewPanel; 00130 00131 IBOutlet NSButton * oTitle_Standard; 00132 IBOutlet NSButton * oTitle_Format; 00133 IBOutlet NSButton * oTitle_Table; 00134 IBOutlet NSButton * oTitle_Extra; 00135 IBOutlet NSButton * oTitle_Properties; 00136 00137 IBOutlet NSBox * oBox_Standard; 00138 IBOutlet NSBox * oBox_Format; 00139 IBOutlet NSBox * oBox_Table; 00140 IBOutlet NSBox * oBox_Extra; 00141 IBOutlet NSBox * oBox_Properties; 00142 00143 IBOutlet NSPopUpButton * oDocumentStyle; 00144 IBOutlet NSPopUpButton * oFontName; 00145 IBOutlet NSPopUpButton * oFontMemberName; 00146 00147 IBOutlet NSComboBox * oFontSize; 00148 IBOutlet NSComboBox * oZoom; 00149 00150 IBOutlet NSColorWell * oColor_BG; 00151 IBOutlet NSColorWell * oColor_FG; 00152 00153 IBOutlet NSButton * oSwitch_BG; 00154 IBOutlet NSButton * oSwitch_FG; 00155 00156 IBOutlet NSTextField * oPreview; 00157 00158 IBOutlet NSOutlineView * oProperties; 00159 00160 IBOutlet NSPanel * oPanel; 00161 00162 #ifdef defn 00163 #undef defn 00164 #endif 00165 #define defn(T,X,Y) IBOutlet NSButton * T; 00166 #include "xap_CocoaTools.h" 00167 #undef defn 00168 00169 NSMutableArray * m_pFontFamilies; 00170 00171 NSString * m_pCurrentFontFamily; 00172 00173 const EV_Menu_ActionSet * m_pMenuActionSet; 00174 const EV_Toolbar_ActionSet * m_pToolbarActionSet; 00175 const EV_EditMethodContainer * m_pEditMethodContainer; 00176 00177 XAP_CocoaToolPaletteListener * m_Listener; 00178 00179 AV_View * m_pViewCurrent; 00180 AV_View * m_pViewPrevious; 00181 00182 XAP_Frame * m_pFrameCurrent; 00183 XAP_Frame * m_pFramePrevious; 00184 } 00185 + (XAP_CocoaToolPalette *)instance:(id)sender; 00186 + (BOOL)instantiated; 00187 00188 - (id)init; 00189 - (void)dealloc; 00190 00191 - (void)windowDidLoad; 00192 - (void)close; 00193 - (void)windowWillClose:(NSNotification *)aNotification; 00194 00195 - (void)toggleVisibility:(id)sender; 00196 - (BOOL)validateMenuItem:(NSMenuItem *)menuItem; 00197 00198 + (void)setPreviewText:(id)previewText; 00199 - (void)setPreviewString:(NSString *)previewString; 00200 00201 - (NSWindow *)previewPanel; 00202 00203 - (void)setColor:(XAP_Toolbar_Id)tlbrid; 00204 00205 - (IBAction)aColor_FG:(id)sender; 00206 - (IBAction)aColor_BG:(id)sender; 00207 - (IBAction)aSwitch_FG:(id)sender; 00208 - (IBAction)aSwitch_BG:(id)sender; 00209 - (IBAction)aDocumentStyle:(id)sender; 00210 - (IBAction)aFontName:(id)sender; 00211 - (IBAction)aFontMemberName:(id)sender; 00212 - (IBAction)aFontSize:(id)sender; 00213 - (IBAction)aTitle_click:(id)sender; 00214 - (IBAction)aTB_click:(id)sender; 00215 - (IBAction)aZoom:(id)sender; 00216 00217 - (void)sync; 00218 00219 - (void)setCurrentView:(AV_View *)view inFrame:(XAP_Frame *)frame; 00220 00221 - (void)rebuildFontFamilyPopUp; 00222 - (void)syncPopUpsForFont:(NSString *)requestedFontFamilyName; 00223 @end 00224 00225 #endif /* ! XAP_COCOATOOLPALETTE_H */
1.7.1