00001 /* AbiWord 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * Copyright (C) 2001,2003 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_PARAGRAPH_H 00022 #define AP_COCOADIALOG_PARAGRAPH_H 00023 00024 #include "ap_Dialog_Paragraph.h" 00025 00026 class GR_CocoaCairoGraphics; 00027 class XAP_CocoaFrame; 00028 class AP_CocoaDialog_Paragraph; 00029 00030 @interface AP_CocoaDialog_ParagraphController : NSWindowController <XAP_CocoaDialogProtocol> 00031 { 00032 IBOutlet NSTextField *_alignmentLabel; 00033 IBOutlet NSPopUpButton *_alignmentPopup; 00034 IBOutlet NSTextField *_atData; 00035 IBOutlet NSTextField *_atLabel; 00036 IBOutlet NSTextField *_byData; 00037 IBOutlet NSTextField *_byLabel; 00038 IBOutlet NSButton *_cancelBtn; 00039 IBOutlet NSButton *_dontHyphenBtn; 00040 IBOutlet NSBox *_indentationBox; 00041 IBOutlet NSFormCell *_indentLeftFormCell; 00042 IBOutlet NSFormCell *_indentRightFormCell; 00043 IBOutlet NSButton *_keepNextBtn; 00044 IBOutlet NSButton *_keepsLinesBtn; 00045 IBOutlet NSTextField *_lineSpacingLabel; 00046 IBOutlet NSPopUpButton *_lineSpacingPopup; 00047 IBOutlet NSTabView *_mainTab; 00048 IBOutlet NSButton *_okBtn; 00049 IBOutlet NSButton *_pageBreakBtn; 00050 IBOutlet NSBox *_paginationBox; 00051 IBOutlet XAP_CocoaNSView *_preview; 00052 IBOutlet NSBox *_previewBox; 00053 IBOutlet NSButton *_rtlDominantBtn; 00054 IBOutlet NSFormCell *_spacingAfterFormCell; 00055 IBOutlet NSFormCell *_spacingBeforeFormCell; 00056 IBOutlet NSBox *_spacingBox; 00057 IBOutlet NSTextField *_specialLabel; 00058 IBOutlet NSPopUpButton *_specialPopup; 00059 IBOutlet NSButton *_suppressLineNumBtn; 00060 IBOutlet NSButton *_tabsBtn; 00061 IBOutlet NSButton *_widowOrphanBtn; 00062 AP_CocoaDialog_Paragraph* _xap; 00063 } 00064 - (IBAction)cancelAction:(id)sender; 00065 - (IBAction)okAction:(id)sender; 00066 - (IBAction)tabAction:(id)sender; 00067 - (IBAction)checkBoxAction:(id)sender; 00068 - (IBAction)menuAction:(id)sender; 00069 - (IBAction)editAction:(id)sender; 00070 - (NSPopUpButton*)specialPopup; 00071 - (NSPopUpButton*)lineSpacingPopup; 00072 - (NSPopUpButton*)alignmentPopup; 00073 - (XAP_CocoaNSView*)preview; 00074 - (id)_getWidget:(AP_Dialog_Paragraph::tControl) widget; 00075 @end 00076 00077 /*****************************************************************/ 00078 00079 class AP_CocoaDialog_Paragraph: public AP_Dialog_Paragraph 00080 { 00081 public: 00082 AP_CocoaDialog_Paragraph(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00083 virtual ~AP_CocoaDialog_Paragraph(void); 00084 00085 virtual void runModal(XAP_Frame * pFrame); 00086 00087 static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id); 00088 00089 // callbacks can fire these events 00090 virtual void event_OK(void); 00091 virtual void event_Cancel(void); 00092 virtual void event_Tabs(void); 00093 virtual void event_MenuChanged(id sender); 00094 virtual void event_EditChanged(id sender); 00095 virtual void event_CheckToggled(id sender); 00096 virtual void event_PreviewAreaExposed(void); 00097 00098 #if 0 00099 // all data controls are of three types in this dialog; the static 00100 // functions pass in widget pointers which are mapped into 00101 // base class "tControl" IDs for data operations. 00102 00103 // menus take a "changed" event 00104 00105 // spin buttons can take "increment", "decrement", and "changed" 00106 virtual void event_SpinIncrement(GtkWidget * widget); 00107 virtual void event_SpinDecrement(GtkWidget * widget); 00108 virtual void event_SpinFocusOut(GtkWidget * widget); 00109 00110 // checks are just "toggled" 00111 00112 // Preview 00113 #endif 00114 void _createGC(XAP_CocoaNSView* owner); 00115 void _deleteGC(void); 00116 protected: 00117 00118 GR_CocoaCairoGraphics * m_pGraphics; 00119 00120 void _populateWindowData(void); 00121 00122 virtual void _syncControls(tControl changed, bool bAll = false); 00123 private: 00124 int _tCheckStateToNS(AP_CocoaDialog_Paragraph::tCheckState x); 00125 id _getWidget(AP_Dialog_Paragraph::tControl widget) 00126 { 00127 return [m_dlg _getWidget:widget]; 00128 }; 00129 00130 AP_CocoaDialog_ParagraphController* m_dlg; 00131 }; 00132 00133 #endif /* XAP_COCOADIALOG_PARAGRAPH_H */