00001 /* AbiWord 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * Copyright (C) 2001, 2003, 2005 Hubert Figuiere 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 * 02110-1301 USA. 00019 */ 00020 00021 #ifndef AP_COCOADIALOG_LISTS_H 00022 #define AP_COCOADIALOG_LISTS_H 00023 00024 #import <Cocoa/Cocoa.h> 00025 00026 #include "ap_Dialog_Lists.h" 00027 #include "ut_timer.h" 00028 #include "xap_CocoaDialog_Utilities.h" 00029 00030 class GR_CocoaCairoGraphics; 00031 class XAP_CocoaFrame; 00032 class AP_CocoaDialog_Lists; 00033 00034 @interface AP_CocoaDialog_ListsController : NSWindowController <XAP_CocoaDialogProtocol> 00035 { 00036 @public 00037 IBOutlet NSButton *_applyBtn; 00038 IBOutlet NSCell *_applyToCurrentBtn; 00039 IBOutlet NSCell *_attachToPreviousBtn; 00040 IBOutlet NSButton *_cancelBtn; 00041 IBOutlet NSTextField *_fontLabel; 00042 IBOutlet NSPopUpButton *_fontPopup; 00043 IBOutlet NSTextField *_formatData; 00044 IBOutlet NSTextField *_formatLabel; 00045 IBOutlet NSTextField *_labelAlignData; 00046 IBOutlet NSTextField *_labelAlignLabel; 00047 IBOutlet NSStepper *_labelAlignStepper; 00048 IBOutlet NSTextField *_levelDelimData; 00049 IBOutlet NSTextField *_levelDelimLabel; 00050 IBOutlet NSMatrix *_listActionMatrix; 00051 IBOutlet XAP_CocoaNSView *_preview; 00052 IBOutlet NSBox *_previewBox; 00053 IBOutlet NSButton *_setDefaultBtn; 00054 IBOutlet NSTextField *_startAtData; 00055 IBOutlet NSTextField *_startAtLabel; 00056 IBOutlet NSStepper *_startAtStepper; 00057 IBOutlet NSCell *_startNewListBtn; 00058 IBOutlet NSTextField *_styleLabel; 00059 IBOutlet NSPopUpButton *_stylePopup; 00060 IBOutlet NSTextField *_textAlignData; 00061 IBOutlet NSTextField *_textAlignLabel; 00062 IBOutlet NSStepper *_textAlignStepper; 00063 IBOutlet NSTextField *_typeLabel; 00064 IBOutlet NSPopUpButton *_typePopup; 00065 00066 IBOutlet NSTabView *_mainTab; 00067 00068 IBOutlet NSBox *_hideTextLabel; 00069 IBOutlet NSMatrix *_foldingMatrix; 00070 IBOutlet NSCell *_noFoldingBtn; 00071 IBOutlet NSCell *_foldLevel1Btn; 00072 IBOutlet NSCell *_foldLevel2Btn; 00073 IBOutlet NSCell *_foldLevel3Btn; 00074 IBOutlet NSCell *_foldLevel4Btn; 00075 00076 IBOutlet NSMenu* m_listStyleNone_menu; 00077 IBOutlet NSMenu* m_listStyleNumbered_menu; 00078 IBOutlet NSMenu* m_listStyleBulleted_menu; 00079 AP_CocoaDialog_Lists *_xap; 00080 } 00081 - (id)initFromNib; 00082 - (void)setXAPOwner:(XAP_Dialog *)owner; 00083 - (void)discardXAP; 00084 - (void)windowDidLoad; 00085 00086 - (void)windowDidBecomeKey:(NSNotification *)aNotification; 00087 00088 - (XAP_CocoaNSView*)preview; 00089 - (NSMenuItem*)selectedListStyle; 00090 - (NSMenuItem*)selectedListType; 00091 - (void)setStyleMenu:(int)type; 00092 - (void)selectFolding:(int)folding; 00093 - (int)selectedTab; 00094 00095 - (int)listAction; 00096 00097 - (IBAction)applyAction:(id)sender; 00098 - (IBAction)cancelAction:(id)sender; 00099 - (IBAction)labelAlignAction:(id)sender; 00100 - (IBAction)labelAlignActionStepper:(id)sender; 00101 - (IBAction)setDefaultAction:(id)sender; 00102 - (IBAction)startAtAction:(id)sender; 00103 - (IBAction)startAtStepperAction:(id)sender; 00104 - (IBAction)styleChangedAction:(id)sender; 00105 - (IBAction)textAlignAction:(id)sender; 00106 - (IBAction)textAlignActionStepper:(id)sender; 00107 - (IBAction)typeChangedAction:(id)sender; 00108 - (IBAction)valueChangedAction:(id)sender; 00109 00110 - (IBAction)foldingChanged:(id)sender; 00111 @end 00112 00113 /*****************************************************************/ 00114 00115 class AP_CocoaDialog_Lists: public AP_Dialog_Lists 00116 { 00117 public: 00118 AP_CocoaDialog_Lists(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00119 virtual ~AP_CocoaDialog_Lists(void); 00120 00121 static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id); 00122 00123 virtual void runModeless(XAP_Frame * pFrame); 00124 virtual void destroy(void); 00125 virtual void activate(void); 00126 virtual void notifyActiveFrame(XAP_Frame *pFrame); 00127 virtual void runModal(XAP_Frame * pFrame); 00128 virtual void setFoldLevelInGUI(void); 00129 virtual bool isPageLists(void); 00130 /* CALLBACKS */ 00131 00132 void customChanged(void); 00133 void applyClicked(void); 00134 void typeChanged(int type); 00135 void previewExposed(void); 00136 00137 /* Just Plain Useful Functions */ 00138 00139 void setListTypeFromWidget(void); 00140 void setXPFromLocal(void); 00141 void loadXPDataIntoLocal(void); 00142 void updateFromDocument(void); 00143 void setAllSensitivity(void); 00144 void updateDialog(void); 00145 bool dontUpdate(void); 00146 static void autoupdateLists(UT_Worker * pTimer); 00147 void _fillNumberedStyleMenu(NSMenu *listmenu); 00148 void _fillBulletedStyleMenu(NSMenu *listmenu); 00149 void _fillNoneStyleMenu(NSMenu *listmenu); 00150 void _fillFontMenu(NSPopUpButton* menu); 00151 00152 void _foldingChanged(int i) 00153 { 00154 setCurrentFold(i); 00155 } 00156 protected: 00157 void _setRadioButtonLabels(void); 00158 void _gatherData(void); 00159 private: 00160 GR_CocoaCairoGraphics * m_pPreviewWidget; 00161 UT_Timer * m_pAutoUpdateLists; 00162 bool m_bDontUpdate; 00163 bool m_bDestroy_says_stopupdating; 00164 bool m_bAutoUpdate_happening_now; 00165 AP_CocoaDialog_ListsController* m_dlg; 00166 }; 00167 00168 #endif /* AP_COCOADIALOG_LISTS_H */ 00169 00170 00171 00172 00173 00174 00175