• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

xap_CocoaDlg_FontChooser.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiSource Application Framework
00004  * Copyright (C) 1998 AbiSource, Inc.
00005  * Copyright (C) 2001-2003, 2009 Hubert Figuiere
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 #ifndef XAP_COCOADIALOG_FONTCHOOSER_H
00024 #define XAP_COCOADIALOG_FONTCHOOSER_H
00025 
00026 #import <Cocoa/Cocoa.h>
00027 #include "xap_App.h"
00028 #include "xap_Dlg_FontChooser.h"
00029 #include "ut_misc.h"
00030 
00031 #import "xap_CocoaDialog_Utilities.h"
00032 #import "xap_Cocoa_NSTableUtils.h"
00033 #import "xap_CocoaFrame.h"
00034 
00035 class GR_CocoaGraphics;
00036 class XAP_CocoaDialog_FontChooser;
00037 
00038 @interface XAP_CocoaDialog_FontChooserController : NSWindowController <XAP_CocoaDialogProtocol>
00039 {
00040     IBOutlet NSTableView *      _fontList;
00041     IBOutlet NSTableView *      _styleList;
00042     IBOutlet NSTableView *      _sizeList;
00043 
00044     IBOutlet NSTextField *      _fontLabel;
00045     IBOutlet NSTextField *      _styleLabel;
00046     IBOutlet NSTextField *      _sizeLabel;
00047     IBOutlet NSBox *            _effectLabel;
00048     IBOutlet NSBox *            _textColorLabel;
00049     IBOutlet NSBox *            _textHighlightColorLabel;
00050 
00051     IBOutlet NSButton *         _okBtn;
00052     IBOutlet NSButton *         _cancelBtn;
00053     IBOutlet NSButton *         _strikeButton;
00054     IBOutlet NSButton *         _underlineButton;
00055     IBOutlet NSButton *         _overlineButton;
00056     IBOutlet NSButton *         _hiddenButton;
00057     IBOutlet NSButton *         _superscriptButton;
00058     IBOutlet NSButton *         _subscriptButton;
00059     IBOutlet NSButton *         _noHighlightColorButton;
00060 
00061     IBOutlet NSColorWell *      _textColorWell;
00062     IBOutlet NSColorWell *      _textHighlightColorWell;
00063 
00064     IBOutlet XAP_CocoaNSView *  _preview;
00065 
00066     IBOutlet NSBox *            _previewBox;
00067 
00068     XAP_StringListDataSource *  m_fontDataSource;
00069     XAP_StringListDataSource *  m_sizeDataSource;
00070     XAP_StringListDataSource *  m_stylesDataSource;
00071 
00072     XAP_CocoaDialog_FontChooser *   _xap;
00073 }
00074 
00075 -(IBAction)okAction:(id)sender;
00076 -(IBAction)cancelAction:(id)sender;
00077 -(IBAction)colorWellAction:(id)sender;
00078 -(IBAction)underlineAction:(id)sender;
00079 -(IBAction)overlineAction:(id)sender;
00080 -(IBAction)strikeoutAction:(id)sender;
00081 -(IBAction)superscriptAction:(id)sender;
00082 -(IBAction)subscriptAction:(id)sender;
00083 -(IBAction)transparentAction:(id)sender;        // = no higlight color ?
00084 
00085 - (void)tableViewSelectionDidChange:(NSNotification *)aNotification;
00086 
00087 - (XAP_CocoaNSView*)preview;
00088 /* accessors */
00089 -(void)setStrikeout:(bool)value;
00090 -(void)setUnderline:(bool)value;
00091 -(void)setOverline:(bool)value;
00092 -(void)setSuperscript:(bool)value;
00093 -(void)setSubscript:(bool)value;
00094 
00095 -(void)selectFont:(char*)value;
00096 -(NSString*)selectedFont;
00097 -(void)selectSize:(char*)value;
00098 -(NSString*)selectedSize;
00099 -(void)selectStyle:(char*)style withWeight:(char*)weight;
00100 
00101 -(NSColor*)textColor;
00102 -(void)setTextColor:(NSColor*)color;
00103 -(NSColor*)bgColor;
00104 -(void)setBgColor:(NSColor*)color;
00105 
00106 @end
00107 
00108 /*****************************************************************/
00109 
00110 class XAP_CocoaDialog_FontChooser : public XAP_Dialog_FontChooser
00111 {
00112 public:
00113     XAP_CocoaDialog_FontChooser(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00114     virtual ~XAP_CocoaDialog_FontChooser(void);
00115 
00116     virtual void            runModal(XAP_Frame * pFrame);
00117 
00118     static XAP_Dialog *     static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
00119     void                    underlineChanged(bool);
00120     void                    overlineChanged(bool);
00121     void                    strikeoutChanged(bool);
00122     void                    superscriptChanged(bool);
00123     void                    subscriptChanged(bool);
00124     void                    transparencyChanged(bool);
00125     void                    updatePreview(void);
00126     void                    fontRowChanged(void);
00127     void                    styleRowChanged(int);
00128     void                    sizeRowChanged(void);
00129     void                    fgColorChanged(void);
00130     void                    bgColorChanged(void);
00131 
00132     // the state of what data is hidden and what is public is
00133     // pretty grave here.
00134     bool                    getEntryString(const char ** string);
00135 
00136     /* GUI actions */
00137     void _okAction(void);
00138     void _cancelAction(void);
00139 
00140     /* GUI creation */
00141     void                _createGC(XAP_CocoaNSView* owner);
00142     void                _deleteGC(void);
00143 
00144 private:
00145     bool        m_bSuperScriptInitialValue;
00146     bool        m_bSubScriptInitialValue;
00147 
00148     void _colorChanged(NSColor* color, const gchar* attr, char* buf);
00149 
00150     gchar * m_currentFamily;
00151     XAP_CocoaDialog_FontChooserController*  m_dlg;
00152 };
00153 
00154 
00155 #endif /* XAP_COCOADIALOG_FONTCHOOSER_H */

Generated on Mon May 28 2012 for AbiWord by  doxygen 1.7.1