00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiWord 00004 * Copyright (C) 2000 AbiSource, Inc. 00005 * Copyright (C) 2001, 2003-2005 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., 51 Franklin Street, Fifth Floor, Boston, MA 00020 * 02110-1301 USA. 00021 */ 00022 00023 #ifndef AP_COCOADIALOG_WORDCOUNT_H 00024 #define AP_COCOADIALOG_WORDCOUNT_H 00025 00026 #import <Cocoa/Cocoa.h> 00027 00028 #include "xap_CocoaDialog_Utilities.h" 00029 #include "xap_CocoaWidget.h" 00030 00031 #include "ap_Dialog_WordCount.h" 00032 00033 class UT_Timer; 00034 00035 class AP_CocoaDialog_WordCount; 00036 00037 @interface AP_CocoaDialog_WordCountController : NSWindowController <XAP_CocoaDialogProtocol> 00038 { 00039 IBOutlet NSTextField *_titleLabel; 00040 IBOutlet NSTextField *_charNoSpaceCount; 00041 IBOutlet NSTextField *_charNoSpaceLabel; 00042 IBOutlet NSTextField *_charSpaceCount; 00043 IBOutlet NSTextField *_charSpaceLabel; 00044 IBOutlet NSTextField *_linesCount; 00045 IBOutlet NSTextField *_linesLabel; 00046 IBOutlet NSTextField *_pageCount; 00047 IBOutlet NSTextField *_pageLabel; 00048 IBOutlet NSTextField *_paraCount; 00049 IBOutlet NSTextField *_paraLabel; 00050 IBOutlet NSTextField *_wordCount; 00051 IBOutlet NSTextField *_wordLabel; 00052 IBOutlet NSTextField *_wordNoFNCount; 00053 IBOutlet NSTextField *_wordNoFNLabel; 00054 00055 AP_CocoaDialog_WordCount * _xap; 00056 } 00057 - (XAP_CocoaWidget *)getWidget:(int)wid; 00058 @end 00059 00060 /*****************************************************************/ 00061 00062 class AP_CocoaDialog_WordCount: public AP_Dialog_WordCount 00063 { 00064 public: 00065 AP_CocoaDialog_WordCount(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id dlgid); 00066 virtual ~AP_CocoaDialog_WordCount(void); 00067 00068 virtual void runModeless(XAP_Frame * pFrame); 00069 virtual void destroy(void); 00070 virtual void activate(void); 00071 virtual void notifyActiveFrame(XAP_Frame *pFrame); 00072 00073 static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id dlgid); 00074 static void autoupdateWC(UT_Worker * pTimer); 00075 // callbacks can fire these events 00076 00077 virtual void event_Update(void); 00078 void event_CloseWindow(void); 00079 protected: 00080 virtual XAP_Widget *getWidget(xap_widget_id wid) 00081 { 00082 return [m_dlg getWidget:((int) wid)]; 00083 } 00084 00085 private: 00086 UT_Timer * m_pAutoUpdateWC; 00087 00088 // Handshake variables 00089 bool m_bDestroy_says_stopupdating; 00090 bool m_bAutoUpdate_happening_now; 00091 AP_CocoaDialog_WordCountController* m_dlg; 00092 }; 00093 00094 #endif /* AP_COCOADIALOG_WORDCOUNT_H */ 00095 00096 00097 00098 00099 00100 00101 00102