| 1 |
/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ |
| 2 |
|
| 3 |
/* AbiSource Application Framework |
| 4 |
* Copyright (C) 1998 AbiSource, Inc. |
| 5 |
* Copyright (C) 2001-2003, 2009 Hubert Figuiere |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or |
| 8 |
* modify it under the terms of the GNU General Public License |
| 9 |
* as published by the Free Software Foundation; either version 2 |
| 10 |
* of the License, or (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 20 |
* 02110-1301 USA. |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef XAP_COCOADIALOG_FONTCHOOSER_H |
| 24 |
#define XAP_COCOADIALOG_FONTCHOOSER_H |
| 25 |
|
| 26 |
#import <Cocoa/Cocoa.h> |
| 27 |
#include "xap_App.h" |
| 28 |
#include "xap_Dlg_FontChooser.h" |
| 29 |
#include "ut_misc.h" |
| 30 |
|
| 31 |
#import "xap_CocoaDialog_Utilities.h" |
| 32 |
#import "xap_Cocoa_NSTableUtils.h" |
| 33 |
#import "xap_CocoaFrame.h" |
| 34 |
|
| 35 |
class GR_CocoaGraphics; |
| 36 |
class XAP_CocoaDialog_FontChooser; |
| 37 |
|
| 38 |
@interface XAP_CocoaDialog_FontChooserController : NSWindowController <XAP_CocoaDialogProtocol> |
| 39 |
{ |
| 40 |
IBOutlet NSTableView * _fontList; |
| 41 |
IBOutlet NSTableView * _styleList; |
| 42 |
IBOutlet NSTableView * _sizeList; |
| 43 |
|
| 44 |
IBOutlet NSTextField * _fontLabel; |
| 45 |
IBOutlet NSTextField * _styleLabel; |
| 46 |
IBOutlet NSTextField * _sizeLabel; |
| 47 |
IBOutlet NSBox * _effectLabel; |
| 48 |
IBOutlet NSBox * _textColorLabel; |
| 49 |
IBOutlet NSBox * _textHighlightColorLabel; |
| 50 |
|
| 51 |
IBOutlet NSButton * _okBtn; |
| 52 |
IBOutlet NSButton * _cancelBtn; |
| 53 |
IBOutlet NSButton * _strikeButton; |
| 54 |
IBOutlet NSButton * _underlineButton; |
| 55 |
IBOutlet NSButton * _overlineButton; |
| 56 |
IBOutlet NSButton * _hiddenButton; |
| 57 |
IBOutlet NSButton * _superscriptButton; |
| 58 |
IBOutlet NSButton * _subscriptButton; |
| 59 |
IBOutlet NSButton * _noHighlightColorButton; |
| 60 |
|
| 61 |
IBOutlet NSColorWell * _textColorWell; |
| 62 |
IBOutlet NSColorWell * _textHighlightColorWell; |
| 63 |
|
| 64 |
IBOutlet XAP_CocoaNSView * _preview; |
| 65 |
|
| 66 |
IBOutlet NSBox * _previewBox; |
| 67 |
|
| 68 |
XAP_StringListDataSource * m_fontDataSource; |
| 69 |
XAP_StringListDataSource * m_sizeDataSource; |
| 70 |
XAP_StringListDataSource * m_stylesDataSource; |
| 71 |
|
| 72 |
XAP_CocoaDialog_FontChooser * _xap; |
| 73 |
} |
| 74 |
|
| 75 |
-(IBAction)okAction:(id)sender; |
| 76 |
-(IBAction)cancelAction:(id)sender; |
| 77 |
-(IBAction)colorWellAction:(id)sender; |
| 78 |
-(IBAction)underlineAction:(id)sender; |
| 79 |
-(IBAction)overlineAction:(id)sender; |
| 80 |
-(IBAction)strikeoutAction:(id)sender; |
| 81 |
-(IBAction)superscriptAction:(id)sender; |
| 82 |
-(IBAction)subscriptAction:(id)sender; |
| 83 |
-(IBAction)transparentAction:(id)sender; // = no higlight color ? |
| 84 |
|
| 85 |
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification; |
| 86 |
|
| 87 |
- (XAP_CocoaNSView*)preview; |
| 88 |
/* accessors */ |
| 89 |
-(void)setStrikeout:(bool)value; |
| 90 |
-(void)setUnderline:(bool)value; |
| 91 |
-(void)setOverline:(bool)value; |
| 92 |
-(void)setSuperscript:(bool)value; |
| 93 |
-(void)setSubscript:(bool)value; |
| 94 |
|
| 95 |
-(void)selectFont:(char*)value; |
| 96 |
-(NSString*)selectedFont; |
| 97 |
-(void)selectSize:(char*)value; |
| 98 |
-(NSString*)selectedSize; |
| 99 |
-(void)selectStyle:(char*)style withWeight:(char*)weight; |
| 100 |
|
| 101 |
-(NSColor*)textColor; |
| 102 |
-(void)setTextColor:(NSColor*)color; |
| 103 |
-(NSColor*)bgColor; |
| 104 |
-(void)setBgColor:(NSColor*)color; |
| 105 |
|
| 106 |
@end |
| 107 |
|
| 108 |
/*****************************************************************/ |
| 109 |
|
| 110 |
class XAP_CocoaDialog_FontChooser : public XAP_Dialog_FontChooser |
| 111 |
{ |
| 112 |
public: |
| 113 |
XAP_CocoaDialog_FontChooser(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); |
| 114 |
virtual ~XAP_CocoaDialog_FontChooser(void); |
| 115 |
|
| 116 |
virtual void runModal(XAP_Frame * pFrame); |
| 117 |
|
| 118 |
static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id); |
| 119 |
void underlineChanged(bool); |
| 120 |
void overlineChanged(bool); |
| 121 |
void strikeoutChanged(bool); |
| 122 |
void superscriptChanged(bool); |
| 123 |
void subscriptChanged(bool); |
| 124 |
void transparencyChanged(bool); |
| 125 |
void updatePreview(void); |
| 126 |
void fontRowChanged(void); |
| 127 |
void styleRowChanged(int); |
| 128 |
void sizeRowChanged(void); |
| 129 |
void fgColorChanged(void); |
| 130 |
void bgColorChanged(void); |
| 131 |
|
| 132 |
// the state of what data is hidden and what is public is |
| 133 |
// pretty grave here. |
| 134 |
bool getEntryString(const char ** string); |
| 135 |
|
| 136 |
/* GUI actions */ |
| 137 |
void _okAction(void); |
| 138 |
void _cancelAction(void); |
| 139 |
|
| 140 |
/* GUI creation */ |
| 141 |
void _createGC(XAP_CocoaNSView* owner); |
| 142 |
void _deleteGC(void); |
| 143 |
|
| 144 |
private: |
| 145 |
bool m_bSuperScriptInitialValue; |
| 146 |
bool m_bSubScriptInitialValue; |
| 147 |
|
| 148 |
void _colorChanged(NSColor* color, const gchar* attr, char* buf); |
| 149 |
|
| 150 |
gchar * m_currentFamily; |
| 151 |
XAP_CocoaDialog_FontChooserController* m_dlg; |
| 152 |
}; |
| 153 |
|
| 154 |
|
| 155 |
#endif /* XAP_COCOADIALOG_FONTCHOOSER_H */ |