From 4faed08751b0f6037e4b6ddae54a2c8e28b3e5e0 Mon Sep 17 00:00:00 2001 From: GNUstep Maintainer Date: Thu, 30 May 1996 20:03:15 +0000 Subject: [PATCH] Initial revision git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@1580 72102866-910b-0410-8b05-ffd578937521 --- ANNOUNCE | 83 ++ COPYING | 339 ++++++ COPYING.LIB | 481 ++++++++ ChangeLog | 15 + Headers/gnustep/dps/DPSOperators.h | 133 ++ Headers/gnustep/dps/NSDPSContext.h | 163 +++ Headers/gnustep/dps/TypesandConstants.h | 94 ++ Headers/gnustep/gui/AppKit.h | 148 +++ Headers/gnustep/gui/Functions.h | 251 ++++ Headers/gnustep/gui/LogFile.h | 75 ++ Headers/gnustep/gui/NSActionCell.h | 98 ++ Headers/gnustep/gui/NSApplication.h | 259 ++++ Headers/gnustep/gui/NSBitmapImageRep.h | 110 ++ Headers/gnustep/gui/NSBox.h | 91 ++ Headers/gnustep/gui/NSBrowser.h | 219 ++++ Headers/gnustep/gui/NSBrowserCell.h | 78 ++ Headers/gnustep/gui/NSBundle.h | 50 + Headers/gnustep/gui/NSButton.h | 123 ++ Headers/gnustep/gui/NSButtonCell.h | 119 ++ Headers/gnustep/gui/NSCachedImageRep.h | 69 ++ Headers/gnustep/gui/NSCell.h | 274 +++++ Headers/gnustep/gui/NSClipView.h | 88 ++ Headers/gnustep/gui/NSColor.h | 205 ++++ Headers/gnustep/gui/NSColorList.h | 93 ++ Headers/gnustep/gui/NSColorPanel.h | 91 ++ Headers/gnustep/gui/NSColorPicker.h | 82 ++ Headers/gnustep/gui/NSColorWell.h | 77 ++ Headers/gnustep/gui/NSControl.h | 171 +++ Headers/gnustep/gui/NSCursor.h | 90 ++ Headers/gnustep/gui/NSCustomImageRep.h | 61 + Headers/gnustep/gui/NSDataLink.h | 107 ++ Headers/gnustep/gui/NSDataLinkManager.h | 129 ++ Headers/gnustep/gui/NSDataLinkPanel.h | 89 ++ Headers/gnustep/gui/NSEPSImageRep.h | 70 ++ Headers/gnustep/gui/NSEvent.h | 182 +++ Headers/gnustep/gui/NSFont.h | 109 ++ Headers/gnustep/gui/NSFontManager.h | 122 ++ Headers/gnustep/gui/NSFontPanel.h | 80 ++ Headers/gnustep/gui/NSForm.h | 105 ++ Headers/gnustep/gui/NSFormCell.h | 86 ++ Headers/gnustep/gui/NSHelpPanel.h | 87 ++ Headers/gnustep/gui/NSImage.h | 171 +++ Headers/gnustep/gui/NSImageRep.h | 109 ++ Headers/gnustep/gui/NSMatrix.h | 281 +++++ Headers/gnustep/gui/NSMenu.h | 112 ++ Headers/gnustep/gui/NSMenuCell.h | 80 ++ Headers/gnustep/gui/NSOpenPanel.h | 84 ++ Headers/gnustep/gui/NSPageLayout.h | 87 ++ Headers/gnustep/gui/NSPanel.h | 62 + Headers/gnustep/gui/NSPasteboard.h | 104 ++ Headers/gnustep/gui/NSPopUpButton.h | 128 ++ Headers/gnustep/gui/NSPrintInfo.h | 119 ++ Headers/gnustep/gui/NSPrintOperation.h | 123 ++ Headers/gnustep/gui/NSPrintPanel.h | 81 ++ Headers/gnustep/gui/NSPrinter.h | 99 ++ Headers/gnustep/gui/NSResponder.h | 103 ++ Headers/gnustep/gui/NSSavePanel.h | 133 ++ Headers/gnustep/gui/NSScreen.h | 59 + Headers/gnustep/gui/NSScrollView.h | 112 ++ Headers/gnustep/gui/NSScroller.h | 96 ++ Headers/gnustep/gui/NSSelection.h | 77 ++ Headers/gnustep/gui/NSSlider.h | 89 ++ Headers/gnustep/gui/NSSliderCell.h | 112 ++ Headers/gnustep/gui/NSSpellChecker.h | 94 ++ Headers/gnustep/gui/NSSpellServer.h | 86 ++ Headers/gnustep/gui/NSSplitView.h | 77 ++ Headers/gnustep/gui/NSText.h | 202 ++++ Headers/gnustep/gui/NSTextField.h | 114 ++ Headers/gnustep/gui/NSTextFieldCell.h | 77 ++ Headers/gnustep/gui/NSView.h | 315 +++++ Headers/gnustep/gui/NSWindow.h | 367 ++++++ Headers/gnustep/gui/NSWorkspace.h | 149 +++ Headers/gnustep/gui/TrackingRectangle.h | 69 ++ Headers/gnustep/gui/TypesandConstants.h | 1132 +++++++++++++++++ Headers/gnustep/gui/config.h.in | 45 + Headers/gnustep/gui/config.sed.nt | 2 + Headers/gnustep/gui/stdappkit.h | 39 + INSTALL | 183 +++ Makefile.in | 112 ++ Makefile.sed.nt | 37 + NEWS | 21 + README | 32 + Source/Functions.m | 442 +++++++ Source/LogFile.m | 130 ++ Source/Makefile.in | 313 +++++ Source/Makefile.sed.nt | 27 + Source/NSActionCell.m | 246 ++++ Source/NSApplication.m | 1014 ++++++++++++++++ Source/NSBitmapImageRep.m | 206 ++++ Source/NSBox.m | 244 ++++ Source/NSBrowser.m | 469 ++++++++ Source/NSBrowserCell.m | 121 ++ Source/NSButton.m | 346 ++++++ Source/NSButtonCell.m | 282 +++++ Source/NSCachedImageRep.m | 92 ++ Source/NSCell.m | 789 ++++++++++++ Source/NSClipView.m | 135 +++ Source/NSColor.m | 507 ++++++++ Source/NSColorList.m | 150 +++ Source/NSColorPanel.m | 167 +++ Source/NSColorPicker.m | 101 ++ Source/NSColorWell.m | 111 ++ Source/NSControl.m | 429 +++++++ Source/NSCursor.m | 160 +++ Source/NSCustomImageRep.m | 85 ++ Source/NSDPSContext.m | 344 ++++++ Source/NSDataLink.m | 203 ++++ Source/NSDataLinkManager.m | 252 ++++ Source/NSDataLinkPanel.m | 129 ++ Source/NSEPSImageRep.m | 100 ++ Source/NSEvent.m | 585 +++++++++ Source/NSFont.m | 294 +++++ Source/NSFontManager.m | 338 ++++++ Source/NSFontPanel.m | 135 +++ Source/NSForm.m | 141 +++ Source/NSFormCell.m | 121 ++ Source/NSHelpPanel.m | 130 ++ Source/NSImage.m | 315 +++++ Source/NSImageRep.m | 233 ++++ Source/NSMatrix.m | 1465 +++++++++++++++++++++++ Source/NSMenu.m | 233 ++++ Source/NSMenuCell.m | 154 +++ Source/NSOpenPanel.m | 232 ++++ Source/NSPageLayout.m | 131 ++ Source/NSPanel.m | 101 ++ Source/NSPasteboard.m | 218 ++++ Source/NSPopUpButton.m | 327 +++++ Source/NSPrintInfo.m | 233 ++++ Source/NSPrintOperation.m | 209 ++++ Source/NSPrintPanel.m | 114 ++ Source/NSPrinter.m | 248 ++++ Source/NSResponder.m | 258 ++++ Source/NSSavePanel.m | 277 +++++ Source/NSScreen.m | 94 ++ Source/NSScrollView.m | 209 ++++ Source/NSScroller.m | 177 +++ Source/NSSelection.m | 124 ++ Source/NSSlider.m | 213 ++++ Source/NSSliderCell.m | 297 +++++ Source/NSSpellChecker.m | 154 +++ Source/NSSpellServer.m | 116 ++ Source/NSSplitView.m | 113 ++ Source/NSText.m | 578 +++++++++ Source/NSTextField.m | 426 +++++++ Source/NSTextFieldCell.m | 207 ++++ Source/NSView.m | 981 +++++++++++++++ Source/NSWindow.m | 1297 ++++++++++++++++++++ Source/NSWorkspace.m | 274 +++++ Source/TrackingRectangle.m | 121 ++ Source/libgnustep-gui.m | 60 + Testing/Makefile.in | 138 +++ Testing/Makefile.sed.nt | 13 + Testing/nsarchiver.dat | Bin 0 -> 188 bytes Testing/nsarchiver.m | 111 ++ Version | 15 + aclocal.m4 | 146 +++ config.guess | 348 ++++++ configure | 1004 ++++++++++++++++ configure.bat | 34 + configure.in | 55 + install-sh | 119 ++ mkinstalldirs | 35 + 162 files changed, 32515 insertions(+) create mode 100644 ANNOUNCE create mode 100644 COPYING create mode 100644 COPYING.LIB create mode 100644 ChangeLog create mode 100644 Headers/gnustep/dps/DPSOperators.h create mode 100644 Headers/gnustep/dps/NSDPSContext.h create mode 100644 Headers/gnustep/dps/TypesandConstants.h create mode 100644 Headers/gnustep/gui/AppKit.h create mode 100644 Headers/gnustep/gui/Functions.h create mode 100644 Headers/gnustep/gui/LogFile.h create mode 100644 Headers/gnustep/gui/NSActionCell.h create mode 100644 Headers/gnustep/gui/NSApplication.h create mode 100644 Headers/gnustep/gui/NSBitmapImageRep.h create mode 100644 Headers/gnustep/gui/NSBox.h create mode 100644 Headers/gnustep/gui/NSBrowser.h create mode 100644 Headers/gnustep/gui/NSBrowserCell.h create mode 100644 Headers/gnustep/gui/NSBundle.h create mode 100644 Headers/gnustep/gui/NSButton.h create mode 100644 Headers/gnustep/gui/NSButtonCell.h create mode 100644 Headers/gnustep/gui/NSCachedImageRep.h create mode 100644 Headers/gnustep/gui/NSCell.h create mode 100644 Headers/gnustep/gui/NSClipView.h create mode 100644 Headers/gnustep/gui/NSColor.h create mode 100644 Headers/gnustep/gui/NSColorList.h create mode 100644 Headers/gnustep/gui/NSColorPanel.h create mode 100644 Headers/gnustep/gui/NSColorPicker.h create mode 100644 Headers/gnustep/gui/NSColorWell.h create mode 100644 Headers/gnustep/gui/NSControl.h create mode 100644 Headers/gnustep/gui/NSCursor.h create mode 100644 Headers/gnustep/gui/NSCustomImageRep.h create mode 100644 Headers/gnustep/gui/NSDataLink.h create mode 100644 Headers/gnustep/gui/NSDataLinkManager.h create mode 100644 Headers/gnustep/gui/NSDataLinkPanel.h create mode 100644 Headers/gnustep/gui/NSEPSImageRep.h create mode 100644 Headers/gnustep/gui/NSEvent.h create mode 100644 Headers/gnustep/gui/NSFont.h create mode 100644 Headers/gnustep/gui/NSFontManager.h create mode 100644 Headers/gnustep/gui/NSFontPanel.h create mode 100644 Headers/gnustep/gui/NSForm.h create mode 100644 Headers/gnustep/gui/NSFormCell.h create mode 100644 Headers/gnustep/gui/NSHelpPanel.h create mode 100644 Headers/gnustep/gui/NSImage.h create mode 100644 Headers/gnustep/gui/NSImageRep.h create mode 100644 Headers/gnustep/gui/NSMatrix.h create mode 100644 Headers/gnustep/gui/NSMenu.h create mode 100644 Headers/gnustep/gui/NSMenuCell.h create mode 100644 Headers/gnustep/gui/NSOpenPanel.h create mode 100644 Headers/gnustep/gui/NSPageLayout.h create mode 100644 Headers/gnustep/gui/NSPanel.h create mode 100644 Headers/gnustep/gui/NSPasteboard.h create mode 100644 Headers/gnustep/gui/NSPopUpButton.h create mode 100644 Headers/gnustep/gui/NSPrintInfo.h create mode 100644 Headers/gnustep/gui/NSPrintOperation.h create mode 100644 Headers/gnustep/gui/NSPrintPanel.h create mode 100644 Headers/gnustep/gui/NSPrinter.h create mode 100644 Headers/gnustep/gui/NSResponder.h create mode 100644 Headers/gnustep/gui/NSSavePanel.h create mode 100644 Headers/gnustep/gui/NSScreen.h create mode 100644 Headers/gnustep/gui/NSScrollView.h create mode 100644 Headers/gnustep/gui/NSScroller.h create mode 100644 Headers/gnustep/gui/NSSelection.h create mode 100644 Headers/gnustep/gui/NSSlider.h create mode 100644 Headers/gnustep/gui/NSSliderCell.h create mode 100644 Headers/gnustep/gui/NSSpellChecker.h create mode 100644 Headers/gnustep/gui/NSSpellServer.h create mode 100644 Headers/gnustep/gui/NSSplitView.h create mode 100644 Headers/gnustep/gui/NSText.h create mode 100644 Headers/gnustep/gui/NSTextField.h create mode 100644 Headers/gnustep/gui/NSTextFieldCell.h create mode 100644 Headers/gnustep/gui/NSView.h create mode 100644 Headers/gnustep/gui/NSWindow.h create mode 100644 Headers/gnustep/gui/NSWorkspace.h create mode 100644 Headers/gnustep/gui/TrackingRectangle.h create mode 100644 Headers/gnustep/gui/TypesandConstants.h create mode 100644 Headers/gnustep/gui/config.h.in create mode 100644 Headers/gnustep/gui/config.sed.nt create mode 100644 Headers/gnustep/gui/stdappkit.h create mode 100644 INSTALL create mode 100644 Makefile.in create mode 100644 Makefile.sed.nt create mode 100644 NEWS create mode 100644 README create mode 100644 Source/Functions.m create mode 100644 Source/LogFile.m create mode 100644 Source/Makefile.in create mode 100644 Source/Makefile.sed.nt create mode 100644 Source/NSActionCell.m create mode 100644 Source/NSApplication.m create mode 100644 Source/NSBitmapImageRep.m create mode 100644 Source/NSBox.m create mode 100644 Source/NSBrowser.m create mode 100644 Source/NSBrowserCell.m create mode 100644 Source/NSButton.m create mode 100644 Source/NSButtonCell.m create mode 100644 Source/NSCachedImageRep.m create mode 100644 Source/NSCell.m create mode 100644 Source/NSClipView.m create mode 100644 Source/NSColor.m create mode 100644 Source/NSColorList.m create mode 100644 Source/NSColorPanel.m create mode 100644 Source/NSColorPicker.m create mode 100644 Source/NSColorWell.m create mode 100644 Source/NSControl.m create mode 100644 Source/NSCursor.m create mode 100644 Source/NSCustomImageRep.m create mode 100644 Source/NSDPSContext.m create mode 100644 Source/NSDataLink.m create mode 100644 Source/NSDataLinkManager.m create mode 100644 Source/NSDataLinkPanel.m create mode 100644 Source/NSEPSImageRep.m create mode 100644 Source/NSEvent.m create mode 100644 Source/NSFont.m create mode 100644 Source/NSFontManager.m create mode 100644 Source/NSFontPanel.m create mode 100644 Source/NSForm.m create mode 100644 Source/NSFormCell.m create mode 100644 Source/NSHelpPanel.m create mode 100644 Source/NSImage.m create mode 100644 Source/NSImageRep.m create mode 100644 Source/NSMatrix.m create mode 100644 Source/NSMenu.m create mode 100644 Source/NSMenuCell.m create mode 100644 Source/NSOpenPanel.m create mode 100644 Source/NSPageLayout.m create mode 100644 Source/NSPanel.m create mode 100644 Source/NSPasteboard.m create mode 100644 Source/NSPopUpButton.m create mode 100644 Source/NSPrintInfo.m create mode 100644 Source/NSPrintOperation.m create mode 100644 Source/NSPrintPanel.m create mode 100644 Source/NSPrinter.m create mode 100644 Source/NSResponder.m create mode 100644 Source/NSSavePanel.m create mode 100644 Source/NSScreen.m create mode 100644 Source/NSScrollView.m create mode 100644 Source/NSScroller.m create mode 100644 Source/NSSelection.m create mode 100644 Source/NSSlider.m create mode 100644 Source/NSSliderCell.m create mode 100644 Source/NSSpellChecker.m create mode 100644 Source/NSSpellServer.m create mode 100644 Source/NSSplitView.m create mode 100644 Source/NSText.m create mode 100644 Source/NSTextField.m create mode 100644 Source/NSTextFieldCell.m create mode 100644 Source/NSView.m create mode 100644 Source/NSWindow.m create mode 100644 Source/NSWorkspace.m create mode 100644 Source/TrackingRectangle.m create mode 100644 Source/libgnustep-gui.m create mode 100644 Testing/Makefile.in create mode 100644 Testing/Makefile.sed.nt create mode 100644 Testing/nsarchiver.dat create mode 100644 Testing/nsarchiver.m create mode 100644 Version create mode 100644 aclocal.m4 create mode 100755 config.guess create mode 100755 configure create mode 100644 configure.bat create mode 100644 configure.in create mode 100755 install-sh create mode 100755 mkinstalldirs diff --git a/ANNOUNCE b/ANNOUNCE new file mode 100644 index 000000000..c2844b4c8 --- /dev/null +++ b/ANNOUNCE @@ -0,0 +1,83 @@ +GNUstep GUI Library ANNOUNCE +**************************** + +This is version 0.1.0 of the GNUstep GUI library (libgnustep-gui). + +What is the GNUstep GUI Library? + +It is a library of graphical user interface classes written completely +in the Objective-C language; the classes are based upon the OPENSTEP(tm) +specification as release by NeXT Software, Inc. The library does not +completely conform to the specification and has been +enhanced in a number of ways to take advantage of the GNU system. +These classes include graphical objects such as buttons, text fields, +popup lists, browser lists, and windows; there are also many associated +classes for handling events, colors, fonts, pasteboards and images. + +The design of libgnustep-gui is designed in two parts. The first part is the +front-end component which is independent of platform and display system. +This front-end is combined with a back-end component which handles all of +the display system dependent such as specific calls to X/Windows. This +design allows the GNUstep applications to have the "look and feel" of +the underlying display system without any changes to the application, and +the library can be easily ported to other display systems. + +The GNUstep GUI Library requires the GNU Objective-C compiler, the GNUstep +Base Library, and back-end component like the GNUstep X/DPS GUI Backend. + + +Creators rejoice! +Scott Christley +scottc@net-community.com + +***** + +Check out the GNUstep web site. (http://www.gnustep.org) + +OPENSTEP and NeXT are trademarks of NeXT Software, Inc. (http://www.next.com) + +The GNUstep GUI Library was donated to the Free Software Foundation +by the On-line Community project, contact info@net-community.com about +creating on-line social communities. (http://www.net-community.com) + +***** + +[ Most GNU software is packed using the GNU `gzip' compression program. + Source code is available on most sites distributing GNU software. + + For information on how to order GNU software on tape, floppy or cd-rom, or + printed GNU manuals, check the file etc/ORDERS in the GNU Emacs distribution + or in GNUinfo/ORDERS on prep, or e-mail a request to: gnu@@prep.ai.mit.edu + + By ordering your GNU software from the FSF, you help us continue to + develop more free software. Media revenues are our primary source of + support. Donations to FSF are deductible on US tax returns. + + The above software will soon be at these ftp sites as well. + Please try them before prep.ai.mit.edu as prep is very busy! + + thanx -gnu@prep.ai.mit.edu + + ASIA: ftp.cs.titech.ac.jp, utsun.s.u-tokyo.ac.jp:/ftpsync/prep, + cair.kaist.ac.kr:/pub/gnu, ftp.nectec.or.th:/pub/mirrors/gnu + AUSTRALIA: archie.au:/gnu (archie.oz or archie.oz.au for ACSnet) + AFRICA: ftp.sun.ac.za:/pub/gnu + MIDDLE-EAST: ftp.technion.ac.il:/pub/unsupported/gnu + EUROPE: irisa.irisa.fr:/pub/gnu, ftp.univ-lyon1.fr:pub/gnu, + ftp.mcc.ac.uk, unix.hensa.ac.uk:/pub/uunet/systems/gnu, + src.doc.ic.ac.uk:/gnu, ftp.ieunet.ie:pub/gnu, ftp.eunet.ch, + nic.switch.ch:/mirror/gnu, ftp.informatik.rwth-aachen.de:/pub/gnu, + ftp.informatik.tu-muenchen.de, ftp.win.tue.nl:/pub/gnu, + ftp.funet.fi:/pub/gnu, ftp.denet.dk, ftp.stacken.kth.se, isy.liu.se, + ftp.luth.se:/pub/unix/gnu, ftp.sunet.se:/pub/gnu, archive.eu.net + SOUTH AMERICA: ftp.unicamp.br:/pub/gnu + WESTERN CANADA: ftp.cs.ubc.ca:/mirror2/gnu + USA: wuarchive.wustl.edu:/systems/gnu, labrea.stanford.edu, + ftp.digex.net:/pub/gnu, ftp.kpc.com:/pub/mirror/gnu, f.ms.uky.edu:/pub3/gnu, + jaguar.utah.edu:/gnustuff, ftp.hawaii.edu:/mirrors/gnu, + vixen.cso.uiuc.edu:/gnu, mrcnext.cso.uiuc.edu:/pub/gnu, + ftp.cs.columbia.edu:/archives/gnu/prep, col.hp.com:/mirrors/gnu, + gatekeeper.dec.com:/pub/GNU, ftp.uu.net:/systems/gnu + + + diff --git a/COPYING b/COPYING new file mode 100644 index 000000000..916d1f0f2 --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/COPYING.LIB b/COPYING.LIB new file mode 100644 index 000000000..eb685a5ec --- /dev/null +++ b/COPYING.LIB @@ -0,0 +1,481 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 000000000..388d187c7 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,15 @@ +Tue Feb 13 09:52:02 1996 Scott Christley + + * Headers/AppKit/NSText.h: Removed WIN32 instance variables + +Sun Feb 11 14:17:15 1996 Scott Christley + + * Makefile.in: Changed library name from libAppKit to libgnustep + * Renamed file libAppKit.m to libgnustep.m + * Changed terminology "Application Kit Library" to + "Application Library" to eliminate trademark conflicts with NeXT. + +Thu Feb 8 04:53:45 1996 Scott Christley + + * *.m: Conforms to NSCoding protocol + * *.h: Added NSCoding protocol methods diff --git a/Headers/gnustep/dps/DPSOperators.h b/Headers/gnustep/dps/DPSOperators.h new file mode 100644 index 000000000..f6b076f49 --- /dev/null +++ b/Headers/gnustep/dps/DPSOperators.h @@ -0,0 +1,133 @@ +/* + DPSOperators.h + + Display Postscript operators and functions + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: September, 1995 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_DPSOperators +#define _GNUstep_H_DPSOperators + +#include +#include +#include + +@class NSColor; + +////////////////////////////////////////////////////////////////////////// +// +// Drawing operators +// +// path an arc in counterclockwise direction +void +PSarc(float x, float y, float radius, float angle1, float angle2); + +// path an arc in clockwise direction +void +PSarcn(float x, float y, float radius, float angle1, float angle2); + +// path a Bezier curve +void +PScurveto(float x1, float y1, float x2, float y2, float x3, float y3); + +// path a line +void +PSlineto(float x, float y); + +// set current point +void +PSmoveto(float x, float y); + +// path a Bezier curve relative to current point +void +PSrcurveto(float x1, float y1, float x2, float y2, float x3, float y3); + +// path a line relative to current point +void +PSrlineto(float x, float y); + +// set current point relative to current point +void +PSrmoveto(float x, float y); + +// path a text string +void +PSshow(char *string); + +// +// Path operators +// +// close the path +void +PSclosepath(); + +// start new path +void +PSnewpath(); + +// fill the path +void +PSfill(); + +// stroke the path +void +PSstroke(); + +// +// Graphic state operators +// +// get current line width +float +PScurrentlinewidth(); + +// set current line width +void +PSsetlinewidth(float width); + +// get current point in path +NSPoint +PScurrentpoint(); + +// flush graphic operations +void +PSflushgraphics(); + +// set the color +void +PSsetcolor(NSColor *c); + +// +// Convenience operations +// +// path a rectangle +void +PSrectstroke(float x, float y, float width, float height); + +// path and fill a rectangle +void +PSrectfill(float x, float y, float width, float height); + +#endif /* _GNUstep_H_DPSOperators */ diff --git a/Headers/gnustep/dps/NSDPSContext.h b/Headers/gnustep/dps/NSDPSContext.h new file mode 100644 index 000000000..6c4c75895 --- /dev/null +++ b/Headers/gnustep/dps/NSDPSContext.h @@ -0,0 +1,163 @@ +/* + NSDPSContext.h + + Encapsulation of Display Postscript contexts + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSDPSContext +#define _GNUstep_H_NSDPSContext + +#include +#include +#include + +// +// NSDPSContextNotification +// Circular dependency between protocol and class +// +@class NSDPSContext; +@protocol NSDPSContextNotification + +// +// Synchronizing Application and Display Postscript Server Execution +// +- (void)contextFinishedExecuting:(NSDPSContext *)context; + +@end + +// +// NSDPSContext class interface +// +@interface NSDPSContext : NSObject +{ + // Attributes + NSMutableData *context_data; + BOOL is_screen_context; + DPSErrorProc error_proc; + DPSTextProc text_proc; + NSDPSContext *chained_parent; + NSDPSContext *chained_child; + BOOL is_output_traced; + BOOL is_synchronized; + + // Reserverd for back-end use + void *be_context_reserved; +} + +// +// Initializing a Context +// +- initWithMutableData:(NSMutableData *)data + forDebugging:(BOOL)debug + languageEncoding:(DPSProgramEncoding)langEnc + nameEncoding:(DPSNameEncoding)nameEnc + textProc:(DPSTextProc)tProc + errorProc:(DPSErrorProc)errorProc; + +// +// Testing the Drawing Destination +// +- (BOOL)isDrawingToScreen; + +// +// Accessing Context Data +// +- (NSMutableData *)mutableData; + +// +// Setting and Identifying the Current Context +// ++ (NSDPSContext *)currentContext; ++ (void)setCurrentContext:(NSDPSContext *)context; +- (NSDPSContext *)DPSContext; + +// +// Controlling the Context +// +- (void)flush; +- (void)interruptExecution; +- (void)notifyObjectWhenFinishedExecuting:(id )obj; +- (void)resetCommunication; +- (void)wait; + +// +// Managing Returned Text and Errors +// ++ (NSString *)stringForDPSError:(const DPSBinObjSeqRec *)error; +- (DPSErrorProc)errorProc; +- (void)setErrorProc:(DPSErrorProc)proc; +- (void)setTextProc:(DPSTextProc)proc; +- (DPSTextProc)textProc; + +// +// Sending Raw Data +// +- (void)printFormat:(NSString *)format,...; +- (void)printFormat:(NSString *)format arguments:(va_list)argList; +- (void)writeData:(NSData *)buf; +- (void)writePostScriptWithLanguageEncodingConversion:(NSData *)buf; + +// +// Managing Binary Object Sequences +// +- (void)awaitReturnValues; +- (void)writeBOSArray:(const void *)data + count:(unsigned int)items + ofType:(DPSDefinedType)type; +- (void)writeBOSNumString:(const void *)data + length:(unsigned int)count + ofType:(DPSDefinedType)type + scale:(int)scale; +- (void)writeBOSString:(const void *)data + length:(unsigned int)bytes; +- (void)writeBinaryObjectSequence:(const void *)data + length:(unsigned int)bytes; +- (void)updateNameMap; + +// +// Managing Chained Contexts +// +- (void)chainChildContext:(NSDPSContext *)child; +- (NSDPSContext *)childContext; +- (NSDPSContext *)parentContext; +- (void)unchainContext; + +// +// Debugging Aids +// ++ (BOOL)areAllContextsOutputTraced; ++ (BOOL)areAllContextsSynchronized; ++ (void)setAllContextsOutputTraced:(BOOL)flag; ++ (void)setAllContextsSynchronized:(BOOL)flag; +- (BOOL)isOutputTraced; +- (BOOL)isSynchronized; +- (void)setOutputTraced:(BOOL)flag; +- (void)setSynchronized:(BOOL)flag; + +@end + +#endif /* _GNUstep_H_NSDPSContext */ diff --git a/Headers/gnustep/dps/TypesandConstants.h b/Headers/gnustep/dps/TypesandConstants.h new file mode 100644 index 000000000..6f0b9089f --- /dev/null +++ b/Headers/gnustep/dps/TypesandConstants.h @@ -0,0 +1,94 @@ +/* + TypesandConstants.h + + All of the Type and Constant definitions for Display Postscript + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: September, 1995 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_DPSTypes +#define _GNUstep_H_DPSTypes + +typedef void *DPSProgramEncoding; +typedef void *DPSNameEncoding; +typedef void *DPSTextProc; +typedef void *DPSErrorProc; +typedef void DPSBinObjSeqRec; +typedef unsigned int DPSDefinedType; + +// +// Backing Store Types +// +typedef enum _NSBackingStoreType { + NSBackingStoreRetained, + NSBackingStoreNonretained, + NSBackingStoreBuffered +} NSBackingStoreType; + +// +// Compositing operators +// +typedef enum _NSCompositingOperation { + NSCompositeClear, + NSCompositeCopy, + NSCompositeSourceOver, + NSCompositeSourceIn, + NSCompositeSourceOut, + NSCompositeSourceAtop, + NSCompositeDataOver, + NSCompositeDataIn, + NSCompositeDataOut, + NSCompositeDataAtop, + NSCompositeXOR, + NSCompositePlusDarker, + NSCompositeHighlight, + NSCompositePlusLighter +} NSCompositingOperation; + +// +// Window ordering +// +typedef enum _NSWindowOrderingMode { + NSWindowAbove, + NSWindowBelow, + NSWindowOut +} NSWindowOrderingMode; + +extern NSString *DPSPostscriptErrorException; +extern NSString *DPSNameTooLongException; +extern NSString *DPSResultTagCheckException; +extern NSString *DPSResultTypeCheckException; +extern NSString *DPSInvalidContextException; +extern NSString *DPSSelectException; +extern NSString *DPSConnectionClosedException; +extern NSString *DPSReadException; +extern NSString *DPSWriteException; +extern NSString *DPSInvalidFDException; +extern NSString *DPSInvalidTEException; +extern NSString *DPSInvalidPortException; +extern NSString *DPSOutOfMemoryException; +extern NSString *DPSCantConnectException; + +#endif // _GNUstep_H_DPSTypes diff --git a/Headers/gnustep/gui/AppKit.h b/Headers/gnustep/gui/AppKit.h new file mode 100644 index 000000000..3f490148e --- /dev/null +++ b/Headers/gnustep/gui/AppKit.h @@ -0,0 +1,148 @@ +/* + AppKit.h + + Main include file for GNUstep GUI Library + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_AppKit +#define _GNUstep_H_AppKit + +#include + +// +// System dependent information +// +float MB_SCREEN_MAXWIDTH(); +float MB_SCREEN_MAXHEIGHT(); + +// +// Display Postscript System +// +#include + +// +// Types and Constants for GNUstep GUI Library +// +#include + +// +// GNUstep GUI Library functions +// +#include + +// +// Protocols +// + +// +// Classes +// +@class NSWorkspace; +@class NSResponder, NSApplication, NSScreen; +@class NSWindow, NSPanel, NSView, NSMenu; +@class NSSavePanel, NSOpenPanel, NSHelpPanel; +@class NSClipView, NSScrollView, NSSplitView; +@class NSText; +// Controls +@class NSControl, NSButton, NSTextField, NSScroller, NSBox, NSForm, NSMatrix; +@class NSPopUpButton, NSSlider, NSBrowser, NSForm; +// Cells +@class NSCell, NSActionCell, NSButtonCell, NSTextFieldCell, NSFormCell; +@class NSSliderCell, NSMenuCell, NSBrowserCell, NSFormCell; +@class NSEvent, NSCursor; +@class NSColor, NSColorList, NSColorPanel, NSColorPicker, NSColorWell; +@class NSImage, NSImageRep, NSBitmapImageRep, NSCachedImageRep; +@class NSCustomImageRep, NSEPSImageRep; +@class NSDataLink, NSDataLinkManager, NSDataLinkPanel; +@class NSFont, NSFontManager, NSFontPanel; +@class NSPageLayout, NSPrinter, NSPrintInfo, NSPrintOperation, NSPrintPanel; +@class NSPasteboard, NSSelection; +@class NSSpellChecker, NSSpellServer; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif _GNUstep_H_AppKit diff --git a/Headers/gnustep/gui/Functions.h b/Headers/gnustep/gui/Functions.h new file mode 100644 index 000000000..802a2277b --- /dev/null +++ b/Headers/gnustep/gui/Functions.h @@ -0,0 +1,251 @@ +/* + Functions.h + + Generic functions for the GNUstep GUI Library + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_AppKitFunctions +#define _GNUstep_H_AppKitFunctions + +#include +#include + +@class NSPasteboard, NSColor; + +// +// Rectangle Drawing Functions +// +// +// Optimize Drawing +// +void NSEraseRect(NSRect aRect); +void NSHighlightRect(NSRect aRect); +void NSRectClip(NSRect aRect); +void NSRectClipList(const NSRect *rects, int count); +void NS__RectFill(id self, NSRect aRect); +#define NSRectFill(ARECT) NS__RectFill(self,ARECT) +void NSRectFillList(const NSRect *rects, int count); +void NSRectFillListWithGrays(const NSRect *rects, + const float *grays, int count); + +// +// Draw a Bordered Rectangle +// +void NSDrawButton(NSRect aRect, NSRect clipRect); +void NSDrawGrayBezel(NSRect aRect, NSRect clipRect); +void NSDrawGroove(NSRect aRect, NSRect clipRect); +NSRect NSDrawTiledRects(NSRect boundsRect, NSRect clipRect, + const NSRectEdge *sides, const float *grays, + int count); +void NSDrawWhiteBezel(NSRect aRect, NSRect clipRect); +void NSFrameRect(NSRect aRect); +void NSFrameRectWithWidth(NSRect aRect, float frameWidth); + +// +// Color Functions +// +// +// Get Information About Color Space and Window Depth +// +const NSWindowDepth *NSAvailableWindowDepths(void); +NSWindowDepth NSBestDepth(NSString *colorSpace, + int bitsPerSample, int bitsPerPixel, + BOOL planar, BOOL *exactMatch); +int NSBitsPerPixelFromDepth(NSWindowDepth depth); +int NSBitsPerSampleFromDepth(NSWindowDepth depth); +NSString *NSColorSpaceFromDepth(NSWindowDepth depth); +int NSNumberOfColorComponents(NSString *colorSpaceName); +BOOL NSPlanarFromDepth(NSWindowDepth depth); + +// +// Read the Color at a Screen Position +// +NSColor *NSReadPixel(NSPoint location); + +// +// Text Functions +// +// +// Filter Characters Entered into a Text Object +// +unsigned short NSEditorFilter(unsigned short theChar, + int flags, NSStringEncoding theEncoding); +unsigned short NSFieldFilter(unsigned short theChar, + int flags, NSStringEncoding theEncoding); + +// +// Calculate or Draw a Line of Text (in Text Object) +// +int NSDrawALine(id self, NSLayInfo *layInfo); +int NSScanALine(id self, NSLayInfo *layInfo); + +// +// Calculate Font Ascender, Descender, and Line Height (in Text Object) +// +void NSTextFontInfo(id fid, + float *ascender, float *descender, + float *lineHeight); + +// +// Access Text Object's Word Tables +// +NSData * NSDataWithWordTable(const unsigned char *smartLeft, + const unsigned char *smartRight, + const unsigned char *charClasses, + const NSFSM *wrapBreaks, + int wrapBreaksCount, + const NSFSM *clickBreaks, + int clickBreaksCount, + BOOL charWrap); +void NSReadWordTable(NSZone *zone, + NSData *data, + unsigned char **smartLeft, + unsigned char **smartRight, + unsigned char **charClasses, + NSFSM **wrapBreaks, + int *wrapBreaksCount, + NSFSM **clickBreaks, + int *clickBreaksCount, + BOOL *charWrap); + +// +// Array Allocation Functions for Use by the NSText Class +// +NSTextChunk *NSChunkCopy(NSTextChunk *pc, NSTextChunk *dpc); +NSTextChunk *NSChunkGrow(NSTextChunk *pc, int newUsed); +NSTextChunk *NSChunkMalloc(int growBy, int initUsed); +NSTextChunk *NSChunkRealloc(NSTextChunk *pc); +NSTextChunk *NSChunkZoneCopy(NSTextChunk *pc, + NSTextChunk *dpc, + NSZone *zone); +NSTextChunk *NSChunkZoneGrow(NSTextChunk *pc, int newUsed, NSZone *zone); +NSTextChunk *NSChunkZoneMalloc(int growBy, int initUsed, NSZone *zone); +NSTextChunk *NSChunkZoneRealloc(NSTextChunk *pc, NSZone *zone); + +// +// Imaging Functions +// +// +// Copy an image +// +void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect, NSRect destRect); +void NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint); + +// +// Render Bitmap Images +// +void NSDrawBitmap(NSRect rect, + int pixelsWide, + int pixelsHigh, + int bitsPerSample, + int samplesPerPixel, + int bitsPerPixel, + int bytesPerRow, + BOOL isPlanar, + BOOL hasAlpha, + NSString *colorSpaceName, + const unsigned char *const data[5]); + +// +// Attention Panel Functions +// +// +// Create an Attention Panel without Running It Yet +// +id NSGetAlertPanel(NSString *title, + NSString *msg, + NSString *defaultButton, + NSString *alternateButton, + NSString *otherButton, ...); + +// +// Create and Run an Attention Panel +// +int NSRunAlertPanel(NSString *title, + NSString *msg, + NSString *defaultButton, + NSString *alternateButton, + NSString *otherButton, ...); +int NSRunLocalizedAlertPanel(NSString *table, + NSString *title, + NSString *msg, + NSString *defaultButton, + NSString *alternateButton, + NSString *otherButton, ...); + +// +// Release an Attention Panel +// +void NSReleaseAlertPanel(id panel); + +// +// Services Menu Functions +// +// +// Determine Whether an Item Is Included in Services Menus +// +int NSSetShowsServicesMenuItem(NSString *item, BOOL showService); +BOOL NSShowsServicesMenuItem(NSString *item); + +// +// Programmatically Invoke a Service +// +BOOL NSPerformService(NSString *item, NSPasteboard *pboard); + +// +// Force Services Menu to Update Based on New Services +// +void NSUpdateDynamicServices(void); + +// +// Other GNUstep GUI Library Functions +// +// +// Play the System Beep +// +void NSBeep(void); + +// +// Return File-related Pasteboard Types +// +NSString *NSCreateFileContentsPboardType(NSString *fileType); +NSString *NSCreateFilenamePboardType(NSString *filename); +NSString *NSGetFileType(NSString *pboardType); +NSArray *NSGetFileTypes(NSArray *pboardTypes); + +// +// Draw a Distinctive Outline around Linked Data +// +void NSFrameLinkRect(NSRect aRect, BOOL isDestination); +float NSLinkFrameThickness(void); + +// +// Convert an Event Mask Type to a Mask +// +unsigned int NSEventMaskFromType(NSEventType type); + +#endif // _GNUstep_H_AppKitFunctions diff --git a/Headers/gnustep/gui/LogFile.h b/Headers/gnustep/gui/LogFile.h new file mode 100644 index 000000000..cd3f61256 --- /dev/null +++ b/Headers/gnustep/gui/LogFile.h @@ -0,0 +1,75 @@ +/* + LogFile.h + + Logfile for recording trace messages + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep Application Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_LogFile +#define _GNUstep_H_LogFile + +#include +#include + +@interface LogFile : NSObject + +{ + // Attributes + struct _MB_lflags + { + unsigned int is_locking:1; + unsigned int is_date_logging:1; + } l_flags; + FILE *the_log; +} + +// +// Call one of these to initialize the log file and open a stream +// to the standard output or a file. +// +// -init does not open a file +- init; +- initStdout; +- initStdoutWithLocking; +- initFile:(const char *)filename; +- initFileWithLocking:(const char *)filename; + +// Instance methods +- writeLog:(const char *)logEntry; +- closeLog; +- (BOOL)isDateLogging; +- setDateLogging:(BOOL)flag; +- (BOOL)isLocking; + +@end + +#ifdef DEBUGLOG +#define NSDebugLog(format, args...) NSLog(format, ## args) +#else +#define NSDebugLog(format, args...) +#endif + +#endif // _GNUstep_H_LogFile diff --git a/Headers/gnustep/gui/NSActionCell.h b/Headers/gnustep/gui/NSActionCell.h new file mode 100644 index 000000000..388371b8a --- /dev/null +++ b/Headers/gnustep/gui/NSActionCell.h @@ -0,0 +1,98 @@ +/* + NSActionCell.h + + Abstract cell for target/action paradigm + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSActionCell +#define _GNUstep_H_NSActionCell + +#include +#include +#include + +@interface NSActionCell : NSCell + +{ + // Attributes + int tag; + id target; + SEL action; +} + +// +// Configuring an NSActionCell +// +- (void)setAlignment:(NSTextAlignment)mode; +- (void)setBezeled:(BOOL)flag; +- (void)setBordered:(BOOL)flag; +- (void)setEnabled:(BOOL)flag; +- (void)setFloatingPointFormat:(BOOL)autoRange + left:(unsigned int)leftDigits +right:(unsigned int)rightDigits; +- (void)setFont:(NSFont *)fontObject; +- (void)setImage:(NSImage *)image; + +// +// Manipulating NSActionCell Values +// +- (double)doubleValue; +- (float)floatValue; +- (int)intValue; +- (void)setStringValue:(NSString *)aString; +- (NSString *)stringValue; + +// +// Displaying +// +- (void)drawWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView; +- (NSView *)controlView; + +// +// Target and Action +// +- (SEL)action; +- (void)setAction:(SEL)aSelector; +- (void)setTarget:(id)anObject; +- (id)target; + +// +// Assigning a Tag +// +- (void)setTag:(int)anInt; +- (int)tag; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSActionCell diff --git a/Headers/gnustep/gui/NSApplication.h b/Headers/gnustep/gui/NSApplication.h new file mode 100644 index 000000000..bf5497aee --- /dev/null +++ b/Headers/gnustep/gui/NSApplication.h @@ -0,0 +1,259 @@ +/* + NSApplication.h + + The one and only application class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSApplication +#define _GNUstep_H_NSApplication + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +@interface NSApplication : NSResponder + +{ + // Attributes + NSMutableArray *window_list; + Queue *event_queue; + NSEvent *current_event; + id key_window; + id main_window; + id delegate; + int window_count; + NSMenu *main_menu; + NSMenuCell *windows_menu; + unsigned int current_mod; + BOOL app_is_running; + BOOL app_should_quit; + BOOL app_is_active; + BOOL app_is_hidden; + NSImage *app_icon; + + // Reserved for back-end use + void *be_app_reserved; +} + +// +// Class methods +// +// +// Creating and initializing the NSApplication +// ++ (NSApplication *)sharedApplication; + +// +// Instance methods +// +// +// Creating and initializing the NSApplication +// +- (void)finishLaunching; + +// +// Changing the active application +// +- (void)activateIgnoringOtherApps:(BOOL)flag; +- (void)deactivate; +- (BOOL)isActive; + +// +// Running the event loop +// +- (void)abortModal; +- (NSModalSession)beginModalSessionForWindow:(NSWindow *)theWindow; +- (void)endModalSession:(NSModalSession)theSession; +- (BOOL)isRunning; +- (void)run; +- (int)runModalForWindow:(NSWindow *)theWindow; +- (int)runModalSession:(NSModalSession)theSession; +- (void)sendEvent:(NSEvent *)theEvent; +- (void)stop:sender; +- (void)stopModal; +- (void)stopModalWithCode:(int)returnCode; + +// +// Getting, removing, and posting events +// +- (NSEvent *)currentEvent; +- (void)discardEventsMatchingMask:(unsigned int)mask + beforeEvent:(NSEvent *)lastEvent; +- (NSEvent *)nextEventMatchingMask:(unsigned int)mask + untilDate:(NSDate *)expiration + inMode:(NSString *)mode + dequeue:(BOOL)flag; +- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag; + +// +// Sending action messages +// +- (BOOL)sendAction:(SEL)aSelector + to:aTarget + from:sender; +- targetForAction:(SEL)aSelector; +- (BOOL)tryToPerform:(SEL)aSelector + with:anObject; + +// +// Setting the application's icon +// +- (void)setApplicationIconImage:(NSImage *)anImage; +- (NSImage *)applicationIconImage; + +// +// Hiding all windows +// +- (void)hide:sender; +- (BOOL)isHidden; +- (void)unhide:sender; +- (void)unhideWithoutActivation; + +// +// Managing windows +// +- (NSWindow *)keyWindow; +- (NSWindow *)mainWindow; +- (NSWindow *)makeWindowsPerform:(SEL)aSelector + inOrder:(BOOL)flag; +- (void)miniaturizeAll:sender; +- (void)preventWindowOrdering; +- (void)setWindowsNeedUpdate:(BOOL)flag; +- (void)updateWindows; +- (NSArray *)windows; +- (NSWindow *)windowWithWindowNumber:(int)windowNum; + +// +// Showing Standard Panels +// +- (void)orderFrontColorPanel:sender; +- (void)orderFrontDataLinkPanel:sender; +- (void)orderFrontHelpPanel:sender; +- (void)runPageLayout:sender; + +// +// Getting the main menu +// +- (NSMenu *)mainMenu; +- (void)setMainMenu:(NSMenu *)aMenu; + +// +// Managing the Windows menu +// +- (void)addWindowsItem:aWindow + title:(NSString *)aString + filename:(BOOL)isFilename; +- (void)arrangeInFront:sender; +- (void)changeWindowsItem:aWindow + title:(NSString *)aString + filename:(BOOL)isFilename; +- (void)removeWindowsItem:aWindow; +- (void)setWindowsMenu:aMenu; +- (void)updateWindowsItem:aWindow; +- (NSMenu *)windowsMenu; + +// +// Managing the Service menu +// +- (void)registerServicesMenuSendTypes:(NSArray *)sendTypes + returnTypes:(NSArray *)returnTypes; +- (NSMenu *)servicesMenu; +- (void)setServicesMenu:(NSMenu *)aMenu; +- validRequestorForSendType:(NSString *)sendType + returnType:(NSString *)returnType; + +// +// Getting the display postscript context +// +// - (NSDOSContext *)context; + +// +// Reporting an exception +// +//- (void)reportException:(NSException *)anException + +// +// Terminating the application +// +- (void)terminate:sender; + +// +// Assigning a delegate +// +- delegate; +- (void)setDelegate:anObject; + +// +// Implemented by the delegate +// +- (BOOL)application:sender openFileWithoutUI:(NSString *)filename; +- (BOOL)application:(NSApplication *)app openFile:(NSString *)filename; +- (BOOL)application:(NSApplication *)app openTempFile:(NSString *)filename; +- (void)applicationDidBecomeActive:sender; +- (void)applicationDidFinishLaunching:sender; +- (void)applicationDidHide:sender; +- (void)applicationDidResignActive:sender; +- (void)applicationDidUnhide:sender; +- (void)applicationDidUpdate:sender; +- (BOOL)applicationOpenUntitledFile:(NSApplication *)app; +- (BOOL)applicationShouldTerminate:sender; +- (void)applicationWillBecomeActive:sender; +- (void)applicationWillFinishLaunching:sender; +- (void)applicationWillHide:sender; +- (void)applicationWillResignActive:sender; +- (void)applicationWillUnhide:sender; +- (void)applicationWillUpdate:sender; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +// +// Backend methods +// +@interface NSApplication (GNUstepBackend) + +// Get next event +- (NSEvent *)getNextEvent; + +// handle a non-translated event +- (void)handleNullEvent; + +@end + +#endif // _GNUstep_H_NSApplication diff --git a/Headers/gnustep/gui/NSBitmapImageRep.h b/Headers/gnustep/gui/NSBitmapImageRep.h new file mode 100644 index 000000000..422c2a4cf --- /dev/null +++ b/Headers/gnustep/gui/NSBitmapImageRep.h @@ -0,0 +1,110 @@ +/* + NSBitmapImageRep.h + + Bitmap image representations + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSBitmapImageRep +#define _GNUstep_H_NSBitmapImageRep + +#include +#include +#include + +@interface NSBitmapImageRep : NSImageRep + +{ + // Attributes +} + +// +// Allocating and Initializing a New NSBitmapImageRep Object +// ++ (id)imageRepWithData:(NSData *)tiffData; ++ (NSArray *)imageRepsWithData:(NSData *)tiffData; +- (id)initWithData:(NSData *)tiffData; +- (id)initWithFocusedViewRect:(NSRect)rect; +- (id)initWithBitmapDataPlanes:(unsigned char **)planes + pixelsWide:(int)width +pixelsHigh:(int)height + bitsPerSample:(int)bps +samplesPerPixel:(int)spp + hasAlpha:(BOOL)alpha +isPlanar:(BOOL)config + colorSpaceName:(NSString *)colorSpaceName +bytesPerRow:(int)rowBytes + bitsPerPixel:(int)pixelBits; + +// +// Getting Information about the Image +// +- (int)bitsPerPixel; +- (int)samplesPerPixel; +- (BOOL)isPlanar; +- (int)numberOfPlanes; +- (int)bytesPerPlane; +- (int)bytesPerRow; + +// +// Getting Image Data +// +- (unsigned char *)bitmapData; +- (void)getBitmapDataPlanes:(unsigned char **)data; + +// +// Producing a TIFF Representation of the Image +// ++ (NSData *)TIFFRepresentationOfImageRepsInArray:(NSArray *)anArray; ++ (NSData *)TIFFRepresentationOfImageRepsInArray:(NSArray *)anArray + usingCompression:(NSTIFFCompression)compressionType +factor:(float)factor; +- (NSData *)TIFFRepresentation; +- (NSData *)TIFFRepresentationUsingCompression:(NSTIFFCompression)compressionType + factor:(float)factor; + +// +// Setting and Checking Compression Types +// ++ (void)getTIFFCompressionTypes:(const NSTIFFCompression **)list + count:(int *)numTypes; ++ (NSString *)localizedNameForTIFFCompressionType:(NSTIFFCompression)compression; +- (BOOL)canBeCompressedUsing:(NSTIFFCompression)compression; +- (void)getCompression:(NSTIFFCompression *)compression + factor:(float *)factor; +- (void)setCompression:(NSTIFFCompression)compression + factor:(float)factor; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSBitmapImageRep + diff --git a/Headers/gnustep/gui/NSBox.h b/Headers/gnustep/gui/NSBox.h new file mode 100644 index 000000000..d16e53bc7 --- /dev/null +++ b/Headers/gnustep/gui/NSBox.h @@ -0,0 +1,91 @@ +/* + NSBox.h + + Simple box view that can display a border and title + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSBox +#define _GNUstep_H_NSBox + +#include +#include +#include +#include + +@interface NSBox : NSView + +{ +@protected + // Attributes + id cell; + id content_view; + NSSize offsets; + NSRect border_rect; + NSRect title_rect; + NSBorderType border_type; + NSTitlePosition title_position; +} + +// +// Getting and Modifying the Border and Title +// +- (NSRect)borderRect; +- (NSBorderType)borderType; +- (void)setBorderType:(NSBorderType)aType; +- (void)setTitle:(NSString *)aString; +- (void)setTitleFont:(NSFont *)fontObj; +- (void)setTitlePosition:(NSTitlePosition)aPosition; +- (NSString *)title; +- (id)titleCell; +- (NSFont *)titleFont; +- (NSTitlePosition)titlePosition; +- (NSRect)titleRect; + +// +// Setting and Placing the Content View +// +- (id)contentView; +- (NSSize)contentViewMargins; +- (void)setContentView:(NSView *)aView; +- (void)setContentViewMargins:(NSSize)offsetSize; + +// +// Resizing the Box +// +- (void)setFrameFromContentFrame:(NSRect)contentFrame; +- (void)sizeToFit; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSBox + diff --git a/Headers/gnustep/gui/NSBrowser.h b/Headers/gnustep/gui/NSBrowser.h new file mode 100644 index 000000000..860c61d06 --- /dev/null +++ b/Headers/gnustep/gui/NSBrowser.h @@ -0,0 +1,219 @@ +/* + NSBrowser.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSBrowser +#define _GNUstep_H_NSBrowser + +#include +#include +#include +#include +#include + +@interface NSBrowser : NSControl + +{ + // Attributes +} + +// +// Setting the Delegate +// +- (id)delegate; +- (void)setDelegate:(id)anObject; + +// +// Target and Action +// +- (SEL)doubleAction; +- (BOOL)sendAction; +- (void)setDoubleAction:(SEL)aSelector; + +// +// Setting Component Classes +// ++ (Class)cellClass; +- (id)cellPrototype; +- (Class)matrixClass; +- (void)setCellClass:(Class)classId; +- (void)setCellPrototype:(NSCell *)aCell; +- (void)setMatrixClass:(Class)classId; + +// +// Setting NSBrowser Behavior +// +- (BOOL)reusesColumns; +- (void)setReusesColumns:(BOOL)flag; +- (void)setTakesTitleFromPreviousColumn:(BOOL)flag; +- (BOOL)takesTitleFromPreviousColumn; + +// +// Allowing Different Types of Selection +// +- (BOOL)allowsBranchSelection; +- (BOOL)allowsEmptySelection; +- (BOOL)allowsMultipleSelection; +- (void)setAllowsBranchSelection:(BOOL)flag; +- (void)setAllowsEmptySelection:(BOOL)flag; +- (void)setAllowsMultipleSelection:(BOOL)flag; + +// +// Setting Arrow Key Behavior +// +- (BOOL)acceptsArrowKeys; +- (BOOL)sendsActionOnArrowKeys; +- (void)setAcceptsArrowKeys:(BOOL)flag; +- (void)setSendsActionOnArrowKeys:(BOOL)flag; + +// +// Showing a Horizontal Scroller +// +- (void)setHasHorizontalScroller:(BOOL)flag; +- (BOOL)hasHorizontalScroller; + +// +// Setting the NSBrowser's Appearance +// +- (int)maxVisibleColumns; +- (int)minColumnWidth; +- (BOOL)separatesColumns; +- (void)setMaxVisibleColumns:(int)columnCount; +- (void)setMinColumnWidth:(int)columnWidth; +- (void)setSeparatesColumns:(BOOL)flag; + +// +// Manipulating Columns +// +- (void)addColumn; +- (int)columnOfMatrix:(NSMatrix *)matrix; +- (void)displayAllColumns; +- (void)displayColumn:(int)column; +- (int)firstVisibleColumn; +- (BOOL)isLoaded; +- (int)lastColumn; +- (int)lastVisibleColumn; +- (void)loadColumnZero; +- (int)numberOfVisibleColumns; +- (void)reloadColumn:(int)column; +- (void)selectAll:(id)sender; +- (int)selectedColumn; +- (void)setLastColumn:(int)column; +- (void)validateVisibleColumns; + +// +// Manipulating Column Titles +// +- (void)drawTitle:(NSString *)title + inRect:(NSRect)aRect +ofColumn:(int)column; +- (BOOL)isTitled; +- (void)setTitled:(BOOL)flag; +- (void)setTitle:(NSString *)aString + ofColumn:(int)column; +- (NSRect)titleFrameOfColumn:(int)column; +- (float)titleHeight; +- (NSString *)titleOfColumn:(int)column; + +// +// Scrolling an NSBrowser +// +- (void)scrollColumnsLeftBy:(int)shiftAmount; +- (void)scrollColumnsRightBy:(int)shiftAmount; +- (void)scrollColumnToVisible:(int)column; +- (void)scrollViaScroller:(NSScroller *)sender; +- (void)updateScroller; + +// +// Event Handling +// +- (void)doClick:(id)sender; +- (void)doDoubleClick:(id)sender; + +// +// Getting Matrices and Cells +// +- (id)loadedCellAtRow:(int)row + column:(int)column; +- (NSMatrix *)matrixInColumn:(int)column; +- (id)selectedCell; +- (id)selectedCellInColumn:(int)column; +- (NSArray *)selectedCells; + +// +// Getting Column Frames +// +- (NSRect)frameOfColumn:(int)column; +- (NSRect)frameOfInsideOfColumn:(int)column; + +// +// Manipulating Paths +// +- (NSString *)path; +- (NSString *)pathSeparator; +- (NSString *)pathToColumn:(int)column; +- (BOOL)setPath:(NSString *)path; +- (void)setPathSeparator:(NSString *)aString; + +// +// Arranging an NSBrowser's Components +// +- (void)tile; + +// +// Methods Implemented by the Delegate +// +- (void)browser:(NSBrowser *)sender +createRowsForColumn:(int)column +inMatrix:(NSMatrix *)matrix; +- (BOOL)browser:(NSBrowser *)sender + isColumnValid:(int)column; +- (int)browser:(NSBrowser *)sender +numberOfRowsInColumn:(int)column; +- (BOOL)browser:(NSBrowser *)sender + selectCell:(NSString *)title +inColumn:(int)column; +- (NSString *)browser:(NSBrowser *)sender + titleOfColumn:(int)column; +- (void)browser:(NSBrowser *)sender +willDisplayCell:(id)cell +atRow:(int)row +column:(int)column; +- (void)browserDidScroll:(NSBrowser *)sender; +- (void)browserWillScroll:(NSBrowser *)sender; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSBrowser diff --git a/Headers/gnustep/gui/NSBrowserCell.h b/Headers/gnustep/gui/NSBrowserCell.h new file mode 100644 index 000000000..5d77ef5bf --- /dev/null +++ b/Headers/gnustep/gui/NSBrowserCell.h @@ -0,0 +1,78 @@ +/* + NSBrowserCell.h + + Cell class for the NSBrowser + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSBrowserCell +#define _GNUstep_H_NSBrowserCell + +#include +#include +#include + +@interface NSBrowserCell : NSCell + +{ + // Attributes +} + +// +// Accessing Graphic Attributes +// ++ (NSImage *)branchImage; ++ (NSImage *)highlightedBranchImage; +- (NSImage *)alternateImage; +- (void)setAlternateImage:(NSImage *)anImage; + +// +// Placing in the Browser Hierarchy +// +- (BOOL)isLeaf; +- (void)setLeaf:(BOOL)flag; + +// +// Determining Loaded Status +// +- (BOOL)isLoaded; +- (void)setLoaded:(BOOL)flag; + +// +// Setting State +// +- (void)reset; +- (void)set; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSBrowserCell diff --git a/Headers/gnustep/gui/NSBundle.h b/Headers/gnustep/gui/NSBundle.h new file mode 100644 index 000000000..9390e43c7 --- /dev/null +++ b/Headers/gnustep/gui/NSBundle.h @@ -0,0 +1,50 @@ +/* + NSText.h + + The text object + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSBundleAdditions +#define _GNUstep_H_NSBundleAdditions + +@implementation NSBundle (NSBundleAdditions) + +- (NSString *)pathForImageResource:(NSString *)name; + ++ (BOOL)loadNibFile:(NSString *)fileName + externalNameTable:(NSDictionary *)context +withZone:(NSZone *)zone; + ++ (BOOL)loadNibNamed:(NSString *)aNibName + owner:(id)owner; + +@end + +#endif // _GNUstep_H_NSBundleAdditions + + + diff --git a/Headers/gnustep/gui/NSButton.h b/Headers/gnustep/gui/NSButton.h new file mode 100644 index 000000000..c308ffd97 --- /dev/null +++ b/Headers/gnustep/gui/NSButton.h @@ -0,0 +1,123 @@ +/* + NSButton.h + + The button class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSButton +#define _GNUstep_H_NSButton + +#include +#include +#include +#include + +@interface NSButton : NSControl + +{ + // Attributes +} + +// +// Initializing the NSButton Factory +// ++ (Class)cellClass; ++ (void)setCellClass:(Class)classId; + +// +// Setting the Button Type +// +- (void)setType:(NSButtonType)aType; + +// +// Setting the State +// +- (void)setState:(int)value; +- (int)state; + +// +// Setting the Repeat Interval +// +- (void)getPeriodicDelay:(float *)delay + interval:(float *)interval; +- (void)setPeriodicDelay:(float)delay + interval:(float)interval; + +// +// Setting the Titles +// +- (NSString *)alternateTitle; +- (void)setAlternateTitle:(NSString *)aString; +- (void)setTitle:(NSString *)aString; +- (NSString *)title; + +// +// Setting the Images +// +- (NSImage *)alternateImage; +- (NSImage *)image; +- (NSCellImagePosition)imagePosition; +- (void)setAlternateImage:(NSImage *)anImage; +- (void)setImage:(NSImage *)anImage; +- (void)setImagePosition:(NSCellImagePosition)aPosition; + +// +// Modifying Graphic Attributes +// +- (BOOL)isBordered; +- (BOOL)isTransparent; +- (void)setBordered:(BOOL)flag; +- (void)setTransparent:(BOOL)flag; + +// +// Displaying +// +- (void)highlight:(BOOL)flag; + +// +// Setting the Key Equivalent +// +- (NSString *)keyEquivalent; +- (unsigned int)keyEquivalentModifierMask; +- (void)setKeyEquivalent:(NSString *)aKeyEquivalent; +- (void)setKeyEquivalentModifierMask:(unsigned int)mask; + +// +// Handling Events and Action Messages +// +- (void)performClick:(id)sender; +- (BOOL)performKeyEquivalent:(NSEvent *)anEvent; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSButton diff --git a/Headers/gnustep/gui/NSButtonCell.h b/Headers/gnustep/gui/NSButtonCell.h new file mode 100644 index 000000000..9c1862918 --- /dev/null +++ b/Headers/gnustep/gui/NSButtonCell.h @@ -0,0 +1,119 @@ +/* + NSButtonCell.h + + The cell class for NSButton + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSButtonCell +#define _GNUstep_H_NSButtonCell + +#include +#include +#include +#include +#include +#include + +@interface NSButtonCell : NSActionCell + +{ + // Attributes + NSString *alt_contents; + NSImage *alt_image; + BOOL transparent; + + // Reserved for back-end use + void *be_bc_reserved; +} + +// +// Setting the Titles +// +- (NSString *)alternateTitle; +- (void)setAlternateTitle:(NSString *)aString; +- (void)setFont:(NSFont *)fontObject; +- (void)setTitle:(NSString *)aString; +- (NSString *)title; + +// +// Setting the Images +// +- (NSImage *)alternateImage; +- (NSCellImagePosition)imagePosition; +- (void)setAlternateImage:(NSImage *)anImage; +- (void)setImagePosition:(NSCellImagePosition)aPosition; + +// +// Setting the Repeat Interval +// +- (void)getPeriodicDelay:(float *)delay + interval:(float *)interval; +- (void)setPeriodicDelay:(float)delay + interval:(float)interval; + +// +// Setting the Key Equivalent +// +- (NSString *)keyEquivalent; +- (NSFont *)keyEquivalentFont; +- (unsigned int)keyEquivalentModifierMask; +- (void)setKeyEquivalent:(NSString *)aKeyEquivalent; +- (void)setKeyEquivalentModifierMask:(unsigned int)mask; +- (void)setKeyEquivalentFont:(NSFont *)fontObj; +- (void)setKeyEquivalentFont:(NSString *)fontName + size:(float)fontSize; + +// +// Modifying Graphic Attributes +// +- (BOOL)isOpaque; +- (BOOL)isTransparent; +- (void)setTransparent:(BOOL)flag; + +// +// Modifying Graphic Attributes +// +- (int)highlightsBy; +- (void)setHighlightsBy:(int)aType; +- (void)setShowsStateBy:(int)aType; +- (void)setType:(NSButtonType)aType; +- (int)showsStateBy; + +// +// Simulating a Click +// +- (void)performClick:(id)sender; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSButtonCell diff --git a/Headers/gnustep/gui/NSCachedImageRep.h b/Headers/gnustep/gui/NSCachedImageRep.h new file mode 100644 index 000000000..ecec23464 --- /dev/null +++ b/Headers/gnustep/gui/NSCachedImageRep.h @@ -0,0 +1,69 @@ +/* + NSCachedImageRep.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSCachedImageRep +#define _GNUstep_H_NSCachedImageRep + +#include +#include +#include +#include + +@interface NSCachedImageRep : NSImageRep + +{ + // Attributes +} + +// +// Initializing an NSCachedImageRep +// +- (id)initWithSize:(NSSize)aSize + depth:(NSWindowDepth)aDepth +separate:(BOOL)separate + alpha:(BOOL)alpha; +- (id)initWithWindow:(NSWindow *)aWindow + rect:(NSRect)aRect; + +// +// Getting the Representation +// +- (NSRect)rect; +- (NSWindow *)window; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSCachedImageRep diff --git a/Headers/gnustep/gui/NSCell.h b/Headers/gnustep/gui/NSCell.h new file mode 100644 index 000000000..5b2529287 --- /dev/null +++ b/Headers/gnustep/gui/NSCell.h @@ -0,0 +1,274 @@ +/* + NSCell.h + + The abstract cell class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSCell +#define _GNUstep_H_NSCell + +#include +#include +#include +#include +#include +#include +#include + +@interface NSCell : NSObject + +{ + // Attributes + NSString *contents; + id support; + BOOL cell_state; + BOOL cell_highlighted; + BOOL cell_enabled; + BOOL cell_editable; + BOOL cell_bordered; + BOOL cell_bezeled; + BOOL cell_scrollable; + BOOL cell_selectable; + BOOL cell_continuous; + BOOL cell_float_autorange; + unsigned int cell_float_left; + unsigned int cell_float_right; + unsigned int image_position; + int cell_type; + NSTextAlignment text_align; + int entry_type; + NSView *control_view; + NSSize cell_size; + id represented_object; +} + +// +// Initializing an NSCell +// +- (id)initImageCell:(NSImage *)anImage; +- (id)initTextCell:(NSString *)aString; + +// +// Determining Component Sizes +// +- (void)calcDrawInfo:(NSRect)aRect; +- (NSSize)cellSize; +- (NSSize)cellSizeForBounds:(NSRect)aRect; +- (NSRect)drawingRectForBounds:(NSRect)theRect; +- (NSRect)imageRectForBounds:(NSRect)theRect; +- (NSRect)titleRectForBounds:(NSRect)theRect; + +// +// Setting the NSCell's Type +// +- (void)setType:(NSCellType)aType; +- (NSCellType)type; + +// +// Setting the NSCell's State +// +- (void)setState:(int)value; +- (int)state; + +// +// Enabling and Disabling the NSCell +// +- (BOOL)isEnabled; +- (void)setEnabled:(BOOL)flag; + +// +// Setting the Image +// +- (NSImage *)image; +- (void)setImage:(NSImage *)anImage; + +// +// Setting the NSCell's Value +// +- (double)doubleValue; +- (float)floatValue; +- (int)intValue; +- (NSString *)stringValue; +- (void)setDoubleValue:(double)aDouble; +- (void)setFloatValue:(float)aFloat; +- (void)setIntValue:(int)anInt; +- (void)setStringValue:(NSString *)aString; + +// +// Interacting with Other NSCells +// +- (void)takeDoubleValueFrom:(id)sender; +- (void)takeFloatValueFrom:(id)sender; +- (void)takeIntValueFrom:(id)sender; +- (void)takeStringValueFrom:(id)sender; + +// +// Modifying Text Attributes +// +- (NSTextAlignment)alignment; +- (NSFont *)font; +- (BOOL)isEditable; +- (BOOL)isSelectable; +- (BOOL)isScrollable; +- (void)setAlignment:(NSTextAlignment)mode; +- (void)setEditable:(BOOL)flag; +- (void)setFont:(NSFont *)fontObject; +- (void)setSelectable:(BOOL)flag; +- (void)setScrollable:(BOOL)flag; +- (NSText *)setUpFieldEditorAttributes:(NSText *)textObject; +- (void)setWraps:(BOOL)flag; +- (BOOL)wraps; + +// +// Editing Text +// +- (void)editWithFrame:(NSRect)aRect + inView:(NSView *)controlView + editor:(NSText *)textObject + delegate:(id)anObject + event:(NSEvent *)theEvent; +- (void)endEditing:(NSText *)textObject; +- (void)selectWithFrame:(NSRect)aRect + inView:(NSView *)controlView + editor:(NSText *)textObject + delegate:(id)anObject + start:(int)selStart + length:(int)selLength; + +// +// Validating Input +// +- (int)entryType; +- (BOOL)isEntryAcceptable:(NSString *)aString; +- (void)setEntryType:(int)aType; + +// +// Formatting Data +// +- (void)setFloatingPointFormat:(BOOL)autoRange + left:(unsigned int)leftDigits + right:(unsigned int)rightDigits; + +// +// Modifying Graphic Attributes +// +- (BOOL)isBezeled; +- (BOOL)isBordered; +- (BOOL)isOpaque; +- (void)setBezeled:(BOOL)flag; +- (void)setBordered:(BOOL)flag; + +// +// Setting Parameters +// +- (int)cellAttribute:(NSCellAttribute)aParameter; +- (void)setCellAttribute:(NSCellAttribute)aParameter + to:(int)value; + +// +// Displaying +// +- (NSView *)controlView; +- (void)drawInteriorWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView; +- (void)drawWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView; +- (void)highlight:(BOOL)lit + withFrame:(NSRect)cellFrame + inView:(NSView *)controlView; +- (BOOL)isHighlighted; + +// +// Target and Action +// +- (SEL)action; +- (BOOL)isContinuous; +- (int)sendActionOn:(int)mask; +- (void)setAction:(SEL)aSelector; +- (void)setContinuous:(BOOL)flag; +- (void)setTarget:(id)anObject; +- (id)target; + +// +// Assigning a Tag +// +- (void)setTag:(int)anInt; +- (int)tag; + +// +// Handling Keyboard Alternatives +// +- (NSString *)keyEquivalent; + +// +// Tracking the Mouse +// ++ (BOOL)prefersTrackingUntilMouseUp; +- (BOOL)continueTracking:(NSPoint)lastPoint + at:(NSPoint)currentPoint + inView:(NSView *)controlView; +- (int)mouseDownFlags; +- (void)getPeriodicDelay:(float *)delay + interval:(float *)interval; +- (BOOL)startTrackingAt:(NSPoint)startPoint + inView:(NSView *)controlView; +- (void)stopTracking:(NSPoint)lastPoint + at:(NSPoint)stopPoint + inView:(NSView *)controlView + mouseIsUp:(BOOL)flag; +- (BOOL)trackMouse:(NSEvent *)theEvent + inRect:(NSRect)cellFrame + ofView:(NSView *)controlView + untilMouseUp:(BOOL)flag; + +// +// Managing the Cursor +// +- (void)resetCursorRect:(NSRect)cellFrame + inView:(NSView *)controlView; + +// +// Comparing to Another NSCell +// +- (NSComparisonResult)compare:(id)otherCell; + +// +// Using the NSCell to Represent an Object +// +- (id)representedObject; +- (void)setRepresentedObject:(id)anObject; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSCell + diff --git a/Headers/gnustep/gui/NSClipView.h b/Headers/gnustep/gui/NSClipView.h new file mode 100644 index 000000000..8e6fd1f02 --- /dev/null +++ b/Headers/gnustep/gui/NSClipView.h @@ -0,0 +1,88 @@ +/* + NSClipView.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSClipView +#define _GNUstep_H_NSClipView + +#include +#include +#include +#include +#include + +@interface NSClipView : NSView + +{ + // Attributes +} + +// +// Managing the Document View +// +- (NSRect)documentRect; +- (id)documentView; +- (NSRect)documentVisibleRect; +- (void)setDocumentView:(NSView *)aView; + +// +// Setting the Cursor +// +- (NSCursor *)documentCursor; +- (void)setDocumentCursor:(NSCursor *)anObject; + +// +// Setting the Background Color +// +- (NSColor *)backgroundColor; +- (void)setBackgroundColor:(NSColor *)color; + +// +// Scrolling +// +- (BOOL)autoscroll:(NSEvent *)theEvent; +- (NSPoint)constrainScrollPoint:(NSPoint)newOrigin; +- (BOOL)copiesOnScroll; +- (void)scrollToPoint:(NSPoint)newOrigin; +- (void)setCopiesOnScroll:(BOOL)flag; + +// +// Responding to a Changed Frame +// +- (void)viewFrameChanged:(NSNotification *)notification; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSClipView diff --git a/Headers/gnustep/gui/NSColor.h b/Headers/gnustep/gui/NSColor.h new file mode 100644 index 000000000..588962f9e --- /dev/null +++ b/Headers/gnustep/gui/NSColor.h @@ -0,0 +1,205 @@ +/* + NSColor.h + + The colorful color class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSColor +#define _GNUstep_H_NSColor + +#include +#include + +@class NSPasteboard; + +@interface NSColor : NSObject + +{ + // Attributes + NSString *colorspace_name; + NSString *catalog_name; + NSString *color_name; + + struct _GNU_RGB_component + { + float red; + float green; + float blue; + } RGB_component; + + struct _GNU_CMYK_component + { + float cyan; + float magenta; + float yellow; + float black; + } CMYK_component; + + float alpha_component; + float white_component; + float hue_component; + float brightness_component; + float saturation_component; + + BOOL is_clear; + + // Reserved for back-end use + void *be_color_reserved; +} + +// +// Creating an NSColor from Component Values +// ++ (NSColor *)colorWithCalibratedHue:(float)hue + saturation:(float)saturation +brightness:(float)brightness + alpha:(float)alpha; ++ (NSColor *)colorWithCalibratedRed:(float)red + green:(float)green +blue:(float)blue + alpha:(float)alpha; ++ (NSColor *)colorWithCalibratedWhite:(float)white + alpha:(float)alpha; ++ (NSColor *)colorWithCatalogName:(NSString *)listName + colorName:(NSString *)colorName; ++ (NSColor *)colorWithDeviceCyan:(float)cyan + magenta:(float)magenta +yellow:(float)yellow + black:(float)black +alpha:(float)alpha; ++ (NSColor *)colorWithDeviceHue:(float)hue + saturation:(float)saturation +brightness:(float)brightness + alpha:(float)alpha; ++ (NSColor *)colorWithDeviceRed:(float)red + green:(float)green +blue:(float)blue + alpha:(float)alpha; ++ (NSColor *)colorWithDeviceWhite:(float)white + alpha:(float)alpha; + +// +// Creating an NSColor With Preset Components +// ++ (NSColor *)blackColor; ++ (NSColor *)blueColor; ++ (NSColor *)brownColor; ++ (NSColor *)clearColor; ++ (NSColor *)cyanColor; ++ (NSColor *)darkGrayColor; ++ (NSColor *)grayColor; ++ (NSColor *)greenColor; ++ (NSColor *)lightGrayColor; ++ (NSColor *)magentaColor; ++ (NSColor *)orangeColor; ++ (NSColor *)purpleColor; ++ (NSColor *)redColor; ++ (NSColor *)whiteColor; ++ (NSColor *)yellowColor; + +// +// Ignoring Alpha Components +// ++ (BOOL)ignoresAlpha; ++ (void)setIgnoresAlpha:(BOOL)flag; + +// +// Retrieving a Set of Components +// +- (void)getCyan:(float *)cyan + magenta:(float *)magenta +yellow:(float *)yellow + black:(float *)black +alpha:(float *)alpha; +- (void)getHue:(float *)hue + saturation:(float *)saturation +brightness:(float *)brightness + alpha:(float *)alpha; +- (void)getRed:(float *)red + green:(float *)green +blue:(float *)blue + alpha:(float *)alpha; +- (void)getWhite:(float *)white + alpha:(float *)alpha; + +// +// Retrieving Individual Components +// +- (float)alphaComponent; +- (float)blackComponent; +- (float)blueComponent; +- (float)brightnessComponent; +- (NSString *)catalogNameComponent; +- (NSString *)colorNameComponent; +- (float)cyanComponent; +- (float)greenComponent; +- (float)hueComponent; +- (NSString *)localizedCatalogNameComponent; +- (NSString *)localizedColorNameComponent; +- (float)magentaComponent; +- (float)redComponent; +- (float)saturationComponent; +- (float)whiteComponent; +- (float)yellowComponent; + +// +// Converting to Another Color Space +// +- (NSString *)colorSpaceName; +- (NSColor *)colorUsingColorSpaceName:(NSString *)colorSpace; +- (NSColor *)colorUsingColorSpaceName:(NSString *)colorSpace + device:(NSDictionary *)deviceDescription; + +// +// Changing the Color +// +- (NSColor *)blendedColorWithFraction:(float)fraction + ofColor:(NSColor *)aColor; +- (NSColor *)colorWithAlphaComponent:(float)alpha; + +// +// Copying and Pasting +// ++ (NSColor *)colorFromPasteboard:(NSPasteboard *)pasteBoard; +- (void)writeToPasteboard:(NSPasteboard *)pasteBoard; + +// +// Drawing +// +- (void)drawSwatchInRect:(NSRect)rect; +- (void)set; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSColor + diff --git a/Headers/gnustep/gui/NSColorList.h b/Headers/gnustep/gui/NSColorList.h new file mode 100644 index 000000000..73684ecf7 --- /dev/null +++ b/Headers/gnustep/gui/NSColorList.h @@ -0,0 +1,93 @@ +/* + NSColorList.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSColorList +#define _GNUstep_H_NSColorList + +#include +#include +#include + +@interface NSColorList : NSObject + +{ + // Attributes +} + +// +// Initializing an NSColorList +// +- (id)initWithName:(NSString *)name; +- (id)initWithName:(NSString *)name + fromFile:(NSString *)path; + +// +// Getting All Color Lists +// ++ (NSArray *)availableColorLists; + +// +// Getting a Color List by Name +// ++ (NSColorList *)colorListNamed:(NSString *)name; +- (NSString *)name; + +// +// Managing Colors by Key +// +- (NSArray *)allKeys; +- (NSColor *)colorWithKey:(NSString *)key; +- (void)insertColor:(NSColor *)color + key:(NSString *)key +atIndex:(unsigned)location; +- (void)removeColorWithKey:(NSString *)key; +- (void)setColor:(NSColor *)aColor + forKey:(NSString *)key; + +// +// Editing +// +- (BOOL)isEditable; + +// +// Writing and Removing Files +// +- (BOOL)writeToFile:(NSString *)path; +- (void)removeFile; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSColorList diff --git a/Headers/gnustep/gui/NSColorPanel.h b/Headers/gnustep/gui/NSColorPanel.h new file mode 100644 index 000000000..2309517ca --- /dev/null +++ b/Headers/gnustep/gui/NSColorPanel.h @@ -0,0 +1,91 @@ +/* + NSColorPanel.h + + System generic color panel + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSColorPanel +#define _GNUstep_H_NSColorPanel + +#include +#include +#include +#include + +@interface NSColorPanel : NSPanel + +{ + // Attributes +} + +// +// Creating the NSColorPanel +// ++ (NSColorPanel *)sharedColorPanel; ++ (BOOL)sharedColorPanelExists; + +// +// Setting the NSColorPanel +// ++ (void)setPickerMask:(int)mask; ++ (void)setPickerMode:(int)mode; +- (NSView *)accessoryView; +- (BOOL)isContinuous; +- (int)mode; +- (void)setAccessoryView:(NSView *)aView; +- (void)setAction:(SEL)aSelector; +- (void)setContinuous:(BOOL)flag; +- (void)setMode:(int)mode; +- (void)setShowsAlpha:(BOOL)flag; +- (void)setTarget:(id)anObject; +- (BOOL)showsAlpha; + +// +// Attaching a Color List +// +- (void)attachColorList:(NSColorList *)aColorList; +- (void)detachColorList:(NSColorList *)aColorList; + +// +// Setting Color +// ++ (BOOL)dragColor:(NSColor **)aColor + withEvent:(NSEvent *)anEvent +fromView:(NSView *)sourceView; +- (float)alpha; +- (NSColor *)color; +- (void)setColor:(NSColor *)aColor; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSColorPanel diff --git a/Headers/gnustep/gui/NSColorPicker.h b/Headers/gnustep/gui/NSColorPicker.h new file mode 100644 index 000000000..5bbb35846 --- /dev/null +++ b/Headers/gnustep/gui/NSColorPicker.h @@ -0,0 +1,82 @@ +/* + NSColorPicker.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSColorPicker +#define _GNUstep_H_NSColorPicker + +#include +#include +#include +#include +#include + +@interface NSColorPicker : NSObject + +{ + // Attributes +} + +// +// Initializing an NSColorPicker +// +- (id)initWithPickerMask:(int)aMask + colorPanel:(NSColorPanel *)colorPanel; + +// +// Getting the Color Panel +// +- (NSColorPanel *)colorPanel; + +// +// Adding Button Images +// +- (void)insertNewButtonImage:(NSImage *)newImage + in:(NSButtonCell *)newButtonCell; +- (NSImage *)provideNewButtonImage; + +// +// Setting the Mode +// +- (void)setMode:(int)mode; + +// +// Using Color Lists +// +- (void)attachColorList:(NSColorList *)colorList; +- (void)detachColorList:(NSColorList *)colorList; + +// +// Responding to a Resized View +// +- (void)viewSizeChanged:(id)sender; + +@end + +#endif // _GNUstep_H_NSColorPicker diff --git a/Headers/gnustep/gui/NSColorWell.h b/Headers/gnustep/gui/NSColorWell.h new file mode 100644 index 000000000..2e7355d02 --- /dev/null +++ b/Headers/gnustep/gui/NSColorWell.h @@ -0,0 +1,77 @@ +/* + NSColorWell.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSColorWell +#define _GNUstep_H_NSColorWell + +#include +#include +#include + +@interface NSColorWell : NSControl + +{ + // Attributes +} + +// +// Drawing +// +- (void)drawWellInside:(NSRect)insideRect; + +// +// Activating +// +- (void)activate:(BOOL)exclusive; +- (void)deactivate; +- (BOOL)isActive; + +// +// Managing Color +// +- (NSColor *)color; +- (void)setColor:(NSColor *)color; +- (void)takeColorFrom:(id)sender; + +// +// Managing Borders +// +- (BOOL)isBordered; +- (void)setBordered:(BOOL)bordered; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSColorWell diff --git a/Headers/gnustep/gui/NSControl.h b/Headers/gnustep/gui/NSControl.h new file mode 100644 index 000000000..5128a1da9 --- /dev/null +++ b/Headers/gnustep/gui/NSControl.h @@ -0,0 +1,171 @@ +/* + NSControl.h + + The abstract control class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSControl +#define _GNUstep_H_NSControl + +#include +#include +#include +#include + +@interface NSControl : NSView + +{ + // Attributes + int tag; + id cell; +} + +// +// Initializing an NSControl Object +// +- (id)initWithFrame:(NSRect)frameRect; + +// +// Setting the Control's Cell +// ++ (Class)cellClass; ++ (void)setCellClass:(Class)factoryId; +- (id)cell; +- (void)setCell:(NSCell *)aCell; + +// +// Enabling and Disabling the Control +// +- (BOOL)isEnabled; +- (void)setEnabled:(BOOL)flag; + +// +// Identifying the Selected Cell +// +- (id)selectedCell; +- (int)selectedTag; + +// +// Setting the Control's Value +// +- (double)doubleValue; +- (float)floatValue; +- (int)intValue; +- (void)setDoubleValue:(double)aDouble; +- (void)setFloatValue:(float)aFloat; +- (void)setIntValue:(int)anInt; +- (void)setNeedsDisplay; +- (void)setStringValue:(NSString *)aString; +- (NSString *)stringValue; + +// +// Interacting with Other Controls +// +- (void)takeDoubleValueFrom:(id)sender; +- (void)takeFloatValueFrom:(id)sender; +- (void)takeIntValueFrom:(id)sender; +- (void)takeStringValueFrom:(id)sender; + +// +// Formatting Text +// +- (NSTextAlignment)alignment; +- (NSFont *)font; +- (void)setAlignment:(NSTextAlignment)mode; +- (void)setFont:(NSFont *)fontObject; +- (void)setFloatingPointFormat:(BOOL)autoRange + left:(unsigned)leftDigits +right:(unsigned)rightDigits; + +// +// Managing the Field Editor +// +- (BOOL)abortEditing; +- (NSText *)currentEditor; +- (void)validateEditing; + +// +// Resizing the Control +// +- (void)calcSize; +- (void)sizeToFit; + +// +// Displaying the Control and Cell +// +- (void)drawCell:(NSCell *)aCell; +- (void)drawCellInside:(NSCell *)aCell; +- (void)selectCell:(NSCell *)aCell; +- (void)updateCell:(NSCell *)aCell; +- (void)updateCellInside:(NSCell *)aCell; + +// +// Target and Action +// +- (SEL)action; +- (BOOL)isContinuous; +- (BOOL)sendAction:(SEL)theAction + to:(id)theTarget; +- (int)sendActionOn:(int)mask; +- (void)setAction:(SEL)aSelector; +- (void)setContinuous:(BOOL)flag; +- (void)setTarget:(id)anObject; +- (id)target; + +// +// Assigning a Tag +// +- (void)setTag:(int)anInt; +- (int)tag; + +// +// Tracking the Mouse +// +- (void)mouseDown:(NSEvent *)theEvent; +- (BOOL)ignoresMultiClick; +- (void)setIgnoresMultiClick:(BOOL)flag; + +// +// Methods Implemented by the Delegate +// +- (BOOL)control:(NSControl *)control +textShouldBeginEditing:(NSText *)fieldEditor; +- (BOOL)control:(NSControl *)control +textShouldEndEditing:(NSText *)fieldEditor; +- (void)controlTextDidBeginEditing:(NSNotification *)aNotification; +- (void)controlTextDidEndEditing:(NSNotification *)aNotification; +- (void)controlTextDidChange:(NSNotification *)aNotification; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSControl diff --git a/Headers/gnustep/gui/NSCursor.h b/Headers/gnustep/gui/NSCursor.h new file mode 100644 index 000000000..10f30c3de --- /dev/null +++ b/Headers/gnustep/gui/NSCursor.h @@ -0,0 +1,90 @@ +/* + NSCursor.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSCursor +#define _GNUstep_H_NSCursor + +#include +#include +#include +#include + +@interface NSCursor : NSObject + +{ + // Attributes +} + +// +// Initializing a New NSCursor Object +// +- (id)initWithImage:(NSImage *)newImage; + +// +// Defining the Cursor +// +- (NSPoint)hotSpot; +- (NSImage *)image; +- (void)setHotSpot:(NSPoint)spot; +- (void)setImage:(NSImage *)newImage; + +// +// Setting the Cursor +// ++ (void)hide; ++ (void)pop; ++ (void)setHiddenUntilMouseMoves:(BOOL)flag; ++ (void)unhide; +- (BOOL)isSetOnMouseEntered; +- (BOOL)isSetOnMouseExited; +- (void)mouseEntered:(NSEvent *)theEvent; +- (void)mouseExited:(NSEvent *)theEvent; +- (void)pop; +- (void)push; +- (void)set; +- (void)setOnMouseEntered:(BOOL)flag; +- (void)setOnMouseExited:(BOOL)flag; + +// +// Getting the Cursor +// ++ (NSCursor *)arrowCursor; ++ (NSCursor *)currentCursor; ++ (NSCursor *)IBeamCursor; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSCursor diff --git a/Headers/gnustep/gui/NSCustomImageRep.h b/Headers/gnustep/gui/NSCustomImageRep.h new file mode 100644 index 000000000..0fed4eb6e --- /dev/null +++ b/Headers/gnustep/gui/NSCustomImageRep.h @@ -0,0 +1,61 @@ +/* + NSCustomImageRep.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSCustomImageRep +#define _GNUstep_H_NSCustomImageRep + +#include +#include +#include + +@interface NSCustomImageRep : NSImageRep + +{ + // Attributes +} + +- (id)initWithDrawSelector:(SEL)aSelector + delegate:(id)anObject; + +// +// Identifying the Object +// +- (id)delegate; +- (SEL)drawSelector; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSCustomImageRep diff --git a/Headers/gnustep/gui/NSDataLink.h b/Headers/gnustep/gui/NSDataLink.h new file mode 100644 index 000000000..7b92ce0a8 --- /dev/null +++ b/Headers/gnustep/gui/NSDataLink.h @@ -0,0 +1,107 @@ +/* + NSDataLink.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSDataLink +#define _GNUstep_H_NSDataLink + +#include +#include +#include +#include +#include + +@class NSDataLinkManager; + +@interface NSDataLink : NSObject + +{ + // Attributes +} + +// +// Initializing a Link +// +- (id)initLinkedToFile:(NSString *)filename; +- (id)initLinkedToSourceSelection:(NSSelection *)selection + managedBy:(NSDataLinkManager *)linkManager +supportingTypes:(NSArray *)newTypes; +- (id)initWithContentsOfFile:(NSString *)filename; +- (id)initWithPasteboard:(NSPasteboard *)pasteboard; + +// +// Exporting a Link +// +- (BOOL)saveLinkIn:(NSString *)directoryName; +- (BOOL)writeToFile:(NSString *)filename; +- (void)writeToPasteboard:(NSPasteboard *)pasteboard; + +// +// Information about the Link +// +- (NSDataLinkDisposition)disposition; +- (NSDataLinkNumber)linkNumber; +- (NSDataLinkManager *)manager; + +// +// Information about the Link's Source +// +- (NSDate *)lastUpdateTime; +- (BOOL)openSource; +- (NSString *)sourceApplicationName; +- (NSString *)sourceFilename; +- (NSSelection *)sourceSelection; +- (NSArray *)types; + +// +// Information about the Link's Destination +// +- (NSString *)destinationApplicationName; +- (NSString *)destinationFilename; +- (NSSelection *)destinationSelection; + +// +// Changing the Link +// +- (BOOL)break; +- (void)noteSourceEdited; +- (void)setUpdateMode:(NSDataLinkUpdateMode)mode; +- (BOOL)updateDestination; +- (NSDataLinkUpdateMode)updateMode; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSDataLink + diff --git a/Headers/gnustep/gui/NSDataLinkManager.h b/Headers/gnustep/gui/NSDataLinkManager.h new file mode 100644 index 000000000..c1adda225 --- /dev/null +++ b/Headers/gnustep/gui/NSDataLinkManager.h @@ -0,0 +1,129 @@ +/* + NSDataLinkManager.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSDataLinkManager +#define _GNUstep_H_NSDataLinkManager + +#include +#include +#include +#include +#include + +@interface NSDataLinkManager : NSObject + +{ + // Attributes +} + +// +// Initializing and Freeing a Link Manager +// +- (id)initWithDelegate:(id)anObject; +- (id)initWithDelegate:(id)anObject + fromFile:(NSString *)path; + +// +// Adding and Removing Links +// +- (BOOL)addLink:(NSDataLink *)link + at:(NSSelection *)selection; +- (BOOL)addLinkAsMarker:(NSDataLink *)link + at:(NSSelection *)selection; +- (NSDataLink *)addLinkPreviouslyAt:(NSSelection *)oldSelection + fromPasteboard:(NSPasteboard *)pasteboard +at:(NSSelection *)selection; +- (void)breakAllLinks; +- (void)writeLinksToPasteboard:(NSPasteboard *)pasteboard; + +// +// Informing the Link Manager of Document Status +// +- (void)noteDocumentClosed; +- (void)noteDocumentEdited; +- (void)noteDocumentReverted; +- (void)noteDocumentSaved; +- (void)noteDocumentSavedAs:(NSString *)path; +- (void)noteDocumentSavedTo:(NSString *)path; + +// +// Getting and Setting Information about the Link Manager +// +- (id)delegate; +- (BOOL)delegateVerifiesLinks; +- (NSString *)filename; +- (BOOL)interactsWithUser; +- (BOOL)isEdited; +- (void)setDelegateVerifiesLinks:(BOOL)flag; +- (void)setInteractsWithUser:(BOOL)flag; + +// +// Getting and Setting Information about the Manager's Links +// +- (BOOL)areLinkOutlinesVisible; +- (NSEnumerator *)destinationLinkEnumerator; +- (NSDataLink *)destinationLinkWithSelection:(NSSelection *)destSel; +- (void)setLinkOutlinesVisible:(BOOL)flag; +- (NSEnumerator *)sourceLinkEnumerator; + +// +// Methods Implemented by the Delegate +// +- (BOOL)copyToPasteboard:(NSPasteboard *)pasteboard + at:(NSSelection *)selection +cheapCopyAllowed:(BOOL)flag; +- (void)dataLinkManager:(NSDataLinkManager *)sender + didBreakLink:(NSDataLink *)link; +- (BOOL)dataLinkManager:(NSDataLinkManager *)sender + isUpdateNeededForLink:(NSDataLink *)link; +- (void)dataLinkManager:(NSDataLinkManager *)sender + startTrackingLink:(NSDataLink *)link; +- (void)dataLinkManager:(NSDataLinkManager *)sender + stopTrackingLink:(NSDataLink *)link; +- (void)dataLinkManagerCloseDocument:(NSDataLinkManager *)sender; +- (void)dataLinkManagerDidEditLinks:(NSDataLinkManager *)sender; +- (void)dataLinkManagerRedrawLinkOutlines:(NSDataLinkManager *)sender; +- (BOOL)dataLinkManagerTracksLinksIndividually:(NSDataLinkManager *)sender; +- (BOOL)importFile:(NSString *)filename + at:(NSSelection *)selection; +- (BOOL)pasteFromPasteboard:(NSPasteboard *)pasteboard + at:(NSSelection *)selection; +- (BOOL)showSelection:(NSSelection *)selection; +- (NSWindow *)windowForSelection:(NSSelection *)selection; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSDataLinkManager diff --git a/Headers/gnustep/gui/NSDataLinkPanel.h b/Headers/gnustep/gui/NSDataLinkPanel.h new file mode 100644 index 000000000..a02ec5763 --- /dev/null +++ b/Headers/gnustep/gui/NSDataLinkPanel.h @@ -0,0 +1,89 @@ +/* + NSDataLinkPanel.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSDataLinkPanel +#define _GNUstep_H_NSDataLinkPanel + +#include +#include +#include +#include + +@interface NSDataLinkPanel : NSPanel + +{ + // Attributes +} + +// +// Initializing +// ++ (NSDataLinkPanel *)sharedDataLinkPanel; + +// +// Keeping the Panel Up to Date +// ++ (void)getLink:(NSDataLink **)link + manager:(NSDataLinkManager **)linkManager +isMultiple:(BOOL *)flag; ++ (void)setLink:(NSDataLink *)link + manager:(NSDataLinkManager *)linkManager +isMultiple:(BOOL)flag; +- (void)getLink:(NSDataLink **)link + manager:(NSDataLinkManager **)linkManager +isMultiple:(BOOL *)flag; +- (void)setLink:(NSDataLink *)link + manager:(NSDataLinkManager *)linkManager +isMultiple:(BOOL)flag; + +// +// Customizing the Panel +// +- (NSView *)accessoryView; +- (void)setAccessoryView:(NSView *)aView; + +// +// Responding to User Input +// +- (void)pickedBreakAllLinks:(id)sender; +- (void)pickedBreakLink:(id)sender; +- (void)pickedOpenSource:(id)sender; +- (void)pickedUpdateDestination:(id)sender; +- (void)pickedUpdateMode:(id)sender; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSDataLinkPanel diff --git a/Headers/gnustep/gui/NSEPSImageRep.h b/Headers/gnustep/gui/NSEPSImageRep.h new file mode 100644 index 000000000..4d950007c --- /dev/null +++ b/Headers/gnustep/gui/NSEPSImageRep.h @@ -0,0 +1,70 @@ +/* + NSEPSImageRep.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSEPSImageRep +#define _GNUstep_H_NSEPSImageRep + +#include +#include +#include + +@interface NSEPSImageRep : NSImageRep + +{ + // Attributes +} + +// +// Initializing a New Instance +// ++ (id)imageRepWithData:(NSData *)epsData; +- (id)initWithData:(NSData *)epsData; + +// +// Getting Image Data +// +- (NSRect)boundingBox; +- (NSData *)EPSRepresentation; + +// +// Drawing the Image +// +- (void)prepareGState; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSEPSImageRep + diff --git a/Headers/gnustep/gui/NSEvent.h b/Headers/gnustep/gui/NSEvent.h new file mode 100644 index 000000000..91e2341bf --- /dev/null +++ b/Headers/gnustep/gui/NSEvent.h @@ -0,0 +1,182 @@ +/* + NSEvent.h + + The event class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSEvent +#define _GNUstep_H_NSEvent + +#include +#include +#include +#include +#include +#include + +@class NSWindow; + +@interface NSEvent : NSObject + +{ + // Attributes + NSEventType event_type; + NSPoint location_point; + unsigned int modifier_flags; + NSTimeInterval event_time; + int window_num; + NSDPSContext *event_context; + union _MB_event_data + { + struct + { + int event_num; + int click; + float pressure; + } mouse; + struct + { + BOOL repeat; + NSString *char_keys; + NSString *unmodified_keys; + unsigned short key_code; + } key; + struct + { + int event_num; + int tracking_num; + void *user_data; + } tracking; + struct + { + short sub_type; + int data1; + int data2; + } misc; + } event_data; +} + +// +// Creating NSEvent objects +// + ++ (NSEvent *)enterExitEventWithType:(NSEventType)type + location:(NSPoint)location + modifierFlags:(unsigned int)flags + timestamp:(NSTimeInterval)time + windowNumber:(int)windowNum + context:(NSDPSContext *)context + eventNumber:(int)eventNum + trackingNumber:(int)trackingNum + userData:(void *)userData; + ++ (NSEvent *)keyEventWithType:(NSEventType)type + location:(NSPoint)location + modifierFlags:(unsigned int)flags + timestamp:(NSTimeInterval)time + windowNumber:(int)windowNum + context:(NSDPSContext *)context + characters:(NSString *)keys + charactersIgnoringModifiers:(NSString *)ukeys + isARepeat:(BOOL)repeatKey + keyCode:(unsigned short)code; + ++ (NSEvent *)mouseEventWithType:(NSEventType)type + location:(NSPoint)location + modifierFlags:(unsigned int)flags + timestamp:(NSTimeInterval)time + windowNumber:(int)windowNum + context:(NSDPSContext *)context + eventNumber:(int)eventNum + clickCount:(int)clickNum + pressure:(float)pressureValue; + ++ (NSEvent *)otherEventWithType:(NSEventType)type + location:(NSPoint)location + modifierFlags:(unsigned int)flags + timestamp:(NSTimeInterval)time + windowNumber:(int)windowNum + context:(NSDPSContext *)context + subtype:(short)subType + data1:(int)data1 + data2:(int)data2; + +// +// Getting General Event Information +// +- (NSDPSContext *)context; +- (NSPoint)locationInWindow; +- (unsigned int)modifierFlags; +- (NSTimeInterval)timestamp; +- (NSEventType)type; +- (NSWindow *)window; +- (int)windowNumber; + +// +// Getting Key Event Information +// +- (NSString *)characters; +- (NSString *)charactersIgnoringModifiers; +- (BOOL)isARepeat; +- (unsigned short)keyCode; + +// +// Getting Mouse Event Information +// +- (int)clickCount; +- (int)eventNumber; +- (float)pressure; + +// +// Getting Tracking Event Information +// +- (int)trackingNumber; +- (void *)userData; + +// +// Requesting Periodic Events +// ++ (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySeconds + withPeriod:(NSTimeInterval)periodSeconds; ++ (void)stopPeriodicEvents; + +// +// Getting Information about Specially Defined Events +// +- (int)data1; +- (int)data2; +- (short)subtype; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSEvent diff --git a/Headers/gnustep/gui/NSFont.h b/Headers/gnustep/gui/NSFont.h new file mode 100644 index 000000000..3e10a9057 --- /dev/null +++ b/Headers/gnustep/gui/NSFont.h @@ -0,0 +1,109 @@ +/* + NSFont.h + + The font class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSFont +#define _GNUstep_H_NSFont + +#include +#include + +@interface NSFont : NSObject + +{ + // Attributes + NSString *family_name; + NSString *font_name; + float point_size; + NSFontTraitMask font_traits; + + // Reserved for back-end use + void *be_font_reserved; +} + +// +// Creating a Font Object +// ++ (NSFont *)boldSystemFontOfSize:(float)fontSize; ++ (NSFont *)fontWithName:(NSString *)fontName + matrix:(const float *)fontMatrix; ++ (NSFont *)fontWithName:(NSString *)fontName + size:(float)fontSize; ++ (NSFont *)systemFontOfSize:(float)fontSize; ++ (NSFont *)userFixedPitchFontOfSize:(float)fontSize; ++ (NSFont *)userFontOfSize:(float)fontSize; + +// +// Setting the Font +// ++ (void)setUserFixedPitchFont:(NSFont *)aFont; ++ (void)setUserFont:(NSFont *)aFont; ++ (void)useFont:(NSString *)fontName; +- (void)set; + +// +// Querying the Font +// +- (NSDictionary *)afmDictionary; +- (NSString *)afmFileContents; +- (NSRect)boundingRectForFont; +- (NSString *)displayName; +- (NSString *)familyName; +- (void)setFamilyName:(NSString *)familyName; +- (NSString *)fontName; +- (BOOL)isBaseFont; +- (const float *)matrix; +- (float)pointSize; +- (void)setPointSize:(float)value; +- (NSFont *)printerFont; +- (NSFont *)screenFont; +- (float)widthOfString:(NSString *)string; +- (float *)widths; +- (NSFontTraitMask)traits; +- (void)setTraits:(NSFontTraitMask)traits; + +// +// Manipulating Glyphs +// +- (NSSize)advancementForGlyph:(NSGlyph)aGlyph; +- (NSRect)boundingRectForGlyph:(NSGlyph)aGlyph; +- (BOOL)glyphIsEncoded:(NSGlyph)aGlyph; +- (NSPoint)positionOfGlyph:(NSGlyph)curGlyph + precededByGlyph:(NSGlyph)prevGlyph +isNominal:(BOOL *)nominal; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSFont diff --git a/Headers/gnustep/gui/NSFontManager.h b/Headers/gnustep/gui/NSFontManager.h new file mode 100644 index 000000000..925af1c07 --- /dev/null +++ b/Headers/gnustep/gui/NSFontManager.h @@ -0,0 +1,122 @@ +/* + NSFontManager.h + + Manages system and user fonts + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSFontManager +#define _GNUstep_H_NSFontManager + +#include +#include +#include +#include + +@interface NSFontManager : NSObject + +{ + // Attributes + id delegate; + SEL action; + NSMutableArray *family_list; + NSMutableArray *family_metrics; + NSFont *selected_font; + NSMutableArray *font_list; + NSMenu *font_menu; +} + +// +// Managing the FontManager +// ++ (void)setFontManagerFactory:(Class)classId; ++ (void)setFontPanelFactory:(Class)classId; ++ (NSFontManager *)sharedFontManager; + +// +// Initialization +// +- (void)enumerateFamilies; + +// +// Converting Fonts +// +- (NSFont *)convertFont:(NSFont *)fontObject; +- (NSFont *)convertFont:(NSFont *)fontObject + toFamily:(NSString *)family; +- (NSFont *)convertFont:(NSFont *)fontObject + toFace:(NSString *)typeface; +- (NSFont *)convertFont:(NSFont *)fontObject + toHaveTrait:(NSFontTraitMask)trait; +- (NSFont *)convertFont:(NSFont *)fontObject + toNotHaveTrait:(NSFontTraitMask)trait; +- (NSFont *)convertFont:(NSFont *)fontObject + toSize:(float)size; +- (NSFont *)convertWeight:(BOOL)upFlag + ofFont:(NSFont *)fontObject; +- (NSFont *)fontWithFamily:(NSString *)family + traits:(NSFontTraitMask)traits +weight:(int)weight + size:(float)size; + +// +// Setting and Getting Parameters +// +- (SEL)action; +- (NSArray *)availableFonts; +- (NSArray *)familyMetrics; +- (NSMenu *)fontMenu:(BOOL)create; +- (NSFontPanel *)fontPanel:(BOOL)create; +- (BOOL)isEnabled; +- (BOOL)isMultiple; +- (NSFont *)selectedFont; +- (void)setAction:(SEL)aSelector; +- (void)setEnabled:(BOOL)flag; +- (void)setFontMenu:(NSMenu *)newMenu; +- (void)setSelectedFont:(NSFont *)fontObject + isMultiple:(BOOL)flag; +- (NSFontTraitMask)traitsOfFont:(NSFont *)fontObject; +- (int)weightOfFont:(NSFont *)fontObject; + +// +// Target and Action Methods +// +- (BOOL)sendAction; + +// +// Assigning a Delegate +// +- (id)delegate; +- (void)setDelegate:(id)anObject; + +// +// Methods Implemented by the Delegate +// +- (BOOL)fontManager:(id)sender willIncludeFont:(NSString *)fontName; + +@end + +#endif // _GNUstep_H_NSFontManager diff --git a/Headers/gnustep/gui/NSFontPanel.h b/Headers/gnustep/gui/NSFontPanel.h new file mode 100644 index 000000000..5c46aeb66 --- /dev/null +++ b/Headers/gnustep/gui/NSFontPanel.h @@ -0,0 +1,80 @@ +/* + NSFontPanel.h + + Standard panel for selecting and previewing fonts. + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSFontPanel +#define _GNUstep_H_NSFontPanel + +#include +#include +#include + +@interface NSFontPanel : NSPanel + +{ + // Attributes + NSFont *panel_font; +} + +// +// Creating an NSFontPanel +// ++ (NSFontPanel *)sharedFontPanel; +- (NSFont *)panelConvertFont:(NSFont *)fontObject; + +// +// Setting the Font +// +- (void)setPanelFont:(NSFont *)fontObject + isMultiple:(BOOL)flag; + +// +// Configuring the NSFontPanel +// +- (NSView *)accessoryView; +- (BOOL)isEnabled; +- (void)setAccessoryView:(NSView *)aView; +- (void)setEnabled:(BOOL)flag; +- (BOOL)worksWhenModal; + +// +// Displaying the NSFontPanel +// +- (void)orderWindow:(NSWindowOrderingMode)place + relativeTo:(int)otherWindows; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSFontPanel diff --git a/Headers/gnustep/gui/NSForm.h b/Headers/gnustep/gui/NSForm.h new file mode 100644 index 000000000..fc85dfc65 --- /dev/null +++ b/Headers/gnustep/gui/NSForm.h @@ -0,0 +1,105 @@ +/* + NSForm.h + + Form class, a text field with a label + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSForm +#define _GNUstep_H_NSForm + +#include +#include +#include +#include +#include + +@interface NSForm : NSMatrix + +{ + // Attributes +} + +// +// Laying Out the Form +// +- (NSFormCell *)addEntry:(NSString *)title; +- (NSFormCell *)insertEntry:(NSString *)title + atIndex:(int)index; +- (void)removeEntryAtIndex:(int)index; +- (void)setInterlineSpacing:(float)spacing; + +// +// Finding Indices +// +- (int)indexOfCellWithTag:(int)aTag; +- (int)indexOfSelectedItem; + +// +// Modifying Graphic Attributes +// +- (void)setBezeled:(BOOL)flag; +- (void)setBordered:(BOOL)flag; +- (void)setTextAlignment:(int)mode; +- (void)setTextFont:(NSFont *)fontObject; +- (void)setTitleAlignment:(NSTextAlignment)mode; +- (void)setTitleFont:(NSFont *)fontObject; + +// +// Setting the Cell Class +// ++ (Class)cellClass; ++ (void)setCellClass:(Class)classId; + +// +// Getting a Cell +// +- (id)cellAtIndex:(int)index; + +// +// Displaying a Cell +// +- (void)drawCellAtIndex:(int)index; + +// +// Editing Text +// +- (void)selectTextAtIndex:(int)index; + +// +// Resizing the Form +// +- (void)setEntryWidth:(float)width; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSForm diff --git a/Headers/gnustep/gui/NSFormCell.h b/Headers/gnustep/gui/NSFormCell.h new file mode 100644 index 000000000..cc52b48cd --- /dev/null +++ b/Headers/gnustep/gui/NSFormCell.h @@ -0,0 +1,86 @@ +/* + NSFormCell.h + + The cell class for the NSForm control + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSFormCell +#define _GNUstep_H_NSFormCell + +#include +#include +#include + +@interface NSFormCell : NSActionCell + +{ + // Attributes +} + +// +// Initializing an NSFormCell +// +- (id)initTextCell:(NSString *)aString; + +// +// Determining an NSFormCell's Size +// +- (NSSize)cellSizeForBounds:(NSRect)aRect; + +// +// Determining Graphic Attributes +// +- (BOOL)isOpaque; + +// +// Modifying the Title +// +- (void)setTitle:(NSString *)aString; +- (void)setTitleAlignment:(NSTextAlignment)mode; +- (void)setTitleFont:(NSFont *)fontObject; +- (void)setTitleWidth:(float)width; +- (NSString *)title; +- (NSTextAlignment)titleAlignment; +- (NSFont *)titleFont; +- (float)titleWidth; +- (float)titleWidth:(NSSize)aSize; + +// +// Displaying +// +- (void)drawInteriorWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSFormCell diff --git a/Headers/gnustep/gui/NSHelpPanel.h b/Headers/gnustep/gui/NSHelpPanel.h new file mode 100644 index 000000000..2cc87bad7 --- /dev/null +++ b/Headers/gnustep/gui/NSHelpPanel.h @@ -0,0 +1,87 @@ +/* + NSHelpPanel.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSHelpPanel +#define _GNUstep_H_NSHelpPanel + +#include +#include +#include + +@interface NSHelpPanel : NSPanel + +{ + // Attributes +} + +// +// Accessing the Help Panel +// ++ (NSHelpPanel *)sharedHelpPanel; ++ (NSHelpPanel *)sharedHelpPanelWithDirectory:(NSString *)helpDirectory; + +// +// Managing the Contents +// ++ (void)setHelpDirectory:(NSString *)helpDirectory; +- (void)addSupplement:(NSString *)helpDirectory + inPath:(NSString *)supplementPath; +- (NSString *)helpDirectory; +- (NSString *)helpFile; + +// +// Attaching Help to Objects +// ++ (void)attachHelpFile:(NSString *)filename + markerName:(NSString *)markerName +to:(id)anObject; ++ (void)detachHelpFrom:(id)anObject; + +// +// Showing Help +// +- (void)showFile:(NSString *)filename + atMarker:(NSString *)markerName; +- (BOOL)showHelpAttachedTo:(id)anObject; + +// +// Printing +// +- (void)print:(id)sender; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSHelpPanel diff --git a/Headers/gnustep/gui/NSImage.h b/Headers/gnustep/gui/NSImage.h new file mode 100644 index 000000000..ebac61460 --- /dev/null +++ b/Headers/gnustep/gui/NSImage.h @@ -0,0 +1,171 @@ +/* + NSImage.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSImage +#define _GNUstep_H_NSImage + +#include +#include +#include +#include +#include + +@interface NSImage : NSObject + +{ + // Attributes + NSSize image_size; +} + +// +// Initializing a New NSImage Instance +// +- (id)initByReferencingFile:(NSString *)filename; +- (id)initWithContentsOfFile:(NSString *)filename; +- (id)initWithData:(NSData *)data; +- (id)initWithPasteboard:(NSPasteboard *)pasteboard; +- (id)initWithSize:(NSSize)aSize; + +// +// Setting the Size of the Image +// +- (void)setSize:(NSSize)aSize; +- (NSSize)size; + +// +// Referring to Images by Name +// ++ (id)imageNamed:(NSString *)name; +- (BOOL)setName:(NSString *)name; +- (NSString *)name; + +// +// Specifying the Image +// +- (void)addRepresentation:(NSImageRep *)imageRep; +- (void)addRepresentations:(NSArray *)imageRepArray; +- (void)lockFocus; +- (void)lockFocusOnRepresentation:(NSImageRep *)imageRep; +- (void)unlockFocus; + +// +// Using the Image +// +- (void)compositeToPoint:(NSPoint)aPoint + operation:(NSCompositingOperation)op; +- (void)compositeToPoint:(NSPoint)aPoint + fromRect:(NSRect)aRect +operation:(NSCompositingOperation)op; +- (void)dissolveToPoint:(NSPoint)aPoint + fraction:(float)aFloat; +- (void)dissolveToPoint:(NSPoint)aPoint + fromRect:(NSRect)aRect +fraction:(float)aFloat; + +// +// Choosing Which Image Representation to Use +// +- (void)setPrefersColorMatch:(BOOL)flag; +- (BOOL)prefersColorMatch; +- (void)setUsesEPSOnResolutionMismatch:(BOOL)flag; +- (BOOL)usesEPSOnResolutionMismatch; +- (void)setMatchesOnMultipleResolution:(BOOL)flag; +- (BOOL)matchesOnMultipleResolution; + +// +// Getting the Representations +// +- (NSImageRep *)bestRepresentationForDevice:(NSDictionary *)deviceDescription; +- (NSArray *)representations; +- (void)removeRepresentation:(NSImageRep *)imageRep; + +// +// Determining How the Image is Stored +// +- (void)setCachedSeparately:(BOOL)flag; +- (BOOL)isCachedSeparately; +- (void)setDataRetained:(BOOL)flag; +- (BOOL)isDataRetained; +- (void)setCacheDepthMatchesImageDepth:(BOOL)flag; +- (BOOL)cacheDepthMatchesImageDepth; + +// +// Determining How the Image is Drawn +// +- (BOOL)isValid; +- (void)setScalesWhenResized:(BOOL)flag; +- (BOOL)scalesWhenResized; +- (void)setBackgroundColor:(NSColor *)aColor; +- (NSColor *)backgroundColor; +- (BOOL)drawRepresentation:(NSImageRep *)imageRep + inRect:(NSRect)aRect; +- (void)recache; + +// +// Assigning a Delegate +// +- (void)setDelegate:(id)anObject; +- (id)delegate; + +// +// Producing TIFF Data for the Image +// +- (NSData *)TIFFRepresentation; +- (NSData *)TIFFRepresentationUsingCompression:(NSTIFFCompression)comp + factor:(float)aFloat; + +// +// Managing NSImageRep Subclasses +// ++ (NSArray *)imageUnfilteredFileTypes; ++ (NSArray *)imageUnfilteredPasteboardTypes; + +// +// Testing Image Data Sources +// ++ (BOOL)canInitWithPasteboard:(NSPasteboard *)pasteboard; ++ (NSArray *)imageFileTypes; ++ (NSArray *)imagePasteboardTypes; + +// +// Methods Implemented by the Delegate +// +- (NSImage *)imageDidNotDraw:(id)sender + inRect:(NSRect)aRect; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSImage diff --git a/Headers/gnustep/gui/NSImageRep.h b/Headers/gnustep/gui/NSImageRep.h new file mode 100644 index 000000000..fe58d4cc1 --- /dev/null +++ b/Headers/gnustep/gui/NSImageRep.h @@ -0,0 +1,109 @@ +/* + NSImageRep.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSImageRep +#define _GNUstep_H_NSImageRep + +#include +#include +#include + +@interface NSImageRep : NSObject + +{ + // Attributes +} + +// +// Creating an NSImageRep +// ++ (id)imageRepWithContentsOfFile:(NSString *)filename; ++ (NSArray *)imageRepsWithContentsOfFile:(NSString *)filename; ++ (id)imageRepWithPasteboard:(NSPasteboard *)pasteboard; ++ (NSArray *)imageRepsWithPasteboard:(NSPasteboard *)pasteboard; + +// +// Checking Data Types +// ++ (BOOL)canInitWithData:(NSData *)data; ++ (BOOL)canInitWithPasteboard:(NSPasteboard *)pasteboard; ++ (NSArray *)imageFileTypes; ++ (NSArray *)imagePasteboardTypes; ++ (NSArray *)imageUnfilteredFileTypes; ++ (NSArray *)imageUnfilteredPasteboardTypes; + +// +// Setting the Size of the Image +// +- (void)setSize:(NSSize)aSize; +- (NSSize)size; + +// +// Specifying Information about the Representation +// +- (int)bitsPerSample; +- (NSString *)colorSpaceName; +- (BOOL)hasAlpha; +- (BOOL)isOpaque; +- (int)pixelsHigh; +- (int)pixelsWide; +- (void)setAlpha:(BOOL)flag; +- (void)setBitsPerSample:(int)anInt; +- (void)setColorSpaceName:(NSString *)aString; +- (void)setOpaque:(BOOL)flag; +- (void)setPixelsHigh:(int)anInt; +- (void)setPixelsWide:(int)anInt; + +// +// Drawing the Image +// +- (BOOL)draw; +- (BOOL)drawAtPoint:(NSPoint)aPoint; +- (BOOL)drawInRect:(NSRect)aRect; + +// +// Managing NSImageRep Subclasses +// ++ (Class)imageRepClassForData:(NSData *)data; ++ (Class)imageRepClassForFileType:(NSString *)type; ++ (Class)imageRepClassForPasteboardType:(NSString *)type; ++ (void)registerImageRepClass:(Class)imageRepClass; ++ (NSArray *)registeredImageRepClasses; ++ (void)unregisterImageRepClass:(Class)imageRepClass; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSImageRep diff --git a/Headers/gnustep/gui/NSMatrix.h b/Headers/gnustep/gui/NSMatrix.h new file mode 100644 index 000000000..8c5bd72c0 --- /dev/null +++ b/Headers/gnustep/gui/NSMatrix.h @@ -0,0 +1,281 @@ +/* + NSMatrix.h + + This is the Matrix class. This class corresponds to NSMatrix + of the OpenStep specification, but it also allows for rows + and columns of different sizes. + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Pascal Forget + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSMatrix +#define _GNUstep_H_NSMatrix + +#include +#include +#include + +@interface NSMatrix : NSControl + +{ + // Attributes + NSMutableArray *rows; + NSMutableArray *col_widths; + NSMutableArray *row_heights; + int num_cols; + int num_rows; + NSCell *cell_prototype; + NSSize inter_cell; + Class cell_class; + BOOL allows_empty_selection; + BOOL selection_by_rect; + BOOL draws_background; + BOOL draws_cell_background; + NSMutableArray *selected_cells; + BOOL autoscroll; + BOOL scrollable; + BOOL autosize; + NSMatrixMode mode; + SEL double_action; + SEL error_action; +} + +// +// Initializing the NSMatrix Class +// ++ (Class)cellClass; ++ (void)setCellClass:(Class)classId; + +// +// Initializing an NSMatrix Object +// +- (id)initWithFrame:(NSRect)frameRect; +- (id)initWithFrame:(NSRect)frameRect + mode:(int)aMode + cellClass:(Class)classId + numberOfRows:(int)rowsHigh + numberOfColumns:(int)colsWide; +- (id)initWithFrame:(NSRect)frameRect + mode:(int)aMode + prototype:(NSCell *)aCell + numberOfRows:(int)rowsHigh + numberOfColumns:(int)colsWide; + +// +// Setting the Selection Mode +// +- (NSMatrixMode)mode; +- (void)setMode:(NSMatrixMode)aMode; + +// +// Configuring the NSMatrix +// +- (BOOL)allowsEmptySelection; +- (BOOL)isSelectionByRect; +- (void)setAllowsEmptySelection:(BOOL)flag; +- (void)setSelectionByRect:(BOOL)flag; + +// +// Setting the Cell Class +// +- (Class)cellClass; +- (id)prototype; +- (void)setCellClass:(Class)classId; +- (void)setPrototype:(NSCell *)aCell; + +// +// Laying Out the NSMatrix +// +- (void)addColumn; +- (void)addColumnWithCells:(NSArray *)cellArray; +- (void)addRow; +- (void)addRowWithCells:(NSArray *)cellArray; +- (NSRect)cellFrameAtRow:(int)row + column:(int)column; +- (NSSize)cellSize; +- (void)getNumberOfRows:(int *)rowCount + columns:(int *)columnCount; +- (void)insertColumn:(int)column; +- (void)insertColumn:(int)column withCells:(NSArray *)cellArray; +- (void)insertRow:(int)row; +- (void)insertRow:(int)row withCells:(NSArray *)cellArray; +- (NSSize)intercellSpacing; +- (NSCell *)makeCellAtRow:(int)row + column:(int)column; +- (void)putCell:(NSCell *)newCell + atRow:(int)row + column:(int)column; +- (void)removeColumn:(int)column; +- (void)removeRow:(int)row; +- (void)renewRows:(int)newRows + columns:(int)newColumns; +- (void)setCellSize:(NSSize)aSize; +- (void)setIntercellSpacing:(NSSize)aSize; +- (void)sortUsingFunction:(int (*)(id element1, id element2, void *userData))comparator + context:(void *)context; +- (void)sortUsingSelector:(SEL)comparator; + +// +// Finding Matrix Coordinates +// +- (BOOL)getRow:(int *)row + column:(int *)column + forPoint:(NSPoint)aPoint; +- (BOOL)getRow:(int *)row + column:(int *)column + ofCell:(NSCell *)aCell; + +// +// Modifying Individual Cells +// +- (void)setState:(int)value + atRow:(int)row + column:(int)column; + +// +// Selecting Cells +// +- (void)deselectAllCells; +- (void)deselectSelectedCell; +- (void)selectAll:(id)sender; +- (void)selectCellAtRow:(int)row + column:(int)column; +- (BOOL)selectCellWithTag:(int)anInt; +- (id)selectedCell; +- (NSArray *)selectedCells; +- (int)selectedColumn; +- (int)selectedRow; +- (void)setSelectionFrom:(int)startPos + to:(int)endPos + anchor:(int)anchorPos + highlight:(BOOL)flag; + +// +// Finding Cells +// +- (id)cellAtRow:(int)row + column:(int)column; +- (id)cellWithTag:(int)anInt; +- (NSArray *)cells; + +// +// Modifying Graphic Attributes +// +- (NSColor *)backgroundColor; +- (NSColor *)cellBackgroundColor; +- (BOOL)drawsBackground; +- (BOOL)drawsCellBackground; +- (void)setBackgroundColor:(NSColor *)aColor; +- (void)setCellBackgroundColor:(NSColor *)aColor; +- (void)setDrawsBackground:(BOOL)flag; +- (void)setDrawsCellBackground:(BOOL)flag; + +// +// Editing Text in Cells +// +- (void)selectText:(id)sender; +- (id)selectTextAtRow:(int)row + column:(int)column; +- (void)textDidBeginEditing:(NSNotification *)notification; +- (void)textDidChange:(NSNotification *)notification; +- (void)textDidEndEditing:(NSNotification *)notification; +- (BOOL)textShouldBeginEditing:(NSText *)textObject; +- (BOOL)textShouldEndEditing:(NSText *)textObject; + +// +// Setting Tab Key Behavior +// +- (id)nextText; +- (id)previousText; +- (void)setNextText:(id)anObject; +- (void)setPreviousText:(id)anObject; + +// +// Assigning a Delegate +// +- (void)setDelegate:(id)anObject; +- (id)delegate; + +// +// Resizing the Matrix and Cells +// +- (BOOL)autosizesCells; +- (void)setAutosizesCells:(BOOL)flag; +- (void)setValidateSize:(BOOL)flag; +- (void)sizeToCells; + +// +// Scrolling +// +- (BOOL)isAutoscroll; +- (void)scrollCellToVisibleAtRow:(int)row + column:(int)column; +- (void)setAutoscroll:(BOOL)flag; +- (void)setScrollable:(BOOL)flag; + +// +// Displaying +// +- (void)drawCellAtRow:(int)row + column:(int)column; +- (void)highlightCell:(BOOL)flag + atRow:(int)row +column:(int)column; + +// +//Target and Action +// +- (SEL)doubleAction; +- (void)setDoubleAction:(SEL)aSelector; +- (SEL)errorAction; +- (BOOL)sendAction; +- (void)sendAction:(SEL)aSelector + to:(id)anObject + forAllCells:(BOOL)flag; +- (void)sendDoubleAction; +- (void)setErrorAction:(SEL)aSelector; + +// +// Handling Event and Action Messages +// +- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent; +- (void)mouseDown:(NSEvent *)theEvent; +- (int)mouseDownFlags; +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent; + +// +// Managing the Cursor +// +- (void)resetCursorRects; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSMatrix diff --git a/Headers/gnustep/gui/NSMenu.h b/Headers/gnustep/gui/NSMenu.h new file mode 100644 index 000000000..1442ac94c --- /dev/null +++ b/Headers/gnustep/gui/NSMenu.h @@ -0,0 +1,112 @@ +/* + NSMenu.h + + The menu class + Here is your menu sir, our specials today are... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSMenu +#define _GNUstep_H_NSMenu + +#include +#include +#include +#include +#include + +@interface NSMenu : NSWindow + +{ + // Attributes + NSMutableArray *menu_items; + + // Reserved for back-end use + void *be_menu_reserved; +} + +// +// Controlling Allocation Zones +// ++ (NSZone *)menuZone; ++ (void)setMenuZone:(NSZone *)zone; + +// +// Initializing a New NSMenu +// +- (id)initWithTitle:(NSString *)aTitle; + +// +// Setting Up the Menu Commands +// +- (id)addItemWithTitle:(NSString *)aString + action:(SEL)aSelector +keyEquivalent:(NSString *)charCode; +- (id)insertItemWithTitle:(NSString *)aString + action:(SEL)aSelector +keyEquivalent:(NSString *)charCode + atIndex:(unsigned int)index; +- (NSArray *)itemArray; +- (NSMatrix *)itemMatrix; +- (void)setItemMatrix:(NSMatrix *)aMatrix; + +// +// Finding Menu Items +// +- (id)cellWithTag:(int)aTag; + +// +// Building Submenus +// +- (NSMenuCell *)setSubmenu:(NSMenu *)aMenu + forItem:(NSMenuCell *)aCell; +- (void)submenuAction:(id)sender; + +// +// Managing NSMenu Windows +// +- (NSMenu *)attachedMenu; +- (BOOL)isAttached; +- (BOOL)isTornOff; +- (NSPoint)locationForSubmenu:(NSMenu *)aSubmenu; +- (void)sizeToFit; +- (NSMenu *)supermenu; + +// +// Displaying the Menu +// +- (BOOL)autoenablesItems; +- (void)setAutoenablesItems:(BOOL)flag; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSMenu diff --git a/Headers/gnustep/gui/NSMenuCell.h b/Headers/gnustep/gui/NSMenuCell.h new file mode 100644 index 000000000..fb2c571f2 --- /dev/null +++ b/Headers/gnustep/gui/NSMenuCell.h @@ -0,0 +1,80 @@ +/* + NSMenuCell.h + + Cell class for menu items + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSMenuCell +#define _GNUstep_H_NSMenuCell + +#include +#include +#include + +@class NSMenu; + +@interface NSMenuCell : NSButtonCell + +{ + // Attributes + NSString *key_equivalent; + NSMenu *sub_menu; + unsigned int menu_identifier; + + // Reserved for back-end use + void *be_mc_reserved; +} + +// +// WIN32 methods +// +- (unsigned int)menuIdentifier; +- (void)setMenuIdentifier:(unsigned int)theID; + +// +// Checking for a Submenu +// +- (BOOL)hasSubmenu; +- (NSMenu *)submenu; +- (void)setSubmenu:(NSMenu *)aMenu; + +// +// Managing User Key Equivalents +// ++ (void)setUsesUserKeyEquivalents:(BOOL)flag; ++ (BOOL)usesUserKeyEquivalents; +- (NSString *)userKeyEquivalent; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSMenuCell diff --git a/Headers/gnustep/gui/NSOpenPanel.h b/Headers/gnustep/gui/NSOpenPanel.h new file mode 100644 index 000000000..cd0ea26bc --- /dev/null +++ b/Headers/gnustep/gui/NSOpenPanel.h @@ -0,0 +1,84 @@ +/* + NSOpenPanel.h + + Standard open panel for opening files + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSOpenPanel +#define _GNUstep_H_NSOpenPanel + +#include +#include +#include + +@interface NSOpenPanel : NSSavePanel + +{ + // Attributes + NSMutableArray *the_filenames; + BOOL multiple_select; + BOOL choose_dir; + BOOL choose_file; +} + +// +// Accessing the NSOpenPanel +// ++ (NSOpenPanel *)openPanel; + +// +// Filtering Files +// +- (BOOL)allowsMultipleSelection; +- (BOOL)canChooseDirectories; +- (BOOL)canChooseFiles; +- (void)setAllowsMultipleSelection:(BOOL)flag; +- (void)setCanChooseDirectories:(BOOL)flag; +- (void)setCanChooseFiles:(BOOL)flag; + +// +// Querying the Chosen Files +// +- (NSArray *)filenames; + +// +// Running the NSOpenPanel +// +- (int)runModalForTypes:(NSArray *)fileTypes; +- (int)runModalForDirectory:(NSString *)path + file:(NSString *)filename +types:(NSArray *)fileTypes; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSOpenPanel diff --git a/Headers/gnustep/gui/NSPageLayout.h b/Headers/gnustep/gui/NSPageLayout.h new file mode 100644 index 000000000..4feb1c59f --- /dev/null +++ b/Headers/gnustep/gui/NSPageLayout.h @@ -0,0 +1,87 @@ +/* + NSPageLayout.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSPageLayout +#define _GNUstep_H_NSPageLayout + +#include +#include +#include +#include + +@interface NSPageLayout : NSPanel + +{ + // Attributes +} + +// +// Creating an NSPageLayout Instance +// ++ (NSPageLayout *)pageLayout; + +// +// Running the Panel +// +- (int)runModal; +- (int)runModalWithPrintInfo:(NSPrintInfo *)pInfo; + +// +// Customizing the Panel +// +- (NSView *)accessoryView; +- (void)setAccessoryView:(NSView *)aView; + +// +// Updating the Panel's Display +// +- (void)convertOldFactor:(float *)old + newFactor:(float *)new; +- (void)pickedButton:(id)sender; +- (void)pickedOrientation:(id)sender; +- (void)pickedPaperSize:(id)sender; +- (void)pickedUnits:(id)sender; + +// +// Communicating with the NSPrintInfo Object +// +- (NSPrintInfo *)printInfo; +- (void)readPrintInfo; +- (void)writePrintInfo; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSPageLayout diff --git a/Headers/gnustep/gui/NSPanel.h b/Headers/gnustep/gui/NSPanel.h new file mode 100644 index 000000000..c7fb1144f --- /dev/null +++ b/Headers/gnustep/gui/NSPanel.h @@ -0,0 +1,62 @@ +/* + NSPanel.h + + Panel window class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSPanel +#define _GNUstep_H_NSPanel + +#include +#include +#include + +@interface NSPanel : NSWindow + +{ + // Attributes +} + +// +// Determining the Panel Behavior +// +- (BOOL)becomesKeyOnlyIfNeeded; +- (BOOL)isFloatingPanel; +- (void)setBecomesKeyOnlyIfNeeded:(BOOL)flag; +- (void)setFloatingPanel:(BOOL)flag; +- (void)setWorksWhenModal:(BOOL)flag; +- (BOOL)worksWhenModal; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSPanel diff --git a/Headers/gnustep/gui/NSPasteboard.h b/Headers/gnustep/gui/NSPasteboard.h new file mode 100644 index 000000000..598844bc8 --- /dev/null +++ b/Headers/gnustep/gui/NSPasteboard.h @@ -0,0 +1,104 @@ +/* + NSPasteboard.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSPasteboard +#define _GNUstep_H_NSPasteboard + +#include + +@interface NSPasteboard : NSObject + +{ + // Attributes +} + +// +// Creating and Releasing an NSPasteboard Object +// ++ (NSPasteboard *)generalPasteboard; ++ (NSPasteboard *)pasteboardWithName:(NSString *)name; ++ (NSPasteboard *)pasteboardWithUniqueName; +- (void)releaseGlobally; + +// +// Getting Data in Different Formats +// ++ (NSPasteboard *)pasteboardByFilteringData:(NSData *)data + ofType:(NSString *)type; ++ (NSPasteboard *)pasteboardByFilteringFile:(NSString *)filename; ++ (NSPasteboard *)pasteboardByFilteringTypesInPasteboard:(NSPasteboard *)pboard; ++ (NSArray *)typesFilterableTo:(NSString *)type; + +// +// Referring to a Pasteboard by Name +// +- (NSString *)name; + +// +// Writing Data +// +- (int)addTypes:(NSArray *)newTypes + owner:(id)newOwner; +- (int)declareTypes:(NSArray *)newTypes + owner:(id)newOwner; +- (BOOL)setData:(NSData *)data + forType:(NSString *)dataType; +- (BOOL)setPropertyList:(id)propertyList + forType:(NSString *)dataType; +- (BOOL)setString:(NSString *)string + forType:(NSString *)dataType; +- (BOOL)writeFileContents:(NSString *)filename; + +// +// Determining Types +// +- (NSString *)availableTypeFromArray:(NSArray *)types; +- (NSArray *)types; + +// +// Reading Data +// +- (int)changeCount; +- (NSData *)dataForType:(NSString *)dataType; +- (id)propertyListForType:(NSString *)dataType; +- (NSString *)readFileContentsType:(NSString *)type + toFile:(NSString *)filename; +- (NSString *)stringForType:(NSString *)dataType; + +// +// Methods Implemented by the Owner +// +- (void)pasteboard:(NSPasteboard *)sender +provideDataForType:(NSString *)type; +- (void)pasteboardChangedOwner:(NSPasteboard *)sender; + +@end + +#endif // _GNUstep_H_NSPasteboard diff --git a/Headers/gnustep/gui/NSPopUpButton.h b/Headers/gnustep/gui/NSPopUpButton.h new file mode 100644 index 000000000..d73feaa6a --- /dev/null +++ b/Headers/gnustep/gui/NSPopUpButton.h @@ -0,0 +1,128 @@ +/* + NSPopUpButton.h + + Popup list class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSPopUpButton +#define _GNUstep_H_NSPopUpButton + +#include +#include +#include +#include +#include +#include + +@interface NSPopUpButton : NSView + +{ + // Attributes + NSMutableArray *list_items; + NSRect list_rect; + int selected_item; + id pub_target; + SEL pub_action; + BOOL is_up; + BOOL pulls_down; + + // Reserved for back-end use + void *be_pub_reserved; +} + +// +// Initializing an NSPopUpButton +// +- (id)initWithFrame:(NSRect)frameRect + pullsDown:(BOOL)flag; + +// +// Target and Action +// +- (SEL)action; +- (void)setAction:(SEL)aSelector; +- (id)target; +- (void)setTarget:(id)anObject; + +// +// Adding Items +// +- (void)addItemWithTitle:(NSString *)title; +- (void)addItemsWithTitles:(NSArray *)itemTitles; +- (void)insertItemWithTitle:(NSString *)title + atIndex:(unsigned int)index; + +// +// Removing Items +// +- (void)removeAllItems; +- (void)removeItemWithTitle:(NSString *)title; +- (void)removeItemAtIndex:(int)index; + +// +// Querying the NSPopUpButton about Its Items +// +- (int)indexOfItemWithTitle:(NSString *)title; +- (int)indexOfSelectedItem; +- (int)numberOfItems; +- (NSMenuCell *)itemAtIndex:(int)index; +- (NSMatrix *)itemMatrix; +- (NSString *)itemTitleAtIndex:(int)index; +- (NSArray *)itemTitles; +- (NSMenuCell *)itemWithTitle:(NSString *)title; +- (NSMenuCell *)lastItem; +- (NSMenuCell *)selectedItem; +- (NSString *)titleOfSelectedItem; + +// +// Manipulating the NSPopUpButton +// +- (NSFont *)font; +- (BOOL)pullsDown; +- (void)selectItemAtIndex:(int)index; +- (void)selectItemWithTitle:(NSString *)title; +- (void)setFont:(NSFont *)fontObject; +- (void)setPullsDown:(BOOL)flag; +- (void)setTitle:(NSString *)aString; +- (NSString *)stringValue; +- (void)synchronizeTitleAndSelectedItem; + +// +// Displaying the NSPopUpButton's Items +// +- (BOOL)autoenablesItems; +- (void)setAutoenablesItems:(BOOL)flag; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSPopUpButton diff --git a/Headers/gnustep/gui/NSPrintInfo.h b/Headers/gnustep/gui/NSPrintInfo.h new file mode 100644 index 000000000..b6660af41 --- /dev/null +++ b/Headers/gnustep/gui/NSPrintInfo.h @@ -0,0 +1,119 @@ +/* + NSPrintInfo.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSPrintInfo +#define _GNUstep_H_NSPrintInfo + +#include +#include +#include +#include + +@interface NSPrintInfo : NSObject + +{ + // Attributes +} + +// +// Creating and Initializing an NSPrintInfo Instance +// +- (id)initWithDictionary:(NSDictionary *)aDict; + +// +// Managing the Shared NSPrintInfo Object +// ++ (void)setSharedPrintInfo:(NSPrintInfo *)printInfo; ++ (NSPrintInfo *)sharedPrintInfo; + +// +// Managing the Printing Rectangle +// ++ (NSSize)sizeForPaperName:(NSString *)name; +- (float)bottomMargin; +- (float)leftMargin; +- (NSPrintingOrientation)orientation; +- (NSString *)paperName; +- (NSSize)paperSize; +- (float)rightMargin; +- (void)setBottomMargin:(float)value; +- (void)setLeftMargin:(float)value; +- (void)setOrientation:(NSPrintingOrientation)mode; +- (void)setPaperName:(NSString *)name; +- (void)setPaperSize:(NSSize)size; +- (void)setRightMargin:(float)value; +- (void)setTopMargin:(float)value; +- (float)topMargin; + +// +// Pagination +// +- (NSPrintingPaginationMode)horizontalPagination; +- (void)setHorizontalPagination:(NSPrintingPaginationMode)mode; +- (void)setVerticalPagination:(NSPrintingPaginationMode)mode; +- (NSPrintingPaginationMode)verticalPagination; + +// +// Positioning the Image on the Page +// +- (BOOL)isHorizontallyCentered; +- (BOOL)isVerticallyCentered; +- (void)setHorizontallyCentered:(BOOL)flag; +- (void)setVerticallyCentered:(BOOL)flag; + +// +// Specifying the Printer +// ++ (NSPrinter *)defaultPrinter; ++ (void)setDefaultPrinter:(NSPrinter *)printer; +- (NSPrinter *)printer; +- (void)setPrinter:(NSPrinter *)aPrinter; + +// +// Controlling Printing +// +- (NSString *)jobDisposition; +- (void)setJobDisposition:(NSString *)disposition; +- (void)setUpPrintOperationDefaultValues; + +// +// Accessing the NSPrintInfo Object's Dictionary +// +- (NSMutableDictionary *)dictionary; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSPrintInfo diff --git a/Headers/gnustep/gui/NSPrintOperation.h b/Headers/gnustep/gui/NSPrintOperation.h new file mode 100644 index 000000000..30bee8911 --- /dev/null +++ b/Headers/gnustep/gui/NSPrintOperation.h @@ -0,0 +1,123 @@ +/* + NSPrintOperation.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSPrintOperation +#define _GNUstep_H_NSPrintOperation + +#include +#include +#include +#include +#include + +@interface NSPrintOperation : NSObject + +{ + // Attributes +} + +// +// Creating and Initializing an NSPrintOperation Object +// ++ (NSPrintOperation *)EPSOperationWithView:(NSView *)aView + insideRect:(NSRect)rect +toData:(NSMutableData *)data; ++ (NSPrintOperation *)EPSOperationWithView:(NSView *)aView + insideRect:(NSRect)rect +toData:(NSMutableData *)data + printInfo:(NSPrintInfo *)aPrintInfo; ++ (NSPrintOperation *)EPSOperationWithView:(NSView *)aView + insideRect:(NSRect)rect +toPath:(NSString *)path + printInfo:(NSPrintInfo *)aPrintInfo; ++ (NSPrintOperation *)printOperationWithView:(NSView *)aView; ++ (NSPrintOperation *)printOperationWithView:(NSView *)aView + printInfo:(NSPrintInfo *)aPrintInfo; +- (id)initEPSOperationWithView:(NSView *)aView + insideRect:(NSRect)rect +toData:(NSMutableData *)data + printInfo:(NSPrintInfo *)aPrintInfo; +- (id)initWithView:(NSView *)aView + printInfo:(NSPrintInfo *)aPrintInfo; + +// +// Setting the Print Operation +// ++ (NSPrintOperation *)currentOperation; ++ (void)setCurrentOperation:(NSPrintOperation *)operation; + +// +// Determining the Type of Operation +// +- (BOOL)isEPSOperation; + +// +// Controlling the User Interface +// +- (NSPrintPanel *)printPanel; +- (BOOL)showPanels; +- (void)setPrintPanel:(NSPrintPanel *)panel; +- (void)setShowPanels:(BOOL)flag; + +// +// Managing the DPS Context +// +- (NSDPSContext *)createContext; +- (NSDPSContext *)context; +- (void)destroyContext; + +// +// Page Information +// +- (int)currentPage; +- (NSPrintingPageOrder)pageOrder; +- (void)setPageOrder:(NSPrintingPageOrder)order; + +// +// Running a Print Operation +// +- (void)cleanUpOperation; +- (BOOL)deliverResult; +- (BOOL)runOperation; + +// +// Getting the NSPrintInfo Object +// +- (NSPrintInfo *)printInfo; +- (void)setPrintInfo:(NSPrintInfo *)aPrintInfo; + +// +// Getting the NSView Object +// +- (NSView *)view; + +@end + +#endif // _GNUstep_H_NSPrintOperation diff --git a/Headers/gnustep/gui/NSPrintPanel.h b/Headers/gnustep/gui/NSPrintPanel.h new file mode 100644 index 000000000..1cc011668 --- /dev/null +++ b/Headers/gnustep/gui/NSPrintPanel.h @@ -0,0 +1,81 @@ +/* + NSPrintPanel.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSPrintPanel +#define _GNUstep_H_NSPrintPanel + +#include +#include +#include + +@interface NSPrintPanel : NSPanel + +{ + // Attributes +} + +// +// Creating an NSPrintPanel +// ++ (NSPrintPanel *)printPanel; + +// +// Customizing the Panel +// +- (void)setAccessoryView:(NSView *)aView; +- (NSView *)accessoryView; + +// +// Running the Panel +// +- (int)runModal; +- (void)pickedButton:(id)sender; + +// +// Updating the Panel's Display +// +- (void)pickedAllPages:(id)sender; +- (void)pickedLayoutList:(id)sender; + +// +// Communicating with the NSPrintInfo Object +// +- (void)updateFromPrintInfo; +- (void)finalWritePrintInfo; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSPrintPanel diff --git a/Headers/gnustep/gui/NSPrinter.h b/Headers/gnustep/gui/NSPrinter.h new file mode 100644 index 000000000..728a562b8 --- /dev/null +++ b/Headers/gnustep/gui/NSPrinter.h @@ -0,0 +1,99 @@ +/* + NSPrinter.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSPrinter +#define _GNUstep_H_NSPrinter + +#include +#include + +@interface NSPrinter : NSObject + +{ + // Attributes +} + +// +// Finding an NSPrinter +// ++ (NSPrinter *)printerWithName:(NSString *)name; ++ (NSPrinter *)printerWithType:(NSString *)type; ++ (NSArray *)printerTypes; + +// +// Printer Attributes +// +- (NSString *)host; +- (NSString *)name; +- (NSString *)note; +- (NSString *)type; + +// +// Retrieving Specific Information +// +- (BOOL)acceptsBinary; +- (NSRect)imageRectForPaper:(NSString *)paperName; +- (NSSize)pageSizeForPaper:(NSString *)paperName; +- (BOOL)isColor; +- (BOOL)isFontAvailable:(NSString *)fontName; +- (int)languageLevel; +- (BOOL)isOutputStackInReverseOrder; + +// +// Querying the NSPrinter Tables +// +- (BOOL)booleanForKey:(NSString *)key + inTable:(NSString *)table; +- (NSDictionary *)deviceDescription; +- (float)floatForKey:(NSString *)key + inTable:(NSString *)table; +- (int)intForKey:(NSString *)key + inTable:(NSString *)table; +- (NSRect)rectForKey:(NSString *)key + inTable:(NSString *)table; +- (NSSize)sizeForKey:(NSString *)key + inTable:(NSString *)table; +- (NSString *)stringForKey:(NSString *)key + inTable:(NSString *)table; +- (NSArray *)stringListForKey:(NSString *)key + inTable:(NSString *)table; +- (NSPrinterTableStatus)statusForTable:(NSString *)table; +- (BOOL)isKey:(NSString *)key + inTable:(NSString *)table; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSPrinter diff --git a/Headers/gnustep/gui/NSResponder.h b/Headers/gnustep/gui/NSResponder.h new file mode 100644 index 000000000..f4f745bfc --- /dev/null +++ b/Headers/gnustep/gui/NSResponder.h @@ -0,0 +1,103 @@ +/* + NSResponder.h + + Abstract class which is basis of command and event processing + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSResponder +#define _GNUstep_H_NSResponder + +#include +#include +#include +#include +#include +#include + +@interface NSResponder : NSObject + +{ + // Attributes + id next_responder; +} + +// +// Instance methods +// + +// +// Managing the next responder +// +- nextResponder; +- (void)setNextResponder:aResponder; + +// +// Determining the first responder +// +- (BOOL)acceptsFirstResponder; +- (BOOL)becomeFirstResponder; +- (BOOL)resignFirstResponder; + +// +// Aid event processing +// +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent; +- (BOOL)tryToPerform:(SEL)anAction with:anObject; + +// +// Forwarding event messages +// +- (void)flagsChanged:(NSEvent *)theEvent; +- (void)helpRequested:(NSEvent *)theEvent; +- (void)keyDown:(NSEvent *)theEvent; +- (void)keyUp:(NSEvent *)theEvent; +- (void)mouseDown:(NSEvent *)theEvent; +- (void)mouseDragged:(NSEvent *)theEvent; +- (void)mouseEntered:(NSEvent *)theEvent; +- (void)mouseExited:(NSEvent *)theEvent; +- (void)mouseMoved:(NSEvent *)theEvent; +- (void)mouseUp:(NSEvent *)theEvent; +- (void)noResponderFor:(SEL)eventSelector; +- (void)rightMouseDown:(NSEvent *)theEvent; +- (void)rightMouseDragged:(NSEvent *)theEvent; +- (void)rightMouseUp:(NSEvent *)theEvent; + +// +// Services menu support +// +- validRequestorForSendType:(NSString *)typeSent + returnType:(NSString *)typeReturned; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSResponder diff --git a/Headers/gnustep/gui/NSSavePanel.h b/Headers/gnustep/gui/NSSavePanel.h new file mode 100644 index 000000000..b90f8d8f6 --- /dev/null +++ b/Headers/gnustep/gui/NSSavePanel.h @@ -0,0 +1,133 @@ +/* + NSSavePanel.h + + Standard save panel for saving files + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSSavePanel +#define _GNUstep_H_NSSavePanel + +#include +#include +#include +#include + + +// Should be subclassed from NSPanel but +// we are using the WIN32 common dialog +@interface NSSavePanel : NSObject + +{ + // Attributes + NSView *accessory_view; + NSString *panel_title; + NSString *panel_prompt; + NSString *directory; + NSString *file_name; + NSString *required_type; + BOOL file_package; + id delegate; + + // Reserved for back-end use + void *be_save_reserved; +} + +// +// Creating an NSSavePanel +// ++ (NSSavePanel *)savePanel; + +// +// Customizing the NSSavePanel +// +- (void)setDefaults; +- (void)setAccessoryView:(NSView *)aView; +- (NSView *)accessoryView; +- (void)setTitle:(NSString *)title; +- (NSString *)title; +- (void)setPrompt:(NSString *)prompt; +- (NSString *)prompt; + +// +// Setting Directory and File Type +// +- (NSString *)requiredFileType; +- (void)setDirectory:(NSString *)path; +- (void)setRequiredFileType:(NSString *)type; +- (void)setTreatsFilePackagesAsDirectories:(BOOL)flag; +- (BOOL)treatsFilePackagesAsDirectories; + +// +// Running the NSSavePanel +// +- (int)runModalForDirectory:(NSString *)path + file:(NSString *)filename; +- (int)runModal; + +// +// Reading Save Information +// +- (NSString *)directory; +- (NSString *)filename; + +// +// Target and Action Methods +// +- (void)ok:(id)sender; +- (void)cancel:(id)sender; + +// +// Responding to User Input +// +- (void)selectText:(id)sender; + +// +// Setting the Delegate +// +- (void)setDelegate:(id)anObject; + +// +// Methods Implemented by the Delegate +// +- (NSComparisonResult)panel:(id)sender + compareFilename:(NSString *)filename1 +with:(NSString *)filename2 + caseSensitive:(BOOL)caseSensitive; +- (BOOL)panel:(id)sender +shouldShowFilename:(NSString *)filename; +- (BOOL)panel:(id)sender +isValidFilename:(NSString*)filename; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSSavePanel diff --git a/Headers/gnustep/gui/NSScreen.h b/Headers/gnustep/gui/NSScreen.h new file mode 100644 index 000000000..4b9ad4919 --- /dev/null +++ b/Headers/gnustep/gui/NSScreen.h @@ -0,0 +1,59 @@ +/* + NSScreen.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSScreen +#define _GNUstep_H_NSScreen + +#include +#include + +@interface NSScreen : NSObject + +{ + // Attributes +} + +// +// Creating NSScreen Instances +// ++ (NSScreen *)mainScreen; ++ (NSScreen *)deepestScreen; ++ (NSArray *)screens; + +// +// Reading Screen Information +// +- (NSWindowDepth)depth; +- (NSRect)frame; +- (NSDictionary *)deviceDescription; + +@end + +#endif // _GNUstep_H_NSScreen diff --git a/Headers/gnustep/gui/NSScrollView.h b/Headers/gnustep/gui/NSScrollView.h new file mode 100644 index 000000000..7cc017ce0 --- /dev/null +++ b/Headers/gnustep/gui/NSScrollView.h @@ -0,0 +1,112 @@ +/* + NSScrollView.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSScrollView +#define _GNUstep_H_NSScrollView + +#include +#include +#include +#include + +@interface NSScrollView : NSView + +{ + // Attributes +} + +// +// Determining Component Sizes +// +- (NSSize)contentSize; +- (NSRect)documentVisibleRect; + +// +// Laying Out the NSScrollView +// ++ (NSSize)contentSizeForFrameSize:(NSSize)size + hasHorizontalScroller:(BOOL)horizFlag +hasVerticalScroller:(BOOL)vertFlag + borderType:(NSBorderType)aType; ++ (NSSize)frameSizeForContentSize:(NSSize)size + hasHorizontalScroller:(BOOL)horizFlag +hasVerticalScroller:(BOOL)vertFlag + borderType:(NSBorderType)aType; +- (void)setHasHorizontalScroller:(BOOL)flag; +- (BOOL)hasHorizontalScroller; +- (void)setHasVerticalScroller:(BOOL)flag; +- (BOOL)hasVerticalScroller; +- (void)tile; +- (void)toggleRuler:(id)sender; +- (BOOL)isRulerVisible; + +// +// Managing Component Views +// +- (void)setDocumentView:(NSView *)aView; +- (id)documentView; +- (void)setHorizontalScroller:(NSScroller *)anObject; +- (NSScroller *)horizontalScroller; +- (void)setVerticalScroller:(NSScroller *)anObject; +- (NSScroller *)verticalScroller; +- (void)reflectScrolledClipView:(NSClipView *)cView; + +// +// Modifying Graphic Attributes +// +- (void)setBorderType:(NSBorderType)aType; +- (NSBorderType)borderType; +- (void)setBackgroundColor:(NSColor *)color; +- (NSColor *)backgroundColor; + +// +// Setting Scrolling Behavior +// +- (float)lineScroll; +- (float)pageScroll; +- (void)setScrollsDynamically:(BOOL)flag; +- (BOOL)scrollsDynamically; +- (void)setLineScroll:(float)value; +- (void)setPageScroll:(float)value; + +// +// Managing the Cursor +// +- (void)setDocumentCursor:(NSCursor *)anObject; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSScrollView diff --git a/Headers/gnustep/gui/NSScroller.h b/Headers/gnustep/gui/NSScroller.h new file mode 100644 index 000000000..8b3c5d168 --- /dev/null +++ b/Headers/gnustep/gui/NSScroller.h @@ -0,0 +1,96 @@ +/* + NSScroller.h + + The scroller class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSScroller +#define _GNUstep_H_NSScroller + +#include +#include +#include + +@interface NSScroller : NSControl + +{ + // Attributes + BOOL is_horizontal; + SEL action; + id target; + float percent; + float cur_value; + + // Reserved for back-end use + void *be_scroll_reserved; +} + +// +// Laying out the NSScroller +// ++ (float)scrollerWidth; +- (NSScrollArrowPosition)arrowsPosition; +- (void)checkSpaceForParts; +- (NSRect)rectForPart:(NSScrollerPart)partCode; +- (void)setArrowsPosition:(NSScrollArrowPosition)where; +- (NSUsableScrollerParts)usableParts; + +// +// Setting the NSScroller's Values +// + +- (float)knobProportion; + +- (void)setFloatValue:(float)aFloat + knobProportion:(float)ratio; + +// +// Displaying +// +- (void)drawArrow:(NSScrollerArrow)whichButton + highlight:(BOOL)flag; +- (void)drawKnob; +- (void)drawParts; +- (void)highlight:(BOOL)flag; + +// +// Handling Events +// +- (NSScrollerPart)hitPart; +- (NSScrollerPart)testPart:(NSPoint)thePoint; +- (void)trackKnob:(NSEvent *)theEvent; +- (void)trackScrollButtons:(NSEvent *)theEvent; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSScroller diff --git a/Headers/gnustep/gui/NSSelection.h b/Headers/gnustep/gui/NSSelection.h new file mode 100644 index 000000000..2bf9faa0f --- /dev/null +++ b/Headers/gnustep/gui/NSSelection.h @@ -0,0 +1,77 @@ +/* + NSSelection.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSSelection +#define _GNUstep_H_NSSelection + +#include +#include +#include + +@interface NSSelection : NSObject + +{ + // Attributes +} + +// +// Returning Special Selection Shared Instances +// ++ (NSSelection *)allSelection; ++ (NSSelection *)currentSelection; ++ (NSSelection *)emptySelection; + +// +// Creating and Initializing a Selection +// ++ (NSSelection *)selectionWithDescriptionData:(NSData *)data; +- (id)initWithDescriptionData:(NSData *)newData; +- (id)initWithPasteboard:(NSPasteboard *)pasteboard; + +// +// Describing a Selection +// +- (NSData *)descriptionData; +- (BOOL)isWellKnownSelection; + +// +// Writing a Selection to the Pasteboard +// +- (void)writeToPasteboard:(NSPasteboard *)pasteboard; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSSelection diff --git a/Headers/gnustep/gui/NSSlider.h b/Headers/gnustep/gui/NSSlider.h new file mode 100644 index 000000000..06b365b25 --- /dev/null +++ b/Headers/gnustep/gui/NSSlider.h @@ -0,0 +1,89 @@ +/* + NSSlider.h + + The slider control class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSSlider +#define _GNUstep_H_NSSlider + +#include +#include +#include + +@interface NSSlider : NSControl + +{ + // Attributes +} + +// +// Setting the Cell Class +// ++ (Class)cellClass; ++ (void)setCellClass:(Class)classId; + +// +// Modifying an NSSlider's Appearance +// +- (NSImage *)image; +- (int)isVertical; +- (float)knobThickness; +- (void)setImage:(NSImage *)backgroundImage; +- (void)setKnobThickness:(float)aFloat; +- (void)setTitle:(NSString *)aString; +- (void)setTitleCell:(NSCell *)aCell; +- (void)setTitleColor:(NSColor *)aColor; +- (void)setTitleFont:(NSFont *)fontObject; +- (NSString *)title; +- (id)titleCell; +- (NSColor *)titleColor; +- (NSFont *)titleFont; + +// +// Setting and Getting Value Limits +// +- (double)maxValue; +- (double)minValue; +- (void)setMaxValue:(double)aDouble; +- (void)setMinValue:(double)aDouble; + +// +// Handling Events +// +- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSSlider + diff --git a/Headers/gnustep/gui/NSSliderCell.h b/Headers/gnustep/gui/NSSliderCell.h new file mode 100644 index 000000000..d17416c87 --- /dev/null +++ b/Headers/gnustep/gui/NSSliderCell.h @@ -0,0 +1,112 @@ +/* + NSSliderCell.h + + Cell class for slider control + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSSliderCell +#define _GNUstep_H_NSSliderCell + +#include +#include +#include + +@interface NSSliderCell : NSActionCell + +{ + // Attributes + double max_value; + double min_value; + double scale_factor; + int scroll_size; + int knob_thickness; + double page_value; + BOOL is_vertical; + + // Reserved for back-end use + void *be_sc_reserved; +} + +// +// Determining Component Sizes +// +- (NSSize)cellSizeForBounds:(NSRect)aRect; +- (NSRect)knobRectFlipped:(BOOL)flipped; + +// +// Setting Value Limits +// +- (double)maxValue; +- (double)minValue; +- (void)setMaxValue:(double)aDouble; +- (void)setMinValue:(double)aDouble; + +// +// Modifying Graphic Attributes +// +- (void)setVertical:(BOOL)value; +- (int)isVertical; +- (float)knobThickness; +- (void)setKnobThickness:(float)aFloat; +- (void)setTitle:(NSString *)aString; +- (void)setTitleCell:(NSCell *)aCell; +- (void)setTitleColor:(NSColor *)aColor; +- (void)setTitleFont:(NSFont *)fontObject; +- (NSString *)title; +- (id)titleCell; +- (NSFont *)titleFont; +- (NSColor *)titleColor; + +// +// Displaying the NSSliderCell +// +- (void)drawBarInside:(NSRect)aRect + flipped:(BOOL)flipped; +- (void)drawKnob; +- (void)drawKnob:(NSRect)knobRect; + +// +// Modifying Behavior +// +- (double)altIncrementValue; +- (void)setAltIncrementValue:(double)incValue; + +// +// Tracking the Mouse +// ++ (BOOL)prefersTrackingUntilMouseUp; +- (NSRect)trackRect; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSSliderCell diff --git a/Headers/gnustep/gui/NSSpellChecker.h b/Headers/gnustep/gui/NSSpellChecker.h new file mode 100644 index 000000000..876877f63 --- /dev/null +++ b/Headers/gnustep/gui/NSSpellChecker.h @@ -0,0 +1,94 @@ +/* + NSSpellChecker.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSSpellChecker +#define _GNUstep_H_NSSpellChecker + +#include +#include +#include +#include + +@interface NSSpellChecker : NSObject + +{ + // Attributes +} + +// +// Making a Checker available +// ++ (NSSpellChecker *)sharedSpellChecker; ++ (BOOL)sharedSpellCheckerExists; + +// +// Managing the Spelling Panel +// +- (NSView *)accessoryView; +- (void)setAccessoryView:(NSView *)aView; +- (NSPanel *)spellingPanel; + +// +// Checking Spelling +// +- (int)countWordsInString:(NSString *)aString + language:(NSString *)language; +- (NSRange)checkSpellingOfString:(NSString *)stringToCheck + startingAt:(int)startingOffset; +- (NSRange)checkSpellingOfString:(NSString *)stringToCheck + startingAt:(int)startingOffset +language:(NSString *)language + wrap:(BOOL)wrapFlag +inSpellDocumentWithTag:(int)tag + wordCount:(int *)wordCount; + +// +// Setting the Language +// +- (NSString *)language; +- (BOOL)setLanguage:(NSString *)aLanguage; + +// +// Managing the Spelling Process +// ++ (int)uniqueSpellDocumentTag; +- (void)closeSpellDocumentWithTag:(int)tag; +- (void)ignoreWord:(NSString *)wordToIgnore +inSpellDocumentWithTag:(int)tag; +- (NSArray *)ignoredWordsInSpellDocumentWithTag:(int)tag; +- (void)setIgnoredWords:(NSArray *)someWords + inSpellDocumentWithTag:(int)tag; +- (void)setWordFieldStringValue:(NSString *)aString; +- (void)updateSpellingPanelWithMisspelledWord:(NSString *)word; + +@end + +#endif // _GNUstep_H_NSSpellChecker + diff --git a/Headers/gnustep/gui/NSSpellServer.h b/Headers/gnustep/gui/NSSpellServer.h new file mode 100644 index 000000000..465044f62 --- /dev/null +++ b/Headers/gnustep/gui/NSSpellServer.h @@ -0,0 +1,86 @@ +/* + NSSpellServer.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSSpellServer +#define _GNUstep_H_NSSpellServer + +#include +#include + +@interface NSSpellServer : NSObject + +{ + // Attributes +} + +// +// Checking in Your Service +// +- (BOOL)registerLanguage:(NSString *)language + byVendor:(NSString *)vendor; + +// +// Assigning a Delegate +// +- (id)delegate; +- (void)setDelegate:(id)anObject; + +// +// Running the Service +// +- (void)run; + +// +// Checking User Dictionaries +// +- (BOOL)isWordInUserDictionaries:(NSString *)word + caseSensitive:(BOOL)flag; + +// +// Methods Implemented by the Delegate +// +- (NSRange)spellServer:(NSSpellServer *)sender +findMisspelledWordInString:(NSString *)stringToCheck +language:(NSString *)language +wordCount:(int *)wordCount +countOnly:(BOOL)countOnly; +- (NSArray *)spellServer:(NSSpellServer *)sender + suggestGuessesForWord:(NSString *)word +inLanguage:(NSString *)language; +- (void)spellServer:(NSSpellServer *)sender + didLearnWord:(NSString *)word +inLanguage:(NSString *)language; +- (void)spellServer:(NSSpellServer *)sender + didForgetWord:(NSString *)word +inLanguage:(NSString *)language; + +@end + +#endif // _GNUstep_H_NSSpellServer diff --git a/Headers/gnustep/gui/NSSplitView.h b/Headers/gnustep/gui/NSSplitView.h new file mode 100644 index 000000000..1a28cb583 --- /dev/null +++ b/Headers/gnustep/gui/NSSplitView.h @@ -0,0 +1,77 @@ +/* + NSSplitView.h + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSSplitView +#define _GNUstep_H_NSSplitView + +#include +#include +#include + +@interface NSSplitView : NSView + +{ + // Attributes +} + +// +// Managing Component Views +// +- (void)adjustSubviews; +- (float)dividerThickness; +- (void)drawDividerInRect:(NSRect)aRect; + +// +// Assigning a Delegate +// +- (id)delegate; +- (void)setDelegate:(id)anObject; + +// +// Implemented by the Delegate +// +- (void)splitView:(NSSplitView *)splitView +constrainMinCoordinate:(float *)min +maxCoordinate:(float *)max +ofSubviewAt:(int)offset; +- (void)splitView:(NSSplitView *)sender +resizeSubviewsWithOldSize:(NSSize)oldSize; +- (void)splitViewDidResizeSubviews:(NSNotification *)notification; +- (void)splitViewWillResizeSubviews:(NSNotification *)notification; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSSplitView diff --git a/Headers/gnustep/gui/NSText.h b/Headers/gnustep/gui/NSText.h new file mode 100644 index 000000000..da6e8685e --- /dev/null +++ b/Headers/gnustep/gui/NSText.h @@ -0,0 +1,202 @@ +/* + NSText.h + + The text object + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSText +#define _GNUstep_H_NSText + +#include +#include +#include +#include + +@interface NSText : NSView + +{ + // Attributes + id delegate; + NSString *text_contents; + unsigned int alignment; + BOOL is_editable; + BOOL is_rich_text; + BOOL is_selectable; + BOOL imports_graphics; + BOOL uses_font_panel; + BOOL is_horizontally_resizable; + BOOL is_vertically_resizable; + BOOL is_ruler_visible; + BOOL is_field_editor; + NSColor *background_color; + NSColor *text_color; + NSFont *default_font; + NSRange selected_range; + // Reserved for back-end use + void *be_text_reserved; +} + +// +// Getting and Setting Contents +// +- (void)replaceRange:(NSRange)range + withRTF:(NSData *)rtfData; +- (void)replaceRange:(NSRange)range + withRTFD:(NSData *)rtfdData; +- (NSData *)RTFDFromRange:(NSRange)range; +- (NSData *)RTFFromRange:(NSRange)range; +- (void)setText:(NSString *)string; +- (void)setText:(NSString *)string + range:(NSRange)range; +- (NSString *)text; + +// +// Managing Global Characteristics +// +- (NSTextAlignment)alignment; +- (BOOL)drawsBackground; +- (BOOL)importsGraphics; +- (BOOL)isEditable; +- (BOOL)isRichText; +- (BOOL)isSelectable; +- (void)setAlignment:(NSTextAlignment)mode; +- (void)setDrawsBackground:(BOOL)flag; +- (void)setEditable:(BOOL)flag; +- (void)setImportsGraphics:(BOOL)flag; +- (void)setRichText:(BOOL)flag; +- (void)setSelectable:(BOOL)flag; + +// +// Managing Font and Color +// +- (NSColor *)backgroundColor; +- (void)changeFont:(id)sender; +- (NSFont *)font; +- (void)setBackgroundColor:(NSColor *)color; +- (void)setColor:(NSColor *)color + ofRange:(NSRange)range; +- (void)setFont:(NSFont *)obj; +- (void)setFont:(NSFont *)font + ofRange:(NSRange)range; +- (void)setTextColor:(NSColor *)color; +- (void)setUsesFontPanel:(BOOL)flag; +- (NSColor *)textColor; +- (BOOL)usesFontPanel; + +// +// Managing the Selection +// +- (NSRange)selectedRange; +- (void)setSelectedRange:(NSRange)range; + +// +// Sizing the Frame Rectangle +// +- (BOOL)isHorizontallyResizable; +- (BOOL)isVerticallyResizable; +- (NSSize)maxSize; +- (NSSize)minSize; +- (void)setHorizontallyResizable:(BOOL)flag; +- (void)setMaxSize:(NSSize)newMaxSize; +- (void)setMinSize:(NSSize)newMinSize; +- (void)setVerticallyResizable:(BOOL)flag; +- (void)sizeToFit; + +// +// Responding to Editing Commands +// +- (void)alignCenter:(id)sender; +- (void)alignLeft:(id)sender; +- (void)alignRight:(id)sender; +- (void)copy:(id)sender; +- (void)copyFont:(id)sender; +- (void)copyRuler:(id)sender; +- (void)cut:(id)sender; +- (void)delete:(id)sender; +- (void)paste:(id)sender; +- (void)pasteFont:(id)sender; +- (void)pasteRuler:(id)sender; +- (void)selectAll:(id)sender; +- (void)subscript:(id)sender; +- (void)superscript:(id)sender; +- (void)underline:(id)sender; +- (void)unscript:(id)sender; + +// +// Managing the Ruler +// +- (BOOL)isRulerVisible; +- (void)toggleRuler:(id)sender; + +// +// Spelling +// +- (void)checkSpelling:(id)sender; +- (void)showGuessPanel:(id)sender; + +// +// Scrolling +// +- (void)scrollRangeToVisible:(NSRange)range; + +// +// Reading and Writing RTFD Files +// +- (BOOL)readRTFDFromFile:(NSString *)path; +- (BOOL)writeRTFDToFile:(NSString *)path + atomically:(BOOL)flag; + +// +// Managing the Field Editor +// +- (BOOL)isFieldEditor; +- (void)setFieldEditor:(BOOL)flag; + +// +// Managing the Delegate +// +- (id)delegate; +- (void)setDelegate:(id)anObject; + +// +// Implemented by the Delegate +// +- (void)textDidBeginEditing:(NSNotification *)aNotification; +- (void)textDidChange:(NSNotification *)aNotification; +- (void)textDidEndEditing:(NSNotification *)aNotification; +- (BOOL)textShouldBeginEditing:(NSText *)textObject; +- (BOOL)textShouldEndEditing:(NSText *)textObject; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSText diff --git a/Headers/gnustep/gui/NSTextField.h b/Headers/gnustep/gui/NSTextField.h new file mode 100644 index 000000000..1a4d0ae1b --- /dev/null +++ b/Headers/gnustep/gui/NSTextField.h @@ -0,0 +1,114 @@ +/* + NSTextField.h + + Text field control class for text entry + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSTextField +#define _GNUstep_H_NSTextField + +#include +#include +#include +#include + +@interface NSTextField : NSControl + +{ + // Attributes + id next_text; + id previous_text; + id text_delegate; + SEL error_action; +} + +// +// Setting User Access to Text +// +- (BOOL)isEditable; +- (BOOL)isSelectable; +- (void)setEditable:(BOOL)flag; +- (void)setSelectable:(BOOL)flag; + +// +// Editing Text +// +- (void)selectText:(id)sender; + +// +// Setting Tab Key Behavior +// +- (id)nextText; +- (id)previousText; +- (void)setNextText:(id)anObject; +- (void)setPreviousText:(id)anObject; + +// +// Assigning a Delegate +// +- (void)setDelegate:(id)anObject; +- (id)delegate; + +// +// Modifying Graphic Attributes +// +- (NSColor *)backgroundColor; +- (BOOL)drawsBackground; +- (BOOL)isBezeled; +- (BOOL)isBordered; +- (void)setBackgroundColor:(NSColor *)aColor; +- (void)setBezeled:(BOOL)flag; +- (void)setBordered:(BOOL)flag; +- (void)setDrawsBackground:(BOOL)flag; +- (void)setTextColor:(NSColor *)aColor; +- (NSColor *)textColor; + +// +// Target and Action +// +- (SEL)errorAction; +- (void)setErrorAction:(SEL)aSelector; + +// +// Handling Events +// +- (BOOL)acceptsFirstResponder; +- (void)textDidBeginEditing:(NSNotification *)aNotification; +- (void)textDidChange:(NSNotification *)aNotification; +- (void)textDidEndEditing:(NSNotification *)aNotification; +- (BOOL)textShouldBeginEditing:(NSText *)textObject; +- (BOOL)textShouldEndEditing:(NSText *)textObject; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSTextField diff --git a/Headers/gnustep/gui/NSTextFieldCell.h b/Headers/gnustep/gui/NSTextFieldCell.h new file mode 100644 index 000000000..b83858130 --- /dev/null +++ b/Headers/gnustep/gui/NSTextFieldCell.h @@ -0,0 +1,77 @@ +/* + NSTextFieldCell.h + + Cell class for the text field entry control + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSTextFieldCell +#define _GNUstep_H_NSTextFieldCell + +#include +#include +#include +#include +#include + +@interface NSTextFieldCell : NSActionCell + +{ + // Attributes + NSColor *background_color; + NSColor *text_color; + BOOL draw_background; + BOOL pending_select; + + // Reserved for back-end use + void *be_tfc_reserved; +} + +// +// Modifying Graphic Attributes +// +- (NSColor *)backgroundColor; +- (BOOL)drawsBackground; +- (void)setBackgroundColor:(NSColor *)aColor; +- (void)setDrawsBackground:(BOOL)flag; +- (void)setTextColor:(NSColor *)aColor; +- (id)setUpFieldEditorAttributes:(id)textObject; +- (NSColor *)textColor; + +// +// Edit text +// +- (void)selectText:(id)sender; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSTextFieldCell diff --git a/Headers/gnustep/gui/NSView.h b/Headers/gnustep/gui/NSView.h new file mode 100644 index 000000000..d059df092 --- /dev/null +++ b/Headers/gnustep/gui/NSView.h @@ -0,0 +1,315 @@ +/* + NSView.h + + The wonderful view class; it encapsulates all drawing functionality + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSView +#define _GNUstep_H_NSView + +#include +#include +#include +#include +#include +#include +#include + +@class NSWindow; +@class NSClipView; + +@interface NSView : NSResponder + +{ + // Attributes + NSRect frame; + NSRect bounds; + float frame_rotation; + + id super_view; + NSMutableArray *sub_views; + id window; + NSMutableArray *tracking_rects; + + BOOL is_flipped; + BOOL is_rotated_from_base; + BOOL is_rotated_or_scaled_from_base; + BOOL opaque; + BOOL needs_display; + BOOL disable_autodisplay; + BOOL post_frame_changes; + BOOL autoresize_subviews; + + // Reserved for back-end use + void *be_view_reserved; +} + +// +//Initializing NSView Objects +// +- (id)initWithFrame:(NSRect)frameRect; + +// +// Managing the NSView Hierarchy +// +- (void)addSubview:(NSView *)aView; +- (void)addSubview:(NSView *)aView + positioned:(NSWindowOrderingMode)place +relativeTo:(NSView *)otherView; +- (NSView *)ancestorSharedWithView:(NSView *)aView; +- (BOOL)isDescendantOf:(NSView *)aView; +- (NSView *)opaqueAncestor; +- (void)removeFromSuperview; +- (void)replaceSubview:(NSView *)oldView + with:(NSView *)newView; +- (void)sortSubviewsUsingFunction:(int (*)(id ,id ,void *))compare + context:(void *)context; +- (NSMutableArray *)subviews; +- (NSView *)superview; +- (void)setSuperview:(NSView *)superview; +- (NSWindow *)window; +- (void)viewWillMoveToWindow:(NSWindow *)newWindow; + +// +// Modifying the Frame Rectangle +// +- (float)frameRotation; +- (NSRect)frame; +- (void)rotateByAngle:(float)angle; +- (void)setFrame:(NSRect)frameRect; +- (void)setFrameOrigin:(NSPoint)newOrigin; +- (void)setFrameRotation:(float)angle; +- (void)setFrameSize:(NSSize)newSize; + +// +// Modifying the Coordinate System +// + +- (float)boundsRotation; +- (NSRect)bounds; +- (BOOL)isFlipped; +- (BOOL)isRotatedFromBase; +- (BOOL)isRotatedOrScaledFromBase; +- (void)scaleUnitSquareToSize:(NSSize)newSize; +- (void)setBounds:(NSRect)aRect; +- (void)setBoundsOrigin:(NSPoint)newOrigin; +- (void)setBoundsRotation:(float)angle; +- (void)setBoundsSize:(NSSize)newSize; +- (void)translateOriginToPoint:(NSPoint)point; + +// +// Converting Coordinates +// +- (NSRect)centerScanRect:(NSRect)aRect; +- (NSPoint)convertPoint:(NSPoint)aPoint + fromView:(NSView *)aView; +- (NSPoint)convertPoint:(NSPoint)aPoint + toView:(NSView *)aView; +- (NSRect)convertRect:(NSRect)aRect + fromView:(NSView *)aView; +- (NSRect)convertRect:(NSRect)aRect + toView:(NSView *)aView; +- (NSSize)convertSize:(NSSize)aSize + fromView:(NSView *)aView; +- (NSSize)convertSize:(NSSize)aSize + toView:(NSView *)aView; + +// +// Notifying Ancestor Views +// +- (BOOL)postsFrameChangedNotifications; +- (void)setPostsFrameChangedNotifications:(BOOL)flag; + +// +// Resizing Subviews +// +- (void)resizeSubviewsWithOldSize:(NSSize)oldSize; +- (void)setAutoresizesSubviews:(BOOL)flag; +- (BOOL)autoresizesSubviews; +- (void)setAutoresizingMask:(unsigned int)mask; +- (unsigned int)autoresizingMask; +- (void)resizeWithOldSuperviewSize:(NSSize)oldSize; + +// +// Graphics State Objects +// +- (void)allocateGState; +- (void)releaseGState; +- (int)gState; +- (void)renewGState; +- (void)setUpGState; + +// +// Focusing +// ++ (NSView *)focusView; +- (void)lockFocus; +- (void)unlockFocus; + +// +// Displaying +// +- (BOOL)canDraw; +- (void)display; +- (void)displayIfNeeded; +- (void)displayIfNeededIgnoringOpacity; +- (void)displayRect:(NSRect)aRect; +- (void)displayRectIgnoringOpacity:(NSRect)aRect; +- (void)drawRect:(NSRect)rect; +- (NSRect)visibleRect; +- (BOOL)isOpaque; +- (BOOL)needsDisplay; +- (void)setNeedsDisplay:(BOOL)flag; +- (void)setNeedsDisplayInRect:(NSRect)invalidRect; +- (BOOL)shouldDrawColor; + +// +// Scrolling +// +- (NSRect)adjustScroll:(NSRect)newVisible; +- (BOOL)autoscroll:(NSEvent *)theEvent; +- (void)reflectScrolledClipView:(NSClipView *)aClipView; +- (void)scrollClipView:(NSClipView *)aClipView + toPoint:(NSPoint)aPoint; +- (void)scrollPoint:(NSPoint)aPoint; +- (void)scrollRect:(NSRect)aRect + by:(NSSize)delta; +- (BOOL)scrollRectToVisible:(NSRect)aRect; + +// +// Managing the Cursor +// +- (void)addCursorRect:(NSRect)aRect + cursor:(NSCursor *)anObject; +- (void)discardCursorRects; +- (void)removeCursorRect:(NSRect)aRect + cursor:(NSCursor *)anObject; +- (void)resetCursorRects; + +// +// Assigning a Tag +// +- (int)tag; +- (id)viewWithTag:(int)aTag; + +// +// Aiding Event Handling +// +- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent; +- (NSView *)hitTest:(NSPoint)aPoint; +- (BOOL)mouse:(NSPoint)aPoint + inRect:(NSRect)aRect; +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent; +- (void)removeTrackingRect:(NSTrackingRectTag)tag; +- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)anEvent; +- (NSTrackingRectTag)addTrackingRect:(NSRect)aRect + owner:(id)anObject +userData:(void *)data + assumeInside:(BOOL)flag; +- (NSArray *)trackingRectangles; + +// +// Dragging +// +- (BOOL)dragFile:(NSString *)filename + fromRect:(NSRect)rect +slideBack:(BOOL)slideFlag + event:(NSEvent *)event; +- (void)dragImage:(NSImage *)anImage + at:(NSPoint)viewLocation +offset:(NSSize)initialOffset + event:(NSEvent *)event +pasteboard:(NSPasteboard *)pboard + source:(id)sourceObject +slideBack:(BOOL)slideFlag; +- (void)registerForDraggedTypes:(NSArray *)newTypes; +- (void)unregisterDraggedTypes; + +// +// Printing +// +- (NSData *)dataWithEPSInsideRect:(NSRect)aRect; +- (void)fax:(id)sender; +- (void)print:(id)sender; +- (void)writeEPSInsideRect:(NSRect)rect + toPasteboard:(NSPasteboard *)pasteboard; + +// +// Pagination +// +- (void)adjustPageHeightNew:(float *)newBottom + top:(float)oldTop +bottom:(float)oldBottom + limit:(float)bottomLimit; +- (void)adjustPageWidthNew:(float *)newRight + left:(float)oldLeft +right:(float)oldRight + limit:(float)rightLimit; +- (float)heightAdjustLimit; +- (BOOL)knowsPagesFirst:(int *)firstPageNum + last:(int *)lastPageNum; +- (NSPoint)locationOfPrintRect:(NSRect)aRect; +- (NSRect)rectForPage:(int)page; +- (float)widthAdjustLimit; + +// +// Writing Conforming PostScript +// +- (void)addToPageSetup; +- (void)beginPage:(int)ordinalNum + label:(NSString *)aString +bBox:(NSRect)pageRect + fonts:(NSString *)fontNames; +- (void)beginPageSetupRect:(NSRect)aRect + placement:(NSPoint)location; +- (void)beginPrologueBBox:(NSRect)boundingBox + creationDate:(NSString *)dateCreated +createdBy:(NSString *)anApplication + fonts:(NSString *)fontNames +forWhom:(NSString *)user + pages:(int)numPages +title:(NSString *)aTitle; +- (void)beginSetup; +- (void)beginTrailer; +- (void)drawPageBorderWithSize:(NSSize)borderSize; +- (void)drawSheetBorderWithSize:(NSSize)borderSize; +- (void)endHeaderComments; +- (void)endPrologue; +- (void)endSetup; +- (void)endPageSetup; +- (void)endPage; +- (void)endTrailer; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_NSView diff --git a/Headers/gnustep/gui/NSWindow.h b/Headers/gnustep/gui/NSWindow.h new file mode 100644 index 000000000..24e6e1a11 --- /dev/null +++ b/Headers/gnustep/gui/NSWindow.h @@ -0,0 +1,367 @@ +/* + NSWindow.h + + The window class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSWindow +#define _GNUstep_H_NSWindow + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +@interface NSWindow : NSResponder + +{ + // Attributes + NSRect frame; + id frame_view; + id content_view; + id first_responder; + id original_responder; + id delegate; + int window_num; + NSColor *background_color; + NSString *represented_filename; + NSString *miniaturized_title; + NSString *window_title; + NSPoint last_point; + NSBackingStoreType backing_type; + + BOOL visible; + BOOL is_key; + BOOL is_main; + BOOL is_edited; + BOOL is_miniaturized; + BOOL disable_flush_window; + unsigned int style_mask; + BOOL menu_exclude; + + // Reserved for back-end use + void *be_wind_reserved; +} + +// +// Class methods +// +// +// Computing frame and content rectangles +// ++ (NSRect)contentRectForFrameRect:(NSRect)aRect + styleMask:(unsigned int)aStyle; + ++ (NSRect)frameRectForContentRect:(NSRect)aRect + styleMask:(unsigned int)aStyle; + ++ (NSRect)minFrameWidthWithTitle:(NSString *)aTitle + styleMask:(unsigned int)aStyle; + +// +// Saving and restoring the frame +// ++ (void)removeFrameUsingName:(NSString *)name; + +// +// Initializing and getting a new NSWindow object +// +- initWithContentRect:(NSRect)contentRect + styleMask:(unsigned int)aStyle +backing:(NSBackingStoreType)bufferingType + defer:(BOOL)flag; + +- initWithContentRect:(NSRect)contentRect + styleMask:(unsigned int)aStyle +backing:(NSBackingStoreType)bufferingType + defer:(BOOL)flag +screen:aScreen; + +// +// Accessing the content view +// +- contentView; +- (void)setContentView:(NSView *)aView; + +// +// Window graphics +// +- (NSColor *)backgroundColor; +- (NSString *)representedFilename; +- (void)setBackgroundColor:(NSColor *)color; +- (void)setRepresentedFilename:(NSString *)aString; +- (void)setTitle:(NSString *)aString; +- (void)setTitleWithRepresentedFilename:(NSString *)aString; +- (unsigned int)styleMask; +- (NSString *)title; + +// +// Window device attributes +// +- (NSBackingStoreType)backingType; +- (NSDictionary *)deviceDescription; +- (int)gState; +- (BOOL)isOneShot; +- (void)setBackingType:(NSBackingStoreType)type; +- (void)setOneShot:(BOOL)flag; +- (int)windowNumber; +- (void)setWindowNumber:(int)windowNum; + +// +// The miniwindow +// +- (NSImage *)miniwindowImage; +- (NSString *)miniwindowTitle; +- (void)setMiniwindowImage:(NSImage *)image; +- (void)setMiniwindowTitle:(NSString *)title; + +// +// The field editor +// +- (void)endEditingFor:anObject; +- (NSText *)fieldEditor:(BOOL)createFlag + forObject:anObject; + +// +// Window status and ordering +// +- (void)becomeKeyWindow; +- (void)becomeMainWindow; +- (BOOL)canBecomeKeyWindow; +- (BOOL)canBecomeMainWindow; +- (BOOL)hidesOnDeactivate; +- (BOOL)isKeyWindow; +- (BOOL)isMainWindow; +- (BOOL)isMiniaturized; +- (BOOL)isVisible; +- (int)level; +- (void)makeKeyAndOrderFront:sender; +- (void)makeKeyWindow; +- (void)makeMainWindow; +- (void)orderBack:sender; +- (void)orderFront:sender; +- (void)orderFrontRegardless; +- (void)orderOut:sender; +- (void)orderWindow:(NSWindowOrderingMode)place + relativeTo:(int)otherWin; +- (void)resignKeyWindow; +- (void)resignMainWindow; +- (void)setHidesOnDeactivate:(BOOL)flag; +- (void)setLevel:(int)newLevel; + +// +// Moving and resizing the window +// +- (NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint; +- (void)center; +- (NSRect)constrainFrameRect:(NSRect)frameRect + toScreen:screen; +- (NSRect)frame; +- (NSSize)minSize; +- (NSSize)maxSize; +- (void)setContentSize:(NSSize)aSize; +- (void)setFrame:(NSRect)frameRect + display:(BOOL)flag; +- (void)setFrameOrigin:(NSPoint)aPoint; +- (void)setFrameTopLeftPoint:(NSPoint)aPoint; +- (void)setMinSize:(NSSize)aSize; +- (void)setMaxSize:(NSSize)aSize; + +// +// Converting coordinates +// +- (NSPoint)convertBaseToScreen:(NSPoint)aPoint; +- (NSPoint)convertScreenToBase:(NSPoint)aPoint; + +// +// Managing the display +// +- (void)display; +- (void)disableFlushWindow; +- (void)displayIfNeeded; +- (void)enableFlushWindow; +- (void)flushWindow; +- (void)flushWindowIfNeeded; +- (BOOL)isAutodisplay; +- (BOOL)isFlushWindowDisabled; +- (void)setAutoDisplay:(BOOL)flag; +- (void)setViewsNeedDisplay:(BOOL)flag; +- (void)update; +- (void)useOptimizedDrawing:(BOOL)flag; +- (BOOL)viewsNeedDisplay; + +// +// Screens and window depths +// +//+ (NSWindowDepth)defaultDepthLimit +//- (BOOL)canStoreColor; +//- (NSScreen *)deepestScreen; +//- (NSWindowDepth)depthLimit; +//- (BOOL)hasDynamicDepthLimit; +//- (NSScreen *)screen; +//- (void)setDepthLimit:(NSWindowDepth)limit; +//- (void)setDynamicDepthLimit:(BOOL)flag; + +// +// Cursor management +// +- (BOOL)areCursorRectsEnabled; +- (void)disableCursorRects; +- (void)discardCursorRects; +- (void)enableCursorRects; +- (void)invalidateCursorRectsForView:(NSView *)aView; +- (void)resetCursorRects; + +// +// Handling user actions and events +// +- (void)close; +- (void)deminiaturize:sender; +- (BOOL)isDocumentEdited; +- (BOOL)isReleasedWhenClosed; +- (void)miniaturize:sender; +- (void)performClose:sender; +- (void)performMiniaturize:sender; +- (int)resizeFlags; +- (void)setDocumentEdited:(BOOL)flag; +- (void)setReleasedWhenClosed:(BOOL)flag; + +// +// Aiding event handling +// +- (BOOL)acceptsMouseMovedEvents; +- (NSEvent *)currentEvent; +- (void)discardEventsMatchingMask:(unsigned int)mask + beforeEvent:(NSEvent *)lastEvent; +- (NSResponder *)firstResponder; +- (void)keyDown:(NSEvent *)theEvent; +- (BOOL)makeFirstResponder:(NSResponder *)aResponder; +- (NSPoint)mouseLocationOutsideOfEventStream; +- (NSEvent *)nextEventMatchingMask:(unsigned int)mask; +- (NSEvent *)nextEventMatchingMask:(unsigned int)mask + untilDate:(NSDate *)expiration +inMode:(NSString *)mode + dequeue:(BOOL)deqFlag; +- (void)postEvent:(NSEvent *)event + atStart:(BOOL)flag; +- (void)setAcceptsMouseMovedEvents:(BOOL)flag; +- (void)sendEvent:(NSEvent *)theEvent; +- (BOOL)tryToPerform:(SEL)anAction with:anObject; +- (BOOL)worksWhenModal; + +// +// Dragging +// +- (void)dragImage:(NSImage *)anImage + at:(NSPoint)baseLocation +offset:(NSSize)initialOffset + event:(NSEvent *)event +pasteboard:(NSPasteboard *)pboard + source:sourceObject + slideBack:(BOOL)slideFlag; +- (void)registerForDraggedTypes:(NSArray *)newTypes; +- (void)unregisterDraggedTypes; + +// +// Services and windows menu support +// +- (BOOL)isExcludedFromWindowsMenu; +- (void)setExcludedFromWindowsMenu:(BOOL)flag; +- validRequestorForSendType:(NSString *)sendType + returnType:(NSString *)returnType; + +// +// Saving and restoring the frame +// +- (NSString *)frameAutosaveName; +- (void)saveFrameUsingName:(NSString *)name; +- (BOOL)setFrameAutosaveName:(NSString *)name; +- (void)setFrameFromString:(NSString *)string; +- (BOOL)setFrameUsingName:(NSString *)name; +- (NSString *)stringWithSavedFrame; + +// +// Printing and postscript +// +- (NSDate *)dataWithEPSInsideRect:(NSRect)rect; +- (void)fax:sender; +- (void)print:sender; + +// +// Assigning a delegate +// +- delegate; +- (void)setDelegate:anObject; + +// +// Implemented by the delegate +// +- (BOOL)windowShouldClose:sender; +- (NSSize)windowWillResize:(NSWindow *)sender + toSize:(NSSize)frameSize; +- windowWillReturnFieldEditor:(NSWindow *)sender + toObject:client; +- (void)windowDidBecomeKey:sender; +- (void)windowDidBecomeMain:sender; +- (void)windowDidChangeScreen:sender; +- (void)windowDidDeminiaturize:sender; +- (void)windowDidExpose:sender; +- (void)windowDidMiniaturize:sender; +- (void)windowDidMove:sender; +- (void)windowDidResignKey:sender; +- (void)windowDidResignMain:sender; +- (void)windowDidResize:sender; +- (void)windowDidUpdate:sender; +- (void)windowWillClose:sender; +- (void)windowWillMiniaturize:sender; +- (void)windowWillMove:sender; + +// +// NSCoding methods +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +// +// GNUstep additional methods +// +// +// Mouse capture/release +// +- (void)captureMouse: sender; +- (void)releaseMouse: sender; + +@end + +#endif // _GNUstep_H_NSWindow + diff --git a/Headers/gnustep/gui/NSWorkspace.h b/Headers/gnustep/gui/NSWorkspace.h new file mode 100644 index 000000000..af583b232 --- /dev/null +++ b/Headers/gnustep/gui/NSWorkspace.h @@ -0,0 +1,149 @@ +/* + NSWorkspace.h + + Interface for workspace. + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSWorkspace +#define _GNUstep_H_NSWorkspace + +#include +#include +#include + +@interface NSWorkspace : NSObject + +{ + // Attributes +} + +// +// Creating a Workspace +// ++ (NSWorkspace *)sharedWorkspace; + +// +// Opening Files +// +- (BOOL)openFile:(NSString *)fullPath; +- (BOOL)openFile:(NSString *)fullPath + fromImage:(NSImage *)anImage +at:(NSPoint)point + inView:(NSView *)aView; +- (BOOL)openFile:(NSString *)fullPath + withApplication:(NSString *)appName; +- (BOOL)openFile:(NSString *)fullPath + withApplication:(NSString *)appName +andDeactivate:(BOOL)flag; +- (BOOL)openTempFile:(NSString *)fullPath; + +// +// Manipulating Files +// +- (BOOL)performFileOperation:(NSString *)operation + source:(NSString *)source +destination:(NSString *)destination + files:(NSArray *)files +tag:(int *)tag; +- (BOOL)selectFile:(NSString *)fullPath +inFileViewerRootedAtPath:(NSString *)rootFullpath; + +// +// Requesting Information about Files +// +- (NSString *)fullPathForApplication:(NSString *)appName; +- (BOOL)getFileSystemInfoForPath:(NSString *)fullPath + isRemovable:(BOOL *)removableFlag +isWritable:(BOOL *)writableFlag + isUnmountable:(BOOL *)unmountableFlag +description:(NSString **)description + type:(NSString **)fileSystemType; +- (BOOL)getInfoForFile:(NSString *)fullPath + application:(NSString **)appName +type:(NSString **)type; +- (NSImage *)iconForFile:(NSString *)fullPath; +- (NSImage *)iconForFiles:(NSArray *)pathArray; +- (NSImage *)iconForFileType:(NSString *)fileType; + +// +// Tracking Changes to the File System +// +- (BOOL)fileSystemChanged; +- (void)noteFileSystemChanged; + +// +// Updating Registered Services and File Types +// +- (void)findApplications; + +// +// Launching and Manipulating Applications +// +- (void)hideOtherApplications; +- (BOOL)launchApplication:(NSString *)appName; +- (BOOL)launchApplication:(NSString *)appName + showIcon:(BOOL)showIcon +autolaunch:(BOOL)autolaunch; + +// +// Unmounting a Device +// +- (BOOL)unmountAndEjectDeviceAtPath:(NSString *)path; + +// +// Tracking Status Changes for Devices +// +- (void)checkForRemovableMedia; +- (NSArray *)mountNewRemovableMedia; +- (NSArray *)mountedRemovableMedia; + +// +// Notification Center +// +- (NSNotificationCenter *)notificationCenter; + +// +// Tracking Changes to the User Defaults Database +// +- (void)noteUserDefaultsChanged; +- (BOOL)userDefaultsChanged; + +// +// Animating an Image +// +- (void)slideImage:(NSImage *)image + from:(NSPoint)fromPoint +to:(NSPoint)toPoint; + +// +// Requesting Additional Time before Power Off or Logout +// +- (int)extendPowerOffBy:(int)requested; + +@end + +#endif // _GNUstep_H_NSWorkspace diff --git a/Headers/gnustep/gui/TrackingRectangle.h b/Headers/gnustep/gui/TrackingRectangle.h new file mode 100644 index 000000000..1819b03a9 --- /dev/null +++ b/Headers/gnustep/gui/TrackingRectangle.h @@ -0,0 +1,69 @@ +/* + TrackingRectangle.h + + Tracking rectangle class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_TrackingRectangle +#define _GNUstep_H_TrackingRectangle + +#include +#include + +@interface TrackingRectangle : NSObject + +{ + // Attributes + NSRect rectangle; + NSTrackingRectTag tag; + id owner; + void *user_data; + BOOL inside; +} + +// Instance methods +- initWithRect:(NSRect)aRect + tag:(NSTrackingRectTag)aTag + owner:anObject + userData:(void *)theData + inside:(BOOL)flag; + +- (NSRect)rectangle; +- (NSTrackingRectTag)tag; +- owner; +- (void *)userData; +- (BOOL)inside; + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder; +- initWithCoder:aDecoder; + +@end + +#endif // _GNUstep_H_TrackingRectangle diff --git a/Headers/gnustep/gui/TypesandConstants.h b/Headers/gnustep/gui/TypesandConstants.h new file mode 100644 index 000000000..71540e17b --- /dev/null +++ b/Headers/gnustep/gui/TypesandConstants.h @@ -0,0 +1,1132 @@ +/* TypesandConstants.h + + Type and Constant definitions for the GNUstep GUI Library + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_GUITypes +#define _GNUstep_H_GUITypes + +#include + +// +// Application +// +extern id NSApp; +typedef struct _NSModalSession *NSModalSession; + +enum { + NSRunStoppedResponse, + NSRunAbortedResponse, + NSRunContinuesResponse +}; + +extern NSString *NSModalPanelRunLoopMode; +extern NSString *NSEventTrackingRunLoopMode; + +// +// Box +// +typedef enum _NSTitlePosition { + NSNoTitle, + NSAboveTop, + NSAtTop, + NSBelowTop, + NSAboveBottom, + NSAtBottom, + NSBelowBottom +} NSTitlePosition; + +// +// Buttons +// +typedef enum _NSButtonType { + NSMomentaryPushButton, + NSPushOnPushOffButton, + NSToggleButton, + NSSwitchButton, + NSRadioButton, + NSMomentaryChangeButton, + NSOnOffButton +} NSButtonType; + +// +// Cells and Button Cells +// +typedef enum _NSCellType { + NSNullCellType, + NSTextCellType, + NSImageCellType +} NSCellType; + +typedef enum _NSCellImagePosition { + NSNoImage, + NSImageOnly, + NSImageLeft, + NSImageRight, + NSImageBelow, + NSImageAbove, + NSImageOverlaps +} NSCellImagePosition; + +typedef enum _NSCellAttribute { + NSCellDisabled, + NSCellState, + NSPushInCell, + NSCellEditable, + NSChangeGrayCell, + NSCellHighlighted, + NSCellLightsByContents, + NSCellLightsByGray, + NSChangeBackgroundCell, + NSCellLightsByBackground, + NSCellIsBordered, + NSCellHasOverlappingImage, + NSCellHasImageHorizontal, + NSCellHasImageOnLeftOrBottom, + NSCellChangesContents, + NSCellIsInsetButton +} NSCellAttribute; + +enum { + NSAnyType, + NSIntType, + NSPositiveIntType, + NSFloatType, + NSPositiveFloatType, + NSDateType, + NSDoubleType, + NSPositiveDoubleType +}; + +enum { + NSNoCellMask, + NSContentsCellMask, + NSPushInCellMask, + NSChangeGrayCellMask, + NSChangeBackgroundCellMask +}; + +// +// Color +// +enum { + NSGrayModeColorPanel, + NSRGBModeColorPanel, + NSCMYKModeColorPanel, + NSHSBModeColorPanel, + NSCustomPaletteModeColorPanel, + NSColorListModeColorPanel, + NSWheelModeColorPanel +}; + +enum { + NSColorPanelGrayModeMask, + NSColorPanelRGBModeMask, + NSColorPanelCMYKModeMask, + NSColorPanelHSBModeMask, + NSColorPanelCustomPaletteModeMask, + NSColorPanelColorListModeMask, + NSColorPanelWheelModeMask, + NSColorPanelAllModesMask +}; + +// +// Data Link +// +typedef int NSDataLinkNumber; +extern NSString *NSDataLinkFileNameExtension; +typedef enum _NSDataLinkDisposition { + NSLinkInDestination, + NSLinkInSource, + NSLinkBroken +} NSDataLinkDisposition; + +typedef enum _NSDataLinkUpdateMode { + NSUpdateContinuously, + NSUpdateWhenSourceSaved, + NSUpdateManually, + NSUpdateNever +} NSDataLinkUpdateMode; + +// +// Drag Operation +// +typedef enum _NSDragOperation { + NSDragOperationNone, + NSDragOperationCopy, + NSDragOperationLink, + NSDragOperationGeneric, + NSDragOperationPrivate, + NSDragOperationAll +} NSDragOperation; + +// +// Event Handling +// +typedef enum _NSEventType { + NSLeftMouseDown, + NSLeftMouseUp, + NSRightMouseDown, + NSRightMouseUp, + NSMouseMoved, + NSLeftMouseDragged, + NSRightMouseDragged, + NSMouseEntered, + NSMouseExited, + NSKeyDown, + NSKeyUp, + NSFlagsChanged, + NSPeriodic, + NSCursorUpdate +} NSEventType; + +enum { + NSUpArrowFunctionKey = 0xF700, + NSDownArrowFunctionKey = 0xF701, + NSLeftArrowFunctionKey = 0xF702, + NSRightArrowFunctionKey = 0xF703, + NSF1FunctionKey = 0xF704, + NSF2FunctionKey = 0xF705, + NSF3FunctionKey = 0xF706, + NSF4FunctionKey = 0xF707, + NSF5FunctionKey = 0xF708, + NSF6FunctionKey = 0xF709, + NSF7FunctionKey = 0xF70A, + NSF8FunctionKey = 0xF70B, + NSF9FunctionKey = 0xF70C, + NSF10FunctionKey = 0xF70D, + NSF11FunctionKey = 0xF70E, + NSF12FunctionKey = 0xF70F, + NSF13FunctionKey = 0xF710, + NSF14FunctionKey = 0xF711, + NSF15FunctionKey = 0xF712, + NSF16FunctionKey = 0xF713, + NSF17FunctionKey = 0xF714, + NSF18FunctionKey = 0xF715, + NSF19FunctionKey = 0xF716, + NSF20FunctionKey = 0xF717, + NSF21FunctionKey = 0xF718, + NSF22FunctionKey = 0xF719, + NSF23FunctionKey = 0xF71A, + NSF24FunctionKey = 0xF71B, + NSF25FunctionKey = 0xF71C, + NSF26FunctionKey = 0xF71D, + NSF27FunctionKey = 0xF71E, + NSF28FunctionKey = 0xF71F, + NSF29FunctionKey = 0xF720, + NSF30FunctionKey = 0xF721, + NSF31FunctionKey = 0xF722, + NSF32FunctionKey = 0xF723, + NSF33FunctionKey = 0xF724, + NSF34FunctionKey = 0xF725, + NSF35FunctionKey = 0xF726, + NSInsertFunctionKey = 0xF727, + NSDeleteFunctionKey = 0xF728, + NSHomeFunctionKey = 0xF729, + NSBeginFunctionKey = 0xF72A, + NSEndFunctionKey = 0xF72B, + NSPageUpFunctionKey = 0xF72C, + NSPageDownFunctionKey = 0xF72D, + NSPrintScreenFunctionKey = 0xF72E, + NSScrollLockFunctionKey = 0xF72F, + NSPauseFunctionKey = 0xF730, + NSSysReqFunctionKey = 0xF731, + NSBreakFunctionKey = 0xF732, + NSResetFunctionKey = 0xF733, + NSStopFunctionKey = 0xF734, + NSMenuFunctionKey = 0xF735, + NSUserFunctionKey = 0xF736, + NSSystemFunctionKey = 0xF737, + NSPrintFunctionKey = 0xF738, + NSClearLineFunctionKey = 0xF739, + NSClearDisplayFunctionKey = 0xF73A, + NSInsertLineFunctionKey = 0xF73B, + NSDeleteLineFunctionKey = 0xF73C, + NSInsertCharFunctionKey = 0xF73D, + NSDeleteCharFunctionKey = 0xF73E, + NSPrevFunctionKey = 0xF73F, + NSNextFunctionKey = 0xF740, + NSSelectFunctionKey = 0xF741, + NSExecuteFunctionKey = 0xF742, + NSUndoFunctionKey = 0xF743, + NSRedoFunctionKey = 0xF744, + NSFindFunctionKey = 0xF745, + NSHelpFunctionKey = 0xF746, + NSModeSwitchFunctionKey = 0xF747 +}; + +enum { + NSAlphaShiftKeyMask = 1, + NSShiftKeyMask = 2, + NSControlKeyMask = 4, + NSAlternateKeyMask = 8, + NSCommandKeyMask = 16, + NSNumericPadKeyMask = 32, + NSHelpKeyMask = 64, + NSFunctionKeyMask = 128 +}; + +enum { + NSLeftMouseDownMask = 1, + NSLeftMouseUpMask = 2, + NSRightMouseDownMask = 4, + NSRightMouseUpMask = 8, + NSMouseMovedMask = 16, + NSLeftMouseDraggedMask = 32, + NSRightMouseDraggedMask = 64, + NSMouseEnteredMask = 128, + NSMouseExitedMask = 256, + NSKeyDownMask = 512, + NSKeyUpMask = 1024, + NSFlagsChangedMask = 2048, + NSPeriodicMask = 4096, + NSCursorUpdateMask = 8192, +// Note that NSAnyEventMask is an OR-combination of all other event masks + NSAnyEventMask = 16383 +}; + +// +// Exceptions +// + +// +// Global Exception Strings +// +extern NSString *NSAbortModalException; +extern NSString *NSAbortPrintingException; +extern NSString *NSAppKitIgnoredException; +extern NSString *NSAppKitVirtualMemoryException; +extern NSString *NSBadBitmapParametersException; +extern NSString *NSBadComparisonException; +extern NSString *NSBadRTFColorTableException; +extern NSString *NSBadRTFDirectiveException; +extern NSString *NSBadRTFFontTableException; +extern NSString *NSBadRTFStyleSheetException; +extern NSString *NSBrowserIllegalDelegateException; +extern NSString *NSColorListIOException; +extern NSString *NSColorListNotEditableException; +extern NSString *NSDraggingException; +extern NSString *NSFontUnavailableException; +extern NSString *NSIllegalSelectorException; +extern NSString *NSImageCacheException; +extern NSString *NSNibLoadingException; +extern NSString *NSPPDIncludeNotFoundException; +extern NSString *NSPPDIncludeStackOverflowException; +extern NSString *NSPPDIncludeStackUnderflowException; +extern NSString *NSPPDParseException; +extern NSString *NSPasteboardCommunicationException; +extern NSString *NSPrintOperationExistsException; +extern NSString *NSPrintPackageException; +extern NSString *NSPrintingCommunicationException; +extern NSString *NSRTFPropertyStackOverflowException; +extern NSString *NSTIFFException; +extern NSString *NSTextLineTooLongException; +extern NSString *NSTextNoSelectionException; +extern NSString *NSTextReadException; +extern NSString *NSTextWriteException; +extern NSString *NSTypedStreamVersionException; +extern NSString *NSWindowServerCommunicationException; +extern NSString *NSWordTablesReadException; +extern NSString *NSWordTablesWriteException; + +// +// Fonts +// +typedef unsigned int NSFontTraitMask; + +enum { + NSItalicFontMask = 1, + NSBoldFontMask = 2, + NSUnboldFontMask = 4, + NSNonStandardCharacterSetFontMask = 8, + NSNarrowFontMask = 16, + NSExpandedFontMask = 32, + NSCondensedFontMask = 64, + NSSmallCapsFontMask = 128, + NSPosterFontMask = 256, + NSCompressedFontMask = 512, + NSUnitalicFontMask = 1024 +}; + +typedef unsigned int NSGlyph; + +enum { + NSFPPreviewButton , + NSFPRevertButton, + NSFPSetButton, + NSFPPreviewField, + NSFPSizeField, + NSFPSizeTitle, + NSFPCurrentField +}; + +const float *NSFontIdentityMatrix; + +extern NSString *NSAFMAscender; +extern NSString *NSAFMCapHeight; +extern NSString *NSAFMCharacterSet; +extern NSString *NSAFMDescender; +extern NSString *NSAFMEncodingScheme; +extern NSString *NSAFMFamilyName; +extern NSString *NSAFMFontName; +extern NSString *NSAFMFormatVersion; +extern NSString *NSAFMFullName; +extern NSString *NSAFMItalicAngle; +extern NSString *NSAFMMappingScheme; +extern NSString *NSAFMNotice; +extern NSString *NSAFMUnderlinePosition; +extern NSString *NSAFMUnderlineThickness; +extern NSString *NSAFMVersion; +extern NSString *NSAFMWeight; +extern NSString *NSAFMXHeight; + +// +// Graphics +// +typedef int NSWindowDepth; + +typedef enum _NSTIFFCompression { + NSTIFFCompressionNone = 1, + NSTIFFCompressionCCITTFAX3 = 3, + NSTIFFCompressionCCITTFAX4 = 4, + NSTIFFCompressionLZW = 5, + NSTIFFCompressionJPEG = 6, + NSTIFFCompressionNEXT = 32766, + NSTIFFCompressionPackBits = 32773, + NSTIFFCompressionOldJPEG = 32865 +} NSTIFFCompression; + +enum { + NSImageRepMatchesDevice +}; + +// +// Colorspace Names +// +extern NSString *NSCalibratedWhiteColorSpace; +extern NSString *NSCalibratedBlackColorSpace; +extern NSString *NSCalibratedRGBColorSpace; +extern NSString *NSDeviceWhiteColorSpace; +extern NSString *NSDeviceBlackColorSpace; +extern NSString *NSDeviceRGBColorSpace; +extern NSString *NSDeviceCMYKColorSpace; +extern NSString *NSNamedColorSpace; +extern NSString *NSCustomColorSpace; + +// +// Gray Values +// +extern const float NSBlack; +extern const float NSDarkGray; +extern const float NSWhite; +extern const float NSLightGray; + +// +// Device Dictionary Keys +// +extern NSString *NSDeviceResolution; +extern NSString *NSDeviceColorSpaceName; +extern NSString *NSDeviceBitsPerSample; +extern NSString *NSDeviceIsScreen; +extern NSString *NSDeviceIsPrinter; +extern NSString *NSDeviceSize; + +// +// Matrix +// +typedef enum _NSMatrixMode { + NSRadioModeMatrix, + NSHighlightModeMatrix, + NSListModeMatrix, + NSTrackModeMatrix +} NSMatrixMode; + +// +// Notifications +// +// NSApplication +extern NSString *NSApplicationDidBecomeActiveNotification; +extern NSString *NSApplicationDidFinishLaunchingNotification; +extern NSString *NSApplicationDidHideNotification; +extern NSString *NSApplicationDidResignActiveNotification; +extern NSString *NSApplicationDidUnhideNotification; +extern NSString *NSApplicationDidUpdateNotification; +extern NSString *NSApplicationWillBecomeActiveNotification; +extern NSString *NSApplicationWillFinishLaunchingNotification; +extern NSString *NSApplicationWillHideNotification; +extern NSString *NSApplicationWillResignActiveNotification; +extern NSString *NSApplicationWillUnhideNotification; +extern NSString *NSApplicationWillUpdateNotification; + +// NSColorList +extern NSString *NSColorListChangedNotification; +// NSColorPanel +extern NSString *NSColorPanelColorChangedNotification; + +// NSControl +extern NSString *NSControlTextDidBeginEditingNotification; +extern NSString *NSControlTextDidEndEditingNotification; +extern NSString *NSControlTextDidChangeNotification; + +// NSImageRep +extern NSString *NSImageRepRegistryChangedNotification; + +// NSSplitView +extern NSString *NSSplitViewDidResizeSubviewsNotification; +extern NSString *NSSplitViewWillResizeSubviewsNotification; + +// NSText +extern NSString *NSTextDidBeginEditingNotification; +extern NSString *NSTextDidEndEditingNotification; +extern NSString *NSTextDidChangeNotification; + +// NSView +extern NSString *NSViewFrameChangedNotification; +extern NSString *NSViewFocusChangedNotification; + +// NSWindow +extern NSString *NSWindowDidBecomeKeyNotification; +extern NSString *NSWindowDidBecomeMainNotification; +extern NSString *NSWindowDidChangeScreenNotification; +extern NSString *NSWindowDidDeminiaturizeNotification; +extern NSString *NSWindowDidExposeNotification; +extern NSString *NSWindowDidMiniaturizeNotification; +extern NSString *NSWindowDidMoveNotification; +extern NSString *NSWindowDidResignKeyNotification; +extern NSString *NSWindowDidResignMainNotification; +extern NSString *NSWindowDidResizeNotification; +extern NSString *NSWindowDidUpdateNotification; +extern NSString *NSWindowWillCloseNotification; +extern NSString *NSWindowWillMiniaturizeNotification; +extern NSString *NSWindowWillMoveNotification; + +// NSWorkspace +extern NSString *NSWorkspaceDidLaunchApplicationNotification; +extern NSString *NSWorkspaceDidMountNotification; +extern NSString *NSWorkspaceDidPerformFileOperationNotification; +extern NSString *NSWorkspaceDidTerminateApplicationNotification; +extern NSString *NSWorkspaceDidUnmountNotification; +extern NSString *NSWorkspaceWillLaunchApplicationNotification; +extern NSString *NSWorkspaceWillPowerOffNotification; +extern NSString *NSWorkspaceWillUnmountNotification; + +// +// Panel +// +enum { + NSOKButton = 1, + NSCancelButton = 0 +}; + +enum { + NSAlertDefaultReturn = 1, + NSAlertAlternateReturn = 0, + NSAlertOtherReturn = -1, + NSAlertErrorReturn = -2 +}; + +// +// Page Layout +// +enum { + NSPLImageButton, + NSPLTitleField, + NSPLPaperNameButton, + NSPLUnitsButton, + NSPLWidthForm, + NSPLHeightForm, + NSPLOrientationMatrix, + NSPLCancelButton, + NSPLOKButton +}; + +// +// Pasteboard +// + +// +// Pasteboard Type Globals +// +extern NSString *NSStringPboardType; +extern NSString *NSColorPboardType; +extern NSString *NSFileContentsPboardType; +extern NSString *NSFilenamesPboardType; +extern NSString *NSFontPboardType; +extern NSString *NSRulerPboardType; +extern NSString *NSPostScriptPboardType; +extern NSString *NSTabularTextPboardType; +extern NSString *NSRTFPboardType; +extern NSString *NSTIFFPboardType; +extern NSString *NSDataLinkPboardType; +extern NSString *NSGeneralPboardType; + +// +// Pasteboard Name Globals +// +extern NSString *NSDragPboard; +extern NSString *NSFindPboard; +extern NSString *NSFontPboard; +extern NSString *NSGeneralPboard; +extern NSString *NSRulerPboard; + +// +// Printing +// +typedef enum _NSPrinterTableStatus { + NSPrinterTableOK, + NSPrinterTableNotFound, + NSPrinterTableError +} NSPrinterTableStatus; + +typedef enum _NSPrintingOrientation { + NSPortraitOrientation, + NSLandscapeOrientation +} NSPrintingOrientation; + +typedef enum _NSPrintingPageOrder { + NSDescendingPageOrder, + NSSpecialPageOrder, + NSAscendingPageOrder, + NSUnknownPageOrder +} NSPrintingPageOrder; + +typedef enum _NSPrintingPaginationMode { + NSAutoPagination, + NSFitPagination, + NSClipPagination +} NSPrintingPaginationMode; + +enum { + NSPPSaveButton, + NSPPPreviewButton, + NSFaxButton, + NSPPTitleField, + NSPPImageButton, + NSPPNameTitle, + NSPPNameField, + NSPPNoteTitle, + NSPPNoteField, + NSPPStatusTitle, + NSPPStatusField, + NSPPCopiesField, + NSPPPageChoiceMatrix, + NSPPPageRangeFrom, + NSPPPageRangeTo, + NSPPScaleField, + NSPPOptionsButton, + NSPPPaperFeedButton, + NSPPLayoutButton +}; + +// +// Printing Information Dictionary Keys +// +extern NSString *NSPrintAllPages; +extern NSString *NSPrintBottomMargin; +extern NSString *NSPrintCopies; +extern NSString *NSPrintFaxCoverSheetName; +extern NSString *NSPrintFaxHighResolution; +extern NSString *NSPrintFaxModem; +extern NSString *NSPrintFaxReceiverNames; +extern NSString *NSPrintFaxReceiverNumbers; +extern NSString *NSPrintFaxReturnReceipt; +extern NSString *NSPrintFaxSendTime; +extern NSString *NSPrintFaxTrimPageEnds; +extern NSString *NSPrintFaxUseCoverSheet; +extern NSString *NSPrintFirstPage; +extern NSString *NSPrintHorizonalPagination; +extern NSString *NSPrintHorizontallyCentered; +extern NSString *NSPrintJobDisposition; +extern NSString *NSPrintJobFeatures; +extern NSString *NSPrintLastPage; +extern NSString *NSPrintLeftMargin; +extern NSString *NSPrintManualFeed; +extern NSString *NSPrintOrientation; +extern NSString *NSPrintPackageException; +extern NSString *NSPrintPagesPerSheet; +extern NSString *NSPrintPaperFeed; +extern NSString *NSPrintPaperName; +extern NSString *NSPrintPaperSize; +extern NSString *NSPrintPrinter; +extern NSString *NSPrintReversePageOrder; +extern NSString *NSPrintRightMargin; +extern NSString *NSPrintSavePath; +extern NSString *NSPrintScalingFactor; +extern NSString *NSPrintTopMargin; +extern NSString *NSPrintVerticalPagination; +extern NSString *NSPrintVerticallyCentered; + +// +// Print Job Disposition Values +// +extern NSString *NSPrintCancelJob; +extern NSString *NSPrintFaxJob; +extern NSString *NSPrintPreviewJob; +extern NSString *NSPrintSaveJob; +extern NSString *NSPrintSpoolJob; + +// +// Save Panel +// +enum { + NSFileHandlingPanelImageButton, + NSFileHandlingPanelTitleField, + NSFileHandlingPanelBrowser, + NSFileHandlingPanelCancelButton, + NSFileHandlingPanelOKButton, + NSFileHandlingPanelForm, + NSFileHandlingPanelHomeButton, + NSFileHandlingPanelDiskButton, + NSFileHandlingPanelDiskEjectButton +}; + +// +// Scroller +// +typedef enum _NSScrollArrowPosition { + NSScrollerArrowsMaxEnd, + NSScrollerArrowsMinEnd, + NSScrollerArrowsNone +} NSScrollArrowPosition; + +typedef enum _NSScrollerPart { + NSScrollerNoPart, + NSScrollerDecrementPage, + NSScrollerKnob, + NSScrollerIncrementPage, + NSScrollerDecrementLine, + NSScrollerIncrementLine, + NSScrollerKnobSlot +} NSScrollerPart; + +typedef enum _NSScrollerUsablePart { + NSNoScrollerParts, + NSOnlyScrollerArrows, + NSAllScrollerParts +} NSUsableScrollerParts; + +typedef enum _NSScrollerArrow { + NSScrollerIncrementArrow, + NSScrollerDecrementArrow +} NSScrollerArrow; + +const float NSScrollerWidth; + +// +// Text +// +typedef short NSLineDesc; + +typedef struct _NSTextChunk { + short growby; + int allocated; + int used; +} NSTextChunk; + +typedef struct _NSBreakArray { + NSTextChunk chunk; + NSLineDesc breaks[1]; +} NSBreakArray; + +typedef struct _NSCharArray { + NSTextChunk chunk; + unsigned char text[1]; +} NSCharArray; + +typedef unsigned short (*NSCharFilterFunc) (unsigned short charCode, + int flags, + NSStringEncoding theEncoding); + +typedef struct _NSFSM { + const struct _NSFSM *next; + short delta; + short token; +} NSFSM; + +typedef struct _NSHeightInfo { + float newHeight; + float oldHeight; + NSLineDesc lineDesc; +} NSHeightInfo; + +typedef struct _NSHeightChange { + NSLineDesc lineDesc; + NSHeightInfo heightInfo; +} NSHeightChange; + +typedef struct { + unsigned int underline:1; + unsigned int dummy:1; + unsigned int subclassWantsRTF:1; + unsigned int graphic:1; + unsigned int forcedSymbol:1; + unsigned int RESERVED:11; +} NSRunFlags; + +typedef struct _NSRun { + id font; + int chars; + void *paraStyle; + int textRGBColor; + unsigned char superscript; + unsigned char subscript; + id info; + NSRunFlags rFlags; +} NSRun; + +typedef struct { + unsigned int mustMove:1; + unsigned int isMoveChar:1; + unsigned int RESERVED:14; +} NSLayFlags; + +typedef struct _NSLay { + float x; + float y; + short offset; + short chars; + id font; + void *paraStyle; + NSRun *run; + NSLayFlags lFlags; +} NSLay; + +typedef struct _NSLayArray { + NSTextChunk chunk; + NSLay lays[1]; +} NSLayArray; + +typedef struct _NSWidthArray { + NSTextChunk chunk; + float widths[1]; +} NSWidthArray; + +typedef struct _NSTextBlock { + struct _NSTextBlock *next; + struct _NSTextBlock *prior; + struct _tbFlags { + unsigned int malloced:1; + unsigned int PAD:15; + } tbFlags; + short chars; + unsigned char *text; +} NSTextBlock; + +typedef struct _NSTextCache { + int curPos; + NSRun *curRun; + int runFirstPos; + NSTextBlock *curBlock; + int blockFirstPos; +} NSTextCache; + +typedef struct _NSLayInfo { + NSRect rect; + float descent; + float width; + float left; + float right; + float rightIndent; + NSLayArray *lays; + NSWidthArray *widths; + NSCharArray *chars; + NSTextCache cache; + NSRect *textClipRect; + struct _lFlags { + unsigned int horizCanGrow:1; + unsigned int vertCanGrow:1; + unsigned int erase:1; + unsigned int ping:1; + unsigned int endsParagraph:1; + unsigned int resetCache:1; + unsigned int RESERVED:10; + } lFlags; +} NSLayInfo; + +typedef enum _NSParagraphProperty { + NSLeftAlignedParagraph, + NSRightAlignedParagraph, + NSCenterAlignedParagraph, + NSJustificationAlignedParagraph, + NSFirstIndentParagraph, + NSIndentParagraph, + NSAddTabParagraph, + NSRemoveTabParagraph, + NSLeftMarginParagraph, + NSRightMarginParagraph +} NSParagraphProperty; + +typedef struct _NSRunArray { + NSTextChunk chunk; + NSRun runs[1]; +} NSRunArray; + +typedef struct _NSSelPt { + int cp; + int line; + float x; + float y; + int c1st; + float ht; +} NSSelPt; + +typedef struct _NSTabStop { + short kind; + float x; +} NSTabStop; + +typedef char *(*NSTextFilterFunc) (id self, + unsigned char * insertText, + int *insertLength, + int position); + +typedef int (*NSTextFunc) (id self, + NSLayInfo *layInfo); + +typedef enum _NSTextAlignment { + NSLeftTextAlignment, + NSRightTextAlignment, + NSCenterTextAlignment, + NSJustifiedTextAlignment, + NSNaturalTextAlignment +} NSTextAlignment; + +typedef struct _NSTextStyle { + float indent1st; + float indent2nd; + float lineHt; + float descentLine; + NSTextAlignment alignment; + short numTabs; + NSTabStop *tabs; +} NSTextStyle; + +enum { + NSLeftTab +}; + +enum { + NSBackspaceKey = 8, + NSCarriageReturnKey = 13, + NSDeleteKey= 0x7f, + NSBacktabKey = 25 +}; + +enum { + NSIllegalTextMovement = 0, + NSReturnTextMovement = 0x10, + NSTabTextMovement = 0x11, + NSBacktabTextMovement = 0x12, + NSLeftTextMovement = 0x13, + NSRightTextMovement = 0x14, + NSUpTextMovement = 0x15, + NSDownTextMovement = 0x16 +}; + +enum { + NSTextBlockSize = 512 +}; + +// +// Break Tables +// +const NSFSM *NSCBreakTable; +int NSCBreakTableSize; +const NSFSM *NSEnglishBreakTable; +int NSEnglishBreakTableSize; +const NSFSM *NSEnglishNoBreakTable; +int NSEnglishNoBreakTableSize; + +// +// Character Category Tables +// +const unsigned char *NSCCharCatTable; +const unsigned char *NSEnglishCharCatTable; + +// +// Click Tables +// +const NSFSM *NSCClickTable; +int NSCClickTableSize; +const NSFSM *NSEnglishClickTable; +int NSEnglishClickTableSize; + +// +// Smart Cut and Paste Tables +// +const unsigned char *NSCSmartLeftChars; +const unsigned char *NSCSmartRightChars; +const unsigned char *NSEnglishSmartLeftChars; +const unsigned char *NSEnglishSmartRightChars; + +// +// NSCStringText Internal State Structure +// +typedef struct _NSCStringTextInternalState { + const NSFSM *breakTable; + const NSFSM *clickTable; + const unsigned char *preSelSmartTable; + const unsigned char *postSelSmartTable; + const unsigned char *charCategoryTable; + char delegateMethods; + NSCharFilterFunc charFilterFunc; + NSTextFilterFunc textFilterFunc; + NSString *_string; + NSTextFunc scanFunc; + NSTextFunc drawFunc; + id delegate; + int tag; + void *cursorTE; + NSTextBlock *firstTextBlock; + NSTextBlock *lastTextBlock; + NSRunArray *theRuns; + NSRun typingRun; + NSBreakArray *theBreaks; + int growLine; + int textLength; + float maxY; + float maxX; + NSRect bodyRect; + float borderWidth; + char clickCount; + NSSelPt sp0; + NSSelPt spN; + NSSelPt anchorL; + NSSelPt anchorR; + NSSize maxSize; + NSSize minSize; + struct _tFlags { +#ifdef __BIG_ENDIAN__ + unsigned int _editMode:2; + unsigned int _selectMode:2; + unsigned int _caretState:2; + unsigned int changeState:1; + unsigned int charWrap:1; + unsigned int haveDown:1; + unsigned int anchorIs0:1; + unsigned int horizResizable:1; + unsigned int vertResizable:1; + unsigned int overstrikeDiacriticals:1; + unsigned int monoFont:1; + unsigned int disableFontPanel:1; + unsigned int inClipView:1; +#else + unsigned int inClipView:1; + unsigned int disableFontPanel:1; + unsigned int monoFont:1; + unsigned int overstrikeDiacriticals:1; + unsigned int vertResizable:1; + unsigned int horizResizable:1; + unsigned int anchorIs0:1; + unsigned int haveDown:1; + unsigned int charWrap:1; + unsigned int changeState:1; + unsigned int _caretState:2; + unsigned int _selectMode:2; + unsigned int _editMode:2; +#endif + } tFlags; + void *_info; + void *_textStr; +} NSCStringTextInternalState; + +// +// View +// +typedef int NSTrackingRectTag; + +typedef enum _NSBorderType { + NSNoBorder, + NSLineBorder, + NSBezelBorder, + NSGrooveBorder +} NSBorderType; + +enum { + NSViewNotSizable, + NSViewMinXMargin, + NSViewWidthSizable, + NSViewMaxXMargin, + NSViewMinYMargin, + NSViewHeightSizable, + NSViewMaxYMargin +}; + +// +// Window +// +enum { + NSNormalWindowLevel = 0, + NSFloatingWindowLevel = 3, + NSDockWindowLevel = 5, + NSSubmenuWindowLevel = 10, + NSMainMenuWindowLevel = 20 +}; + +enum { + NSBorderlessWindowMask = 1, + NSTitledWindowMask = 2, + NSClosableWindowMask = 4, + NSMiniaturizableWindowMask = 8, + NSResizableWindowMask = 16 +}; + +// +// Size Globals +// +NSSize NSIconSize; +NSSize NSTokenSize; + +// +// Workspace +// + +// +// Workspace File Type Globals +// + +extern NSString *NSPlainFileType; +extern NSString *NSDirectoryFileType; +extern NSString *NSApplicationFileType; +extern NSString *NSFilesystemFileType; +extern NSString *NSShellCommandFileType; + +// +// Workspace File Operation Globals +// +extern NSString *NSWorkspaceCompressOperation; +extern NSString *NSWorkspaceCopyOperation; +extern NSString *NSWorkspaceDecompressOperation; +extern NSString *NSWorkspaceDecryptOperation; +extern NSString *NSWorkspaceDestroyOperation; +extern NSString *NSWorkspaceDuplicateOperation; +extern NSString *NSWorkspaceEncryptOperation; +extern NSString *NSWorkspaceLinkOperation; +extern NSString *NSWorkspaceMoveOperation; +extern NSString *NSWorkspaceRecycleOperation; + +#endif // _GNUstep_H_GUITypes diff --git a/Headers/gnustep/gui/config.h.in b/Headers/gnustep/gui/config.h.in new file mode 100644 index 000000000..1355fb6e9 --- /dev/null +++ b/Headers/gnustep/gui/config.h.in @@ -0,0 +1,45 @@ +/* + config.h + + System dependent includes. + + @configure_input@ + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_AppKitConfig +#define _GNUstep_H_AppKitConfig + +#include + +// Until they have been added to libobjects +#define NSNotification void +#define NSNotificationCenter void + +@config_include@ + +#endif /* _GNUstep_H_AppKitConfig */ + diff --git a/Headers/gnustep/gui/config.sed.nt b/Headers/gnustep/gui/config.sed.nt new file mode 100644 index 000000000..213dd6dcd --- /dev/null +++ b/Headers/gnustep/gui/config.sed.nt @@ -0,0 +1,2 @@ +s/@configure_input@/ Generated from config.in by configure.bat/ +s/@config_include@// diff --git a/Headers/gnustep/gui/stdappkit.h b/Headers/gnustep/gui/stdappkit.h new file mode 100644 index 000000000..99c2538ac --- /dev/null +++ b/Headers/gnustep/gui/stdappkit.h @@ -0,0 +1,39 @@ +/* stdappkit.h + + Global includes for the GNUstep GUI Library. + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_AppKitStandard +#define _GNUstep_H_AppKitStandard + +#include + +#include +#include +#include + +#endif // _GNUstep_H_AppKitStandard diff --git a/INSTALL b/INSTALL new file mode 100644 index 000000000..aa4e7bda1 --- /dev/null +++ b/INSTALL @@ -0,0 +1,183 @@ +This file documents the installation of the GNUstep GUI +Library, `libgnustep-gui'. Copyright (C) 1996 Free Software +Foundation, Inc. You may copy, distribute, and modify it freely as long +as you preserve this copyright notice and permission notice. + +Installing `libgnustep-gui' +*************************** + + To compile and install `libgnustep-gui': + + Here is a quick-and-dirty example of installation commands: + + ./configure --prefix=/usr/local + make + make install + + Here are more detailed instructions. These notes are for a GNU system + that can run ./configure. For Windows NT/95, if you have a working + bash shell then you can follow these instructions; otherwise, follow + the Windows NT/95 specific instructions below. + + 1. Install `gcc'. The library requires gcc version + 2.7.0 or later. + + 2. Install 'libgnustep-base'. This library requires the classes in + the GNUstep Base Library. You must also apply the Objective-C + Runtime patches to GCC which makes the runtime thread-safe, if + your version of GCC lacks them. + + 3. Configure the package for your system. In the directory that this + file is in, type `./configure'. If you're using `csh' on an old + version of System V, you might need to type `sh configure' instead + to prevent `csh' from trying to execute `configure' itself. + + The `configure' shell script attempts to guess correct values for + various system-dependent variables used during compilation, and + creates the Makefile(s) (one in each subdirectory of the source + directory). In some packages it creates a C header file + containing system-dependent definitions. It also creates a file + `config.status' that you can run in the future to recreate the + current configuration. + + Running `configure' takes less than a minute or two. While it is + running, it prints some messages that tell what it is doing. If + you don't want to see the messages, run `configure' with its + standard output redirected to `/dev/null'; for example: + ./configure >/dev/null + + To compile the package in a different directory from the one + containing the source code, you must use a version of make that + supports the VPATH variable, such as GNU make. `cd' to the + directory where you want the object files and executables to go + and run `configure'. `configure' automatically checks for the + source code in the directory that `configure' is in and in `..'. + If for some reason `configure' is not in the source code directory + that you are configuring, then it will report that it can't find + the source code. In that case, run `configure' with the option + `--srcdir=DIR', where DIR is the directory that contains the + source code. + + By default, `make install' will install the package's files in + /usr/local/bin, /usr/local/lib, /usr/local/man, etc. You can + specify an installation prefix other than /usr/local by giving + `configure' the option `--prefix=PATH'. Alternately, you can do + so by giving a value for the `prefix' variable when you run + `make', e.g., + make prefix=/usr/gnu + + You can specify separate installation prefixes for + architecture-specific files and architecture-independent files. + If you give `configure' the option `--exec_prefix=PATH' or set the + `make' variable `exec_prefix' to PATH, the package will use PATH + as the prefix for installing programs and libraries. Data files + and documentation will still use the regular prefix. Normally, + all files are installed using the regular prefix. + + You can tell `configure' to figure out the configuration for your + system, and record it in `config.status', without actually + configuring the package (creating `Makefile's and perhaps a + configuration header file). To do this, give `configure' the + `--no-create' option. Later, you can run `./config.status' to + actually configure the package. This option is useful mainly in + `Makefile' rules for updating `config.status' and `Makefile'. You + can also give `config.status' the `--recheck' option, which makes + it re-run `configure' with the same arguments you used before. + This is useful if you change `configure'. + + `configure' ignores any other arguments that you give it. + + If your system requires unusual options for compilation or linking + that `configure' doesn't know about, you can give `configure' + initial values for some variables by setting them in the + environment. In Bourne-compatible shells, you can do that on the + command line like this: + CC='gcc -traditional' DEFS=-D_POSIX_SOURCE ./configure + + The `make' variables that you might want to override with + environment variables when running `configure' are: + + (For these variables, any value given in the environment overrides + the value that `configure' would choose:) + `CC' + C compiler program. Default is `cc', or `gcc' if `gcc' is in + your PATH. + + `INSTALL' + Program to use to install files. Default is `install' if you + have it, `install.sh' otherwise. + + (For these variables, any value given in the environment is added + to the value that `configure' chooses:) + `DEFS' + Configuration options, in the form `-Dfoo -Dbar ...' + + `LIBS' + Libraries to link with, in the form `-lfoo -lbar ...' + + If you need to do unusual things to compile the package, we + encourage you to figure out how `configure' could check whether to + do them, and mail diffs or instructions to the address given in + the `README' so we can include them in the next release. + + 4. Type `make' to compile the package. If you want, you can override + the `make' variables `CFLAGS' and `LDFLAGS' like this: + make CFLAGS=-O2 LDFLAGS=-s + + 5. Type `make install' to install the library, data files, header + files, and documentation. + + 6. You can remove the program binaries and object files from the + source directory by typing `make clean'. To also remove the + Makefile(s), and `config.status' (all the files that `configure' + created), type `make distclean'. + + The file `configure.in' is used as a template to create + `configure' by a program called `autoconf'. You will only need it + if you want to regenerate `configure' using a newer version of + `autoconf'. + +Installing on Windows NT/95 +*************************** + +The system requires that you have headers and libraries for +the WIN32 API and ANSI-C. + + Quick installation instructions: + + configure + make + make install + + Detail installation instructions: + + 1. Install `gcc'. The library requires gcc version + 2.7.0 or later. + + 2. Install 'libgnustep-base'. This library requires the classes in + the GNUstep Base Library. You must also apply the Objective-C + Runtime patches to GCC which makes the runtime thread-safe, if + your version of GCC lacks them. + + 3. Configure the package for your system. Review the Makefile.sed.nt + which is used to process Makefile.in to create a working Makefile. + Of interest are: + + 'lib_installdir' where to install the library file + 'h_installdir' where to install the headers + 'sys_libs' WIN32 API and ANSI-C libraries + + 4. Run 'configure.bat' to create the Makefile, and the header configuration + file 'Headers/gnustep/gui/config.h' + + 5. Type `make' to compile the package. If you want, you can override + the `make' variables `CFLAGS' and `LDFLAGS' like this: + make CFLAGS=-O2 LDFLAGS=-s + + 6. Type `make install' to install the library, data files, header + files, and documentation. + + 7. You can remove the program binaries and object files from the + source directory by typing `make clean'. To also remove the + Makefile(s), and `config.status' (all the files that `configure' + created), type `make distclean'. diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 000000000..415aaa83e --- /dev/null +++ b/Makefile.in @@ -0,0 +1,112 @@ +# @configure_input@ +# +# Top level makefile for GNUstep GUI Library +# Copyright (C) 1996 Free Software Foundation +# +# Author: Scott Christley +# + +SHELL = /bin/sh + +#### Start of system configuration section. #### + +srcdir = @srcdir@ +VPATH = @srcdir@ + +MAKEDEFINES = + +oext = .o +libext = .a +exeext = + +#### End of system configuration section. #### + +include $(srcdir)/Version + +SUBDIRS = Source Testing + +DIST_FILES = \ + Makefile.in configure config.guess \ + configure.bat Makefile.sed.nt \ + README ANNOUNCE NEWS INSTALL \ + COPYING.LIB COPYING ChangeLog + +all: Source + +%-subdirs: + for i in $(SUBDIRS); do \ + (cd $$i; $(MAKE) $(MAKEDEFINES) $*); \ + done + +Source Documentation: FORCE + cd $@; $(MAKE) $(MAKEDEFINES) + +install uninstall TAGS: Source + for i in $(SUBDIRS); do \ + (cd $$i; $(MAKE) $(MAKEDEFINES) $@); \ + done + +info dvi: + cd Documentation ; $(MAKE) $(MAKEDEFINES) $@ + +Testing: Source + cd $@; $(MAKE) $(MAKEDEFINES) + +Makefile: Makefile.in config.status + $(SHELL) config.status +config.status: configure + $(SHELL) $(srcdir)/configure --no-create + +mostlyclean-top: + rm -f *~ +clean-top: +maintainer-clean-top: + +mostlyclean: mostlyclean-top mostlyclean-subdirs +clean: mostlyclean-top clean-subdirs +distclean: clean-top distclean-subdirs + rm -f Makefile config.status config.log config.cache TAGS + cd Headers ; cd gnustep ; cd gui ; rm -f config.h + cd Headers ; rm -f AppKit ; rm -f DPSClient +maintainer-clean: maintainer-clean-subdirs + +snap: $(DIST_FILES) + rm -rf snap + mkdir snap + for i in $(SUBDIRS); do \ + (cd $$i; $(MAKE) $(MAKEDEFINES) copy-dist); \ + done + mkdir snap/config + for file in $(DIST_FILES); do \ + ln $$file snap/$$file ; \ + done + +snapshot: snap + ln README.first snap + rm -f .name + echo libobjects-`date +%y%m%d` >.name + rm -rf `cat .name` + mv snap `cat .name` + tar -chvf `cat .name`.tar `cat .name` + rm -f `cat .name`.tar.gz + gzip -9 `cat .name`.tar + rm -rf `cat .name` + +dist: snap + mv snap libobjects-$(OBJECTS_VERSION) + tar -chvf libobjects-$(OBJECTS_VERSION).tar \ + libobjects-$(OBJECTS_VERSION) + rm -f libobjects-$(OBJECTS_VERSION).tar.gz + gzip -9 libobjects-$(OBJECTS_VERSION).tar + rm -rf libobjects-$(OBJECTS_VERSION) + +rcs-list-locked: + @echo "===." + @rlog -L -R $(RCS_FILES) + @for i in $(SUBDIRS); do \ + echo "===$$i"; \ + (cd $$i; \ + $(MAKE) -s $(MAKEDEFINES) rcs-list-locked); \ + done + +FORCE: diff --git a/Makefile.sed.nt b/Makefile.sed.nt new file mode 100644 index 000000000..fcdcd5168 --- /dev/null +++ b/Makefile.sed.nt @@ -0,0 +1,37 @@ +s/@configure_input@/ Generated from Makefile.in by configure.bat/ +s/@srcdir@/./ +s/@CC@/gcc -fgnu-runtime -O/ +s/@lib_installdir@/\/MB\/Libraries/ +s/@h_installdir@/\/MB\/Headers/ +s/@gcc_lib@/libgcc.lib/ +s/@objc_lib@/libobjc.lib/ +s/@sys_libs@/libc.lib oldnames.lib user32.lib gdi32.lib wsock32.lib/ +s/@add_libs@/libobjects.lib General.lib/ +s/@exeext@/.exe/ +s/@oext@/.obj/ +s/@libext@/.lib/ +s/@resext@/.res/ +s/@rcext@/.rc/ +s/INIT_FILE =/INIT_FILE = init_$(MAIN_FILE)/ +s/@ldflags@/-align:0x1000 -entry:WinMainCRTStartup -stack:1000000,1000000/ +s/@ld@/ld -subsystem:windows/ +s/@ldout@/-out:/ +s/@lib@/lib/ +s/@libout@/-out:/ +s/@ranlib@/touch/ +s/@rc@/rc \/l 0x409 \/i $(MB_INCLUDE)/ +s/cd Headers ; cd AppKit ; rm -f *~/cd Headers \& cd AppKit \& rm -f *~/ +s/cd Headers ; cd AppKit ; rm -f config.h/cd Headers \& cd AppKit \& rm -f config.h/ +s/cd $@; $(MAKE) $(MAKEDEFINES)/cd $@ \& $(MAKE) $(MAKEDEFINES)/ +/%-subdirs:/,/done/c\ +%-subdirs: \ + for %i in ( $(SUBDIRS) ) do \\\ + ( cd %i & \\\ + $(MAKE) - $(MAKEFLAGS) $(MAKEDEFINES) $* & \\\ + cd .. ) +/install uninstall TAGS:/,/done/c\ +install uninstall TAGS: Source\ + for %i in ( $(SUBDIRS) ) do \\\ + ( cd %i & \\\ + $(MAKE) - $(MAKEFLAGS) $(MAKEDEFINES) $@ & \\\ + cd .. ) diff --git a/NEWS b/NEWS new file mode 100644 index 000000000..e6ed332f7 --- /dev/null +++ b/NEWS @@ -0,0 +1,21 @@ +GNUstep GUI Library NEWS +************************ + +The currently released version of the library is `0.1.0' + +Noteworthy changes in version `0.1.0' +====================================== + + * Integration of the GNUstep X/DPS GUI Backend. This has finally + produced a set of core code with can display on X/Windows. + Much of the X/Windows code has been written by Pascal Forget + and integration efforts have been lead by Scott + Christley . + + * Some major directory reorganization for the new naming guidelines. + Headers previously in AppKit and DPSClient directories have been moved + to gnustep/gui and gnustep/dps directores and symbol links are + created for the AppKit and DPSClient directories. This should allow + both GNUstep and other OpenStep implementations to reside on the + same machine without conflicts. + diff --git a/README b/README new file mode 100644 index 000000000..414cb8d7f --- /dev/null +++ b/README @@ -0,0 +1,32 @@ +GNUstep GUI Library README +************************** + +Here is some introductory info to get you started: + +Initial reading +=============== + + The file `ANNOUNCE' contains a very brief overview of the library. + It also tells you where to get the most recent version. + + The file `NEWS' has the library's feature history. + + The file `INSTALL' gives instructions for installing the library. + +How can you help? +================= + + * Read the projects and questions in the `TODO' file. If you can + volunteer for any of the projects, or if you have any useful + comments send me email! + + * Give me feedback! Tell me what you like; tell me what you think + could be better. Send me bug reports. + + * Donate classes. If you write classes that fit in the GNUstep GUI + Library framework, I'd be happy to include them. + +Creators rejoice! +Scott Christley +scottc@net-community.com + diff --git a/Source/Functions.m b/Source/Functions.m new file mode 100644 index 000000000..97c3e60b8 --- /dev/null +++ b/Source/Functions.m @@ -0,0 +1,442 @@ +/* + Functions.m + + Generic Functions for the GNUstep GUI Library. + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include + +// Should be in Foundation Kit +// Does not handle %@ +// yuck, yuck, yuck +extern LogFile *logFile; +void NSLogV(NSString *format, va_list args) +{ + char out[1024]; + + vsprintf(out, [format cString], args); + [logFile writeLog:out]; +} + +void NSLog(NSString *format, ...) +{ + va_list ap; + + va_start(ap, format); + NSLogV(format, ap); + va_end(ap); +} + +void NSNullLog(NSString *format, ...) +{ +} + +// +// Rectangle Drawing Functions +// +// +// Optimize Drawing +// +void NSEraseRect(NSRect aRect) +{} + +void NSHighlightRect(NSRect aRect) +{} + +void NSRectClip(NSRect aRect) +{} + +void NSRectClipList(const NSRect *rects, int count) +{} + +void NS__RectFill(id self, NSRect aRect) +{ + char out[80]; + sprintf(out, "DPS: rect: %f %f %f %f\n", aRect.origin.x, + aRect.origin.y, aRect.size.width, aRect.size.height); + NSDebugLog([NSString stringWithCString: out]); + + PSrectfill(aRect.origin.x, aRect.origin.y, + aRect.size.width, aRect.size.height); +} + +void NSRectFillList(const NSRect *rects, int count) +{} + +void NSRectFillListWithGrays(const NSRect *rects, + const float *grays, int count) +{} + +// +// Draw a Bordered Rectangle +// +void NSDrawButton(NSRect aRect, NSRect clipRect) +{} + +void NSDrawGrayBezel(NSRect aRect, NSRect clipRect) +{} + +void NSDrawGroove(NSRect aRect, NSRect clipRect) +{} + +NSRect NSDrawTiledRects(NSRect boundsRect, NSRect clipRect, + const NSRectEdge *sides, const float *grays, + int count) +{ + return NSZeroRect; +} + +void NSDrawWhiteBezel(NSRect aRect, NSRect clipRect) +{} + +void NSFrameRect(NSRect aRect) +{} + +void NSFrameRectWithWidth(NSRect aRect, float frameWidth) +{} + +// +// Color Functions +// +// +// Get Information About Color Space and Window Depth +// +const NSWindowDepth *NSAvailableWindowDepths(void) +{ + return NULL; +} + +NSWindowDepth NSBestDepth(NSString *colorSpace, + int bitsPerSample, int bitsPerPixel, + BOOL planar, BOOL *exactMatch) +{ + return 0; +} + +int NSBitsPerPixelFromDepth(NSWindowDepth depth) +{ + return 0; +} + +int NSBitsPerSampleFromDepth(NSWindowDepth depth) +{ + return 0; +} + +NSString *NSColorSpaceFromDepth(NSWindowDepth depth) +{ + return nil; +} + +int NSNumberOfColorComponents(NSString *colorSpaceName) +{ + return 0; +} + +BOOL NSPlanarFromDepth(NSWindowDepth depth) +{ + return NO; +} + +// +// Read the Color at a Screen Position +// +NSColor *NSReadPixel(NSPoint location) +{ + return nil; +} + +// +// Text Functions +// +// +// Filter Characters Entered into a Text Object +// +unsigned short NSEditorFilter(unsigned short theChar, + int flags, NSStringEncoding theEncoding) +{ + return 0; +} + +unsigned short NSFieldFilter(unsigned short theChar, + int flags, NSStringEncoding theEncoding) +{ + return 0; +} + +// +// Calculate or Draw a Line of Text (in Text Object) +// +int NSDrawALine(id self, NSLayInfo *layInfo) +{ + return 0; +} + +int NSScanALine(id self, NSLayInfo *layInfo) +{ + return 0; +} + +// +// Calculate Font Ascender, Descender, and Line Height (in Text Object) +// +void NSTextFontInfo(id fid, + float *ascender, float *descender, + float *lineHeight) +{} + +// +// Access Text Object's Word Tables +// +NSData * NSDataWithWordTable(const unsigned char *smartLeft, + const unsigned char *smartRight, + const unsigned char *charClasses, + const NSFSM *wrapBreaks, + int wrapBreaksCount, + const NSFSM *clickBreaks, + int clickBreaksCount, + BOOL charWrap) +{ + return nil; +} + +void NSReadWordTable(NSZone *zone, + NSData *data, + unsigned char **smartLeft, + unsigned char **smartRight, + unsigned char **charClasses, + NSFSM **wrapBreaks, + int *wrapBreaksCount, + NSFSM **clickBreaks, + int *clickBreaksCount, + BOOL *charWrap) +{} + +// +// Array Allocation Functions for Use by the NSText Class +// +NSTextChunk *NSChunkCopy(NSTextChunk *pc, NSTextChunk *dpc) +{ + return NULL; +} + +NSTextChunk *NSChunkGrow(NSTextChunk *pc, int newUsed) +{ + return NULL; +} + +NSTextChunk *NSChunkMalloc(int growBy, int initUsed) +{ + return NULL; +} + +NSTextChunk *NSChunkRealloc(NSTextChunk *pc) +{ + return NULL; +} + +NSTextChunk *NSChunkZoneCopy(NSTextChunk *pc, + NSTextChunk *dpc, + NSZone *zone) +{ + return NULL; +} + +NSTextChunk *NSChunkZoneGrow(NSTextChunk *pc, int newUsed, NSZone *zone) +{ + return NULL; +} + +NSTextChunk *NSChunkZoneMalloc(int growBy, int initUsed, NSZone *zone) +{ + return NULL; +} + +NSTextChunk *NSChunkZoneRealloc(NSTextChunk *pc, NSZone *zone) +{ + return NULL; +} + + +// +// Imaging Functions +// +// +// Copy an image +// +void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect, NSRect destRect) +{} + +void NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint) +{} + +// +// Render Bitmap Images +// +void NSDrawBitmap(NSRect rect, + int pixelsWide, + int pixelsHigh, + int bitsPerSample, + int samplesPerPixel, + int bitsPerPixel, + int bytesPerRow, + BOOL isPlanar, + BOOL hasAlpha, + NSString *colorSpaceName, + const unsigned char *const data[5]) +{} + +// +// Attention Panel Functions +// +// +// Create an Attention Panel without Running It Yet +// +id NSGetAlertPanel(NSString *title, + NSString *msg, + NSString *defaultButton, + NSString *alternateButton, + NSString *otherButton, ...) +{ + return nil; +} + +// +// Create and Run an Attention Panel +// +int NSRunAlertPanel(NSString *title, + NSString *msg, + NSString *defaultButton, + NSString *alternateButton, + NSString *otherButton, ...) +{ + return 0; +} + +int NSRunLocalizedAlertPanel(NSString *table, + NSString *title, + NSString *msg, + NSString *defaultButton, + NSString *alternateButton, + NSString *otherButton, ...) +{ + return 0; +} + +// +// Release an Attention Panel +// +void NSReleaseAlertPanel(id panel) +{} + +// +// Services Menu Functions +// +// +// Determine Whether an Item Is Included in Services Menus +// +int NSSetShowsServicesMenuItem(NSString *item, BOOL showService) +{ + return 0; +} + +BOOL NSShowsServicesMenuItem(NSString *item) +{ + return NO; +} + +// +// Programmatically Invoke a Service +// +BOOL NSPerformService(NSString *item, NSPasteboard *pboard) +{ + return NO; +} + +// +// Force Services Menu to Update Based on New Services +// +void NSUpdateDynamicServices(void) +{} + +// +// Other Application Kit Functions +// +// +// Play the System Beep +// +void NSBeep(void) +{ +#ifdef WIN32 + MessageBeep(MB_OK); +#endif +} + +// +// Return File-related Pasteboard Types +// +NSString *NSCreateFileContentsPboardType(NSString *fileType) +{ + return nil; +} + +NSString *NSCreateFilenamePboardType(NSString *filename) +{ + return nil; +} + +NSString *NSGetFileType(NSString *pboardType) +{ + return nil; +} + +NSArray *NSGetFileTypes(NSArray *pboardTypes) +{ + return nil; +} + +// +// Draw a Distinctive Outline around Linked Data +// +void NSFrameLinkRect(NSRect aRect, BOOL isDestination) +{} + +float NSLinkFrameThickness(void) +{ + return 0; +} + +// +// Convert an Event Mask Type to a Mask +// +unsigned int NSEventMaskFromType(NSEventType type) +{ + return 0; +} diff --git a/Source/LogFile.m b/Source/LogFile.m new file mode 100644 index 000000000..751bb1e1b --- /dev/null +++ b/Source/LogFile.m @@ -0,0 +1,130 @@ +/* + LogFile.m + + Logfile for recording trace messages + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation LogFile + +// Class methods ++ (void)initialize +{ + // Initial version + if (self == [LogFile class]) + [self setVersion:1.0]; + +} + +// Instance methods +- init +{ + [super init]; + l_flags.is_locking = NO; + l_flags.is_date_logging = YES; + if (the_log) [self closeLog]; + return self; +} + +- (void)dealloc +{ + [self closeLog]; + return [super dealloc]; +} + +- initStdout +{ + [self init]; + return self; +} + +- initStdoutWithLocking +{ + [self init]; + l_flags.is_locking = YES; + return self; +} + +- initFile:(const char *)filename +{ + [self init]; + the_log = fopen(filename, "w"); + if (the_log) [self writeLog: "Start of Log\n"]; + if (!the_log) + return nil; + else + return self; +} + +- initFileWithLocking:(const char *)filename; +{ + [self init]; + l_flags.is_locking = YES; + the_log = fopen(filename, "w"); + if (the_log) [self writeLog: "Start of Log\n"]; + if (!the_log) + return nil; + else + return self; +} + +// Instance methods +- writeLog:(const char *)logEntry +{ + if (the_log == NULL) + printf("%s", logEntry); + else + { + fprintf(the_log, "%s", logEntry); + fflush(the_log); + } +} + +- closeLog +{ + [self writeLog:"Log closed.\n"]; + if (the_log) fclose(the_log); + the_log = NULL; +} + +- (BOOL)isDateLogging +{ + return (BOOL)l_flags.is_date_logging; +} + +- setDateLogging:(BOOL)flag +{ + l_flags.is_date_logging = flag; +} + +- (BOOL)isLocking +{ + return (BOOL)l_flags.is_locking; +} + +@end diff --git a/Source/Makefile.in b/Source/Makefile.in new file mode 100644 index 000000000..fca7278bf --- /dev/null +++ b/Source/Makefile.in @@ -0,0 +1,313 @@ +# @configure_input@ +# +# Main makefile for GNUstep GUI Library +# Copyright (C) 1996, 1996 Free Software Foundation, Inc. +# +# Author: Scott Christley +# +# This file is part of the GNUstep GUI Library. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# If you are interested in a warranty or support for this source code, +# contact Scott Christley at scottc@net-community.com +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +SHELL = /bin/sh + +#### Start of system configuration section. #### + +# The main executable or library +MAIN_FILE=libgnustep-gui + +srcdir = @srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = $(exec_prefix)/lib +includedir = $(prefix)/include + +MAKEDEFINES = + +CC = @CC@ +CPPFLAGS = @CPPFLAGS@ +CFLAGS = -c $(GCCFLAGS) -I../Headers $(CPPFLAGS) + +GCC_LIB = +OBJC_LIB = -lobjc +SYS_LIBS = +ADD_LIBS = @LIBS@ + +exeext = +oext = .o +libext = .a +resext = .res +rcext = .rc + +LN_S = @LN_S@ + +LDFLAGS = @LDFLAGS@ -o +LD = ld + +LDOUT = +LIB = ar +LIBOUT = +LIBFLAGS = rc +RANLIB = @RANLIB@ +RC = + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ + +INIT_FILE = +INIT_FILE_OBJ=$(INIT_FILE)$(oext) + +#### End of system configuration section. #### + +include $(srcdir)/../Version + +GNUSTEP1_HEADERS = gui/AppKit.h \ +gui/Functions.h \ +gui/LogFile.h \ +gui/NSActionCell.h \ +gui/NSApplication.h \ +gui/NSBitmapImageRep.h \ +gui/NSBox.h \ +gui/NSBrowser.h \ +gui/NSBrowserCell.h \ +gui/NSBundle.h \ +gui/NSButton.h \ +gui/NSButtonCell.h \ +gui/NSCachedImageRep.h \ +gui/NSCell.h \ +gui/NSClipView.h \ +gui/NSColor.h \ +gui/NSColorList.h \ +gui/NSColorPanel.h \ +gui/NSColorPicker.h \ +gui/NSColorWell.h \ +gui/NSControl.h \ +gui/NSCursor.h \ +gui/NSCustomImageRep.h + +GNUSTEP2_HEADERS = gui/NSDataLink.h \ +gui/NSDataLinkManager.h \ +gui/NSDataLinkPanel.h \ +gui/NSEPSImageRep.h \ +gui/NSEvent.h \ +gui/NSFont.h \ +gui/NSFontManager.h \ +gui/NSFontPanel.h \ +gui/NSForm.h \ +gui/NSFormCell.h \ +gui/NSHelpPanel.h \ +gui/NSImage.h \ +gui/NSImageRep.h \ +gui/NSMatrix.h \ +gui/NSMenu.h \ +gui/NSMenuCell.h \ +gui/NSOpenPanel.h \ +gui/NSPageLayout.h \ +gui/NSPanel.h \ +gui/NSPasteboard.h \ +gui/NSPopUpButton.h \ +gui/NSPrintInfo.h \ +gui/NSPrintOperation.h \ +gui/NSPrintPanel.h + +GNUSTEP3_HEADERS = gui/NSPrinter.h \ +gui/NSResponder.h \ +gui/NSSavePanel.h \ +gui/NSScreen.h \ +gui/NSScrollView.h \ +gui/NSScroller.h \ +gui/NSSelection.h \ +gui/NSSlider.h \ +gui/NSSliderCell.h \ +gui/NSSpellChecker.h \ +gui/NSSpellServer.h \ +gui/NSSplitView.h \ +gui/NSText.h \ +gui/NSTextField.h \ +gui/NSTextFieldCell.h \ +gui/NSView.h \ +gui/NSWindow.h \ +gui/NSWorkspace.h \ +gui/TrackingRectangle.h \ +gui/TypesandConstants.h \ +gui/config.h \ +gui/stdappkit.h + +GNUSTEP_DPS_HEADERS = dps/NSDPSContext.h \ +dps/DPSOperators.h \ +dps/TypesandConstants.h + +OBJS_WITHOUT_INIT = $(MAIN_FILE)$(oext) \ +NSActionCell$(oext) \ +NSApplication$(oext) \ +NSBitmapImageRep$(oext) \ +NSBox$(oext) \ +NSBrowser$(oext) \ +NSBrowserCell$(oext) \ +NSButton$(oext) \ +NSButtonCell$(oext) \ +NSCachedImageRep$(oext) \ +NSCell$(oext) \ +NSClipView$(oext) \ +NSColor$(oext) \ +NSColorList$(oext) \ +NSColorPanel$(oext) \ +NSColorPicker$(oext) \ +NSColorWell$(oext) \ +NSControl$(oext) \ +NSCursor$(oext) \ +NSCustomImageRep$(oext) \ +NSDataLink$(oext) \ +NSDataLinkManager$(oext) \ +NSDataLinkPanel$(oext) \ +NSDPSContext$(oext) \ +NSEPSImageRep$(oext) \ +NSEvent$(oext) \ +NSFont$(oext) \ +NSFontManager$(oext) \ +NSFontPanel$(oext) \ +NSForm$(oext) \ +NSFormCell$(oext) \ +NSHelpPanel$(oext) \ +NSImage$(oext) \ +NSImageRep$(oext) \ +NSMatrix$(oext) \ +NSMenu$(oext) \ +NSMenuCell$(oext) \ +NSOpenPanel$(oext) \ +NSPageLayout$(oext) \ +NSPanel$(oext) \ +NSPasteboard$(oext) \ +NSPrinter$(oext) \ +NSPrintInfo$(oext) \ +NSPrintOperation$(oext) \ +NSPrintPanel$(oext) \ +NSPopUpButton$(oext) \ +NSResponder$(oext) \ +NSSavePanel$(oext) \ +NSScreen$(oext) \ +NSScroller$(oext) \ +NSScrollView$(oext) \ +NSSelection$(oext) \ +NSSlider$(oext) \ +NSSliderCell$(oext) \ +NSSpellChecker$(oext) \ +NSSpellServer$(oext) \ +NSSplitView$(oext) \ +NSText$(oext) \ +NSTextField$(oext) \ +NSTextFieldCell$(oext) \ +NSView$(oext) \ +NSWindow$(oext) \ +NSWorkspace$(oext) \ +Functions$(oext) \ +TrackingRectangle$(oext) \ +LogFile$(oext) + +OBJS = $(OBJS_WITHOUT_INIT) + +.SUFFIXES: .m +.m$(oext): + $(CC) $(CFLAGS) $< + +# +# libraries +# +LIBS = $(GCC_LIB) $(OBJC_LIB) $(SYS_LIBS) $(ADD_LIBS) + +# +# targets +# + +all: header_links src + +header_links: + -rm -f ../Headers/AppKit + $(LN_S) ../Headers/gnustep/gui ../Headers/AppKit + -rm -f ../Headers/DPSClient + $(LN_S) ../Headers/gnustep/dps ../Headers/DPSClient + +src: $(MAIN_FILE)$(libext) + +# library +$(MAIN_FILE)$(libext): $(OBJS) + $(LIB) $(LIBFLAGS) $(LIBOUT)$(MAIN_FILE)$(libext) $(OBJS) + $(RANLIB) $(MAIN_FILE)$(libext) + +# +# Initialization routine +# +$(INIT_FILE_OBJ): $(OBJS_WITHOUT_INIT) + nm $(OBJS_WITHOUT_INIT) | grep " __GLOBAL_" > tmpinit.c + collect tmpinit.c $(INIT_FILE) + $(CC) $(CFLAGS) $(INIT_FILE).c + rm tmpinit.c + +install: installdirs install-lib install-headers + +installdirs: + $(srcdir)/../mkinstalldirs \ + $(libdir) \ + $(includedir)/gnustep \ + $(includedir)/gnustep/dps \ + $(includedir)/gnustep/gui + if [ -d $(includedir)/AppKit ] ; then true ; else \ + $(LN_S) $(includedir)/gnustep/gui $(includedir)/AppKit ; fi + if [ -d $(includedir)/DPSClient ] ; then true ; else \ + $(LN_S) $(includedir)/gnustep/dps $(includedir)/DPSClient ; fi +# end of installdirs + +install-lib: $(MAIN_FILE)$(libext) + -rm -f $(libdir)/$(MAIN_FILE)$(libext) + mv $(MAIN_FILE)$(libext) $(libdir) + +install-headers: + for file in $(GNUSTEP1_HEADERS); do \ + $(INSTALL_DATA) ../Headers/gnustep/$$file \ + $(includedir)/gnustep/$$file ; \ + done + for file in $(GNUSTEP2_HEADERS); do \ + $(INSTALL_DATA) ../Headers/gnustep/$$file \ + $(includedir)/gnustep/$$file ; \ + done + for file in $(GNUSTEP3_HEADERS); do \ + $(INSTALL_DATA) ../Headers/gnustep/$$file \ + $(includedir)/gnustep/$$file ; \ + done + for file in $(GNUSTEP_DPS_HEADERS); do \ + $(INSTALL_DATA) ../Headers/gnustep/$$file \ + $(includedir)/gnustep/$$file ; \ + done + +# +# Cleaning +# +mostlyclean: +clean: + rm -f *~ + rm -f *$(oext) + rm -f $(MAIN_FILE)$(libext) +distclean: clean + rm -f Makefile +maintainer-clean: distclean + +FORCE: diff --git a/Source/Makefile.sed.nt b/Source/Makefile.sed.nt new file mode 100644 index 000000000..b7aaf83d7 --- /dev/null +++ b/Source/Makefile.sed.nt @@ -0,0 +1,27 @@ +s/@configure_input@/ Generated from Makefile.in by configure.bat/ +s/@srcdir@/./ +s/@CC@/gcc -fgnu-runtime -O -DDEBUGLOG/ +s/@CPPFLAGS@// +s/@lib_installdir@/\/MB\/Libraries/ +s/@h_installdir@/\/MB\/Headers/ +s/@gcc_lib@/libgcc.lib/ +s/@objc_lib@/libobjc.lib/ +s/@sys_libs@/libc.lib oldnames.lib user32.lib gdi32.lib wsock32.lib/ +s/@add_libs@/libobjects.lib/ +s/@exeext@/.exe/ +s/@oext@/.obj/ +s/@libext@/.lib/ +s/@resext@/.res/ +s/@rcext@/.rc/ +s/INIT_FILE =/INIT_FILE = init_$(MAIN_FILE)/ +s/@ldflags@/-align:0x1000 -entry:WinMainCRTStartup -stack:1000000,1000000/ +s/@ld@/ld -subsystem:windows/ +s/@ldout@/-out:/ +s/@lib@/lib/ +s/@libflags@// +s/@libout@/-out:/ +s/@ranlib@/touch/ +s/@rc@/rc \/l 0x409 \/i $(MB_INCLUDE)/ +s/OBJS = $(OBJS_WITHOUT_INIT)/OBJS = $(OBJS_WITHOUT_INIT) $(INIT_FILE_OBJ)/ + + diff --git a/Source/NSActionCell.m b/Source/NSActionCell.m new file mode 100644 index 000000000..a7f1b3a3f --- /dev/null +++ b/Source/NSActionCell.m @@ -0,0 +1,246 @@ +/* + NSActionCell.m + + Abstract cell for target/action paradigm + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include + +@implementation NSActionCell + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSActionCell class]) + { + NSLog(@"Initialize NSActionCell class\n"); + + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// +- init +{ + [super init]; + target = nil; + action = NULL; + tag = 0; + return self; +} + +- initImageCell:(NSImage *)anImage +{ + [super initImageCell:anImage]; + target = nil; + action = NULL; + tag = 0; + return self; +} + +- initTextCell:(NSString *)aString +{ + [super initTextCell:aString]; + target = nil; + action = NULL; + tag = 0; + return self; +} + +// +// Configuring an NSActionCell +// +- (void)setAlignment:(NSTextAlignment)mode +{ + [super setAlignment:mode]; + if (control_view) + if ([control_view isKindOfClass: [NSControl class]]) + [(NSControl *)control_view updateCell: self]; +} + +- (void)setBezeled:(BOOL)flag +{ + [super setBezeled:flag]; + if (control_view) + if ([control_view isKindOfClass: [NSControl class]]) + [(NSControl *)control_view updateCell: self]; +} + +- (void)setBordered:(BOOL)flag +{ + [super setBordered:flag]; + if (control_view) + if ([control_view isKindOfClass: [NSControl class]]) + [(NSControl *)control_view updateCell: self]; +} + +- (void)setEnabled:(BOOL)flag +{ + [super setEnabled:flag]; + if (control_view) + if ([control_view isKindOfClass: [NSControl class]]) + [(NSControl *)control_view updateCell: self]; +} + +- (void)setFloatingPointFormat:(BOOL)autoRange + left:(unsigned int)leftDigits + right:(unsigned int)rightDigits +{ + [super setFloatingPointFormat:autoRange left:leftDigits right:rightDigits]; + if (control_view) + if ([control_view isKindOfClass: [NSControl class]]) + [(NSControl *)control_view updateCell: self]; +} + +- (void)setFont:(NSFont *)fontObject +{ + [super setFont:fontObject]; + if (control_view) + if ([control_view isKindOfClass: [NSControl class]]) + [(NSControl *)control_view updateCell: self]; +} + +- (void)setImage:(NSImage *)image +{ + [super setImage:image]; + if (control_view) + if ([control_view isKindOfClass: [NSControl class]]) + [(NSControl *)control_view updateCell: self]; +} + +// +// Manipulating NSActionCell Values +// +- (double)doubleValue +{ + return [super doubleValue]; +} + +- (float)floatValue +{ + return [super floatValue]; +} + +- (int)intValue +{ + return [super intValue]; +} + +- (void)setStringValue:(NSString *)aString +{ + [super setStringValue:aString]; + if (control_view) + if ([control_view isKindOfClass: [NSControl class]]) + [(NSControl *)control_view updateCell: self]; +} + +- (NSString *)stringValue +{ + return [super stringValue]; +} + +// +// Displaying +// +- (void)drawWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView +{ + [super drawWithFrame:cellFrame inView:controlView]; +} + +- (NSView *)controlView +{ + return [super controlView]; +} + +// +// Target and Action +// +- (SEL)action +{ + return action; +} + +- (void)setAction:(SEL)aSelector +{ + action = aSelector; +} + +- (void)setTarget:(id)anObject +{ + target = anObject; +} + +- (id)target +{ + return target; +} + +// +// Assigning a Tag +// +- (void)setTag:(int)anInt +{ + tag = anInt; +} + +- (int)tag +{ + return tag; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeValueOfObjCType: "i" at: &tag]; + [aCoder encodeObjectReference: target withName: @"Target"]; + [aCoder encodeValueOfObjCType: @encode(SEL) at: &action]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + [aDecoder decodeValueOfObjCType: "i" at: &tag]; + [aDecoder decodeObjectAt: &target withName: NULL]; + [aDecoder decodeValueOfObjCType: @encode(SEL) at: &action]; + + return self; +} + +@end diff --git a/Source/NSApplication.m b/Source/NSApplication.m new file mode 100644 index 000000000..d94ab80cd --- /dev/null +++ b/Source/NSApplication.m @@ -0,0 +1,1014 @@ +/* + NSApplication.m + + The one and only application class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include + +// +// Class variables +// +// The global application instance +extern id NSApp; +NSEvent *NullEvent; + +// Global strings +NSString *NSModalPanelRunLoopMode = @"ModalPanelMode"; +NSString *NSEventTrackingRunLoopMode = @"EventTrackingMode"; + +// +// Global Exception Strings +// +NSString *NSAbortModalException = @"AbortModalException"; +NSString *NSAbortPrintingException = @"AbortPrintingException"; +NSString *NSAppKitIgnoredException; +NSString *NSAppKitVirtualMemoryException; +NSString *NSBadBitmapParametersException; +NSString *NSBadComparisonException; +NSString *NSBadRTFColorTableException; +NSString *NSBadRTFDirectiveException; +NSString *NSBadRTFFontTableException; +NSString *NSBadRTFStyleSheetException; +NSString *NSBrowserIllegalDelegateException; +NSString *NSColorListIOException; +NSString *NSColorListNotEditableException; +NSString *NSDraggingException; +NSString *NSFontUnavailableException; +NSString *NSIllegalSelectorException; +NSString *NSImageCacheException; +NSString *NSNibLoadingException; +NSString *NSPPDIncludeNotFoundException; +NSString *NSPPDIncludeStackOverflowException; +NSString *NSPPDIncludeStackUnderflowException; +NSString *NSPPDParseException; +NSString *NSPasteboardCommunicationException; +NSString *NSPrintOperationExistsException; +NSString *NSPrintPackageException; +NSString *NSPrintingCommunicationException; +NSString *NSRTFPropertyStackOverflowException; +NSString *NSTIFFException; +NSString *NSTextLineTooLongException; +NSString *NSTextNoSelectionException; +NSString *NSTextReadException; +NSString *NSTextWriteException; +NSString *NSTypedStreamVersionException; +NSString *NSWindowServerCommunicationException; +NSString *NSWordTablesReadException; +NSString *NSWordTablesWriteException; + +// Application notifications +NSString *NSApplicationDidBecomeActiveNotification; +NSString *NSApplicationDidFinishLaunchingNotification; +NSString *NSApplicationDidHideNotification; +NSString *NSApplicationDidResignActiveNotification; +NSString *NSApplicationDidUnhideNotification; +NSString *NSApplicationDidUpdateNotification; +NSString *NSApplicationWillBecomeActiveNotification; +NSString *NSApplicationWillFinishLaunchingNotification; +NSString *NSApplicationWillHideNotification; +NSString *NSApplicationWillResignActiveNotification; +NSString *NSApplicationWillUnhideNotification; +NSString *NSApplicationWillUpdateNotification; + +@implementation NSApplication + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSApplication class]) + { + NSLog(@"Initialize NSApplication class\n"); + + // Initial version + [self setVersion:1]; + } +} + ++ (NSApplication *)sharedApplication +{ + // If the global application does not exist yet then create it + if (!NSApp) + NSApp = [[self alloc] init]; + return NSApp; +} + +// +// Instance methods +// + +// +// Creating and initializing the NSApplication +// +- init +{ + [super init]; + + NSLog(@"Begin of NSApplication -init\n"); + + // allocate the window list + window_list = [NSMutableArray array]; + window_count = 1; + + // + // Event handling setup + // + // allocate the event queue + event_queue = [[Queue alloc] init]; + // No current event + current_event = nil; + // The NULL event + NullEvent = [[NSEvent alloc] init]; + + // + // We are the end of the responder chain + // + [self setNextResponder:NULL]; + + // Finish the Launching + [self finishLaunching]; + + return self; +} + +- (void)finishLaunching +{ + // notify that we will finish the launching + [self applicationWillFinishLaunching:self]; + + // finish the launching + + // notify that the launching has finished + [self applicationDidFinishLaunching:self]; +} + +- (void)dealloc +{ + int i, j; + + //NSLog(@"Freeing NSApplication\n"); + + // Release the window list + // We retain all of the objects in our list + // so we need to release them + + //NSArray doesn't know -removeAllObjects yet + //[window_list removeAllObjects]; + j = [window_list count]; + for (i = 0;i < j; ++i) + [[window_list objectAtIndex:i] release]; + + // no need -array is autoreleased + //[window_list release]; + + [event_queue release]; + [current_event release]; + [super dealloc]; +} + +// +// Changing the active application +// +- (void)activateIgnoringOtherApps:(BOOL)flag +{ + app_is_active = YES; +} + +- (void)deactivate +{ + app_is_active = NO; +} + +- (BOOL)isActive +{ + return app_is_active; +} + +// +// Running the event loop +// +- (void)abortModal +{ +} + +- (NSModalSession)beginModalSessionForWindow:(NSWindow *)theWindow +{ + return NULL; +} + +- (void)endModalSession:(NSModalSession)theSession +{ +} + +- (BOOL)isRunning +{ + return app_is_running; +} + +- (void)run +{ + NSEvent *e; + + NSLog(@"NSApplication -run\n"); + + [self finishLaunching]; + + app_should_quit = NO; + app_is_running = YES; + + do + { + e = [self nextEventMatchingMask:NSAnyEventMask untilDate:nil + inMode:nil dequeue:YES]; + if (e) + [self postEvent:e atStart:YES]; + else + { + // Null event + // Call the back-end method to handle it + [self handleNullEvent]; + } + } while (!app_should_quit); + app_is_running = YES; + + NSLog(@"NSApplication end of run loop\n"); +} + +- (int)runModalForWindow:(NSWindow *)theWindow +{ + return 0; +} + +- (int)runModalSession:(NSModalSession)theSession +{ + return 0; +} + +- (void)sendEvent:(NSEvent *)theEvent +{ + // Don't send the null event + if (theEvent == NullEvent) + { + NSLog(@"Not sending the Null Event\n"); + return; + } + + // What is the event type + switch ([theEvent type]) + { + + // + // NSApplication traps the periodic events + // + case NSPeriodic: + break; + + case NSKeyDown: + { + NSLog(@"send key down event\n"); + [[theEvent window] sendEvent:theEvent]; + break; + } + case NSKeyUp: + { + NSDebugLog(@"send key up event\n"); + [[theEvent window] sendEvent:theEvent]; + break; + } + // + // All others get passed to the window + // + default: + { + if (!theEvent) NSLog(@"NSEvent is nil!\n"); + NSLog(@"NSEvent type: %d\n", [theEvent type]); + NSLog(@"send event to window\n"); + NSLog([[theEvent window] description]); + NSLog(@"\n"); + if (![theEvent window]) + NSLog(@"no window\n"); + [[theEvent window] sendEvent:theEvent]; + } + } +} + +- (void)stop:sender +{ + app_is_running = NO; +} + +- (void)stopModal +{ +} + +- (void)stopModalWithCode:(int)returnCode +{ +} + +// +// Getting, removing, and posting events +// +- (BOOL)event:(NSEvent *)theEvent matchMask:(unsigned int)mask +{ + NSEventType t; + + // If mask is for any event then return success + if (mask == NSAnyEventMask) + return YES; + + if (!theEvent) return NO; + + t = [theEvent type]; + + if ((t == NSLeftMouseDown) && (mask & NSLeftMouseDownMask)) + return YES; + + if ((t == NSLeftMouseUp) && (mask & NSLeftMouseUpMask)) + return YES; + + if ((t == NSRightMouseDown) && (mask & NSRightMouseDownMask)) + return YES; + + if ((t == NSRightMouseUp) && (mask & NSRightMouseUpMask)) + return YES; + + if ((t == NSMouseMoved) && (mask & NSMouseMovedMask)) + return YES; + + if ((t == NSMouseEntered) && (mask & NSMouseEnteredMask)) + return YES; + + if ((t == NSMouseExited) && (mask & NSMouseExitedMask)) + return YES; + + if ((t == NSLeftMouseDragged) && (mask & NSLeftMouseDraggedMask)) + return YES; + + if ((t == NSRightMouseDragged) && (mask & NSRightMouseDraggedMask)) + return YES; + + if ((t == NSKeyDown) && (mask & NSKeyDownMask)) + return YES; + + if ((t == NSKeyUp) && (mask & NSKeyUpMask)) + return YES; + + if ((t == NSFlagsChanged) && (mask & NSFlagsChangedMask)) + return YES; + + if ((t == NSPeriodic) && (mask & NSPeriodicMask)) + return YES; + + if ((t == NSCursorUpdate) && (mask & NSCursorUpdateMask)) + return YES; + + return NO; +} + +- (void)setCurrentEvent:(NSEvent *)theEvent; +{ + [theEvent retain]; + [current_event release]; + current_event = theEvent; +} + +- (NSEvent *)currentEvent; +{ + return current_event; +} + +- (void)discardEventsMatchingMask:(unsigned int)mask + beforeEvent:(NSEvent *)lastEvent +{ +} + +- (NSEvent *)nextEventMatchingMask:(unsigned int)mask + untilDate:(NSDate *)expiration + inMode:(NSString *)mode + dequeue:(BOOL)flag +{ + NSEvent *e; + BOOL done; + int i, j; + + // If the queue isn't empty then check those messages + if (![event_queue isEmpty]) + { + j = [event_queue count]; + for (i = j-1;i > 0; --i) + { + e = [event_queue objectAtIndex: i]; + if ([self event: e matchMask: mask]) + { + [event_queue removeObjectAtIndex: i]; + [self setCurrentEvent: e]; + return e; + } + } + } + + // Not in queue so wait for next event + done = NO; + while (!done) + { + e = [self getNextEvent]; + + // Check mask + if ([self event: e matchMask: mask]) + { + if (e) + e = [event_queue dequeueObject]; + done = YES; + } + } + + [self setCurrentEvent: e]; + return e; +} + +- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag +{ + [self sendEvent:event]; +} + +// +// Sending action messages +// +- (BOOL)sendAction:(SEL)aSelector + to:aTarget + from:sender +{ + // + // If the target responds to the selector + // then have it perform it + // + if ([aTarget respondsToSelector:aSelector]) + { + [aTarget perform:aSelector withObject:sender]; + return YES; + } + + // + // Otherwise traverse the responder chain + // + + return NO; +} + +- targetForAction:(SEL)aSelector +{ + return self; +} + +- (BOOL)tryToPerform:(SEL)aSelector + with:anObject +{ + return NO; +} + +// Setting the application's icon +- (void)setApplicationIconImage:(NSImage *)anImage +{ + if (app_icon != nil) + { + [app_icon release]; + } + + app_icon = [anImage retain]; +} + +- (NSImage *)applicationIconImage +{ + return app_icon; +} + +// +// Hiding all windows +// +- (void)hide:sender +{ + int i, j; + NSWindow *w; + + j = [window_list count]; + for (i = 0;i < j; ++i) + { + w = [window_list objectAtIndex:i]; + // Do something to hide the window + } + app_is_hidden = YES; +} + +- (BOOL)isHidden +{ + return app_is_hidden; +} + +- (void)unhide:sender +{ + int i, j; + NSWindow *w; + + app_is_hidden = NO; + j = [window_list count]; + for (i = 0;i < j; ++i) + { + w = [window_list objectAtIndex:i]; + // Do something to unhide the window + } + + [[self keyWindow] makeKeyAndOrderFront:self]; +} + +- (void)unhideWithoutActivation +{ + [self unhide: self]; +} + +// +// Managing windows +// +- (NSWindow *)keyWindow +{ + int i, j; + id w; + + j = [window_list count]; + for (i = 0;i < j; ++i) + { + w = [window_list objectAtIndex:i]; + if ([w isKeyWindow]) return w; + } + return nil; +} + +- (NSWindow *)mainWindow +{ + int i, j; + id w; + + j = [window_list count]; + for (i = 0;i < j; ++i) + { + w = [window_list objectAtIndex:i]; + if ([w isMainWindow]) return w; + } + return nil; +} + +- (NSWindow *)makeWindowsPerform:(SEL)aSelector + inOrder:(BOOL)flag +{ + return nil; +} + +- (void)miniaturizeAll:sender +{ + id e, obj; + + e = [window_list objectEnumerator]; + obj = [e nextObject]; + while (obj) + { + [obj miniaturize: sender]; + obj = [e nextObject]; + } +} + +- (void)preventWindowOrdering +{ +} + +- (void)setWindowsNeedUpdate:(BOOL)flag +{ +} + +- (void)updateWindows +{ + id e, obj; + + e = [window_list objectEnumerator]; + obj = [e nextObject]; + while (obj) + { + [obj update]; + obj = [e nextObject]; + } +} + +- (NSArray *)windows +{ + return window_list; +} + +- (NSWindow *)windowWithWindowNumber:(int)windowNum +{ + int i, j; + NSWindow *w; + + j = [window_list count]; + for (i = 0;i < j; ++i) + { + w = [window_list objectAtIndex:i]; + if ([w windowNumber] == windowNum) return w; + } + return nil; +} + +// +// Showing Standard Panels +// +- (void)orderFrontColorPanel:sender +{ +} + +- (void)orderFrontDataLinkPanel:sender +{ +} + +- (void)orderFrontHelpPanel:sender +{ +} + +- (void)runPageLayout:sender +{ +} + +// +// Getting the main menu +// +- (NSMenu *)mainMenu +{ + return main_menu; +} + +- (void)setMainMenu:(NSMenu *)aMenu +{ + int i, j; + NSMenuCell *mc; + NSArray *mi; + id w; + + // Release old and retain new + [main_menu release]; + main_menu = aMenu; + [main_menu retain]; + + // Search for a menucell with the name Windows + // This is the default windows menu + mi = [main_menu itemArray]; + j = [mi count]; + windows_menu = nil; + for (i = 0;i < j; ++i) + { + mc = [mi objectAtIndex:i]; + if ([[mc stringValue] compare:@"Windows"] == NSOrderedSame) + { + // Found it! + windows_menu = mc; + break; + } + } +} + +// +// Managing the Windows menu +// +- (void)addWindowsItem:aWindow + title:(NSString *)aString + filename:(BOOL)isFilename +{ + int i; + + // Not a subclass of window --forget it + if (![aWindow isKindOfClass:[NSWindow class]]) + return; + + // Retain the window + //[aWindow retain]; + + // Add to our window list + i = [window_list count]; + [window_list addObject:aWindow]; + + // set its window number + [aWindow setWindowNumber:window_count]; + ++window_count; + + // If this was the first window then + // make it the main and key window + if (i == 0) + { + [aWindow becomeMainWindow]; + [aWindow becomeKeyWindow]; + } +} + +- (void)arrangeInFront:sender +{ +} + +- (void)changeWindowsItem:aWindow + title:(NSString *)aString + filename:(BOOL)isFilename +{ +} + +- (void)removeWindowsItem:aWindow +{ + int i, j; + id w; + + // This should be different + if (aWindow == key_window) + key_window = nil; + if (aWindow == main_window) + main_window = nil; + + // Simple -find it and remove it + j = [window_list count]; + for (i = 0;i < j; ++i) + { + w = [window_list objectAtIndex:i]; + if (w == aWindow) + { + // Remove from out list + [window_list removeObjectAtIndex:i]; + // Release it because we retained it before + //[w release]; + return; + } + } + return; +} + +- (void)setWindowsMenu:aMenu +{ + if (windows_menu) + [windows_menu setSubmenu:aMenu]; +} + +- (void)updateWindowsItem:aWindow +{ +} + +- (NSMenu *)windowsMenu +{ + return [windows_menu submenu]; +} + +// +// Managing the Service menu +// +- (void)registerServicesMenuSendTypes:(NSArray *)sendTypes + returnTypes:(NSArray *)returnTypes +{ +} + +- (NSMenu *)servicesMenu +{ + return nil; +} + +- (void)setServicesMenu:(NSMenu *)aMenu +{ +} + +- validRequestorForSendType:(NSString *)sendType + returnType:(NSString *)returnType +{ + return nil; +} + +// Getting the display postscript context +// - (NSDOSContext *)context; + +// Reporting an exception +//- (void)reportException:(NSException *)anException + +// +// Terminating the application +// +- (void)terminate:sender +{ + if ([self applicationShouldTerminate:sender]) + app_should_quit = YES; +} + +// Assigning a delegate +- delegate +{ + return delegate; +} + +- (void)setDelegate:anObject +{ + delegate = anObject; +} + +// +// Implemented by the delegate +// +- (BOOL)application:sender openFileWithoutUI:(NSString *)filename +{ + BOOL result = NO; + + if ([delegate respondsTo:@selector(application:openFileWithoutUI:)]) + result = [delegate application:sender openFileWithoutUI:filename]; + + return result; +} + +- (BOOL)application:(NSApplication *)app openFile:(NSString *)filename +{ + BOOL result = NO; + + if ([delegate respondsTo:@selector(application:openFile:)]) + result = [delegate application:app openFile:filename]; + + return result; +} + +- (BOOL)application:(NSApplication *)app openTempFile:(NSString *)filename +{ + BOOL result = NO; + + if ([delegate respondsTo:@selector(application:openTempFile:)]) + result = [delegate application:app openTempFile:filename]; + + return result; +} + +- (void)applicationDidBecomeActive:sender +{ + if ([delegate respondsTo:@selector(applicationDidBecomeActive:)]) + [delegate applicationDidBecomeActive:sender]; +} + +- (void)applicationDidFinishLaunching:sender +{ + if ([delegate respondsTo:@selector(applicationDidFinishLaunching:)]) + [delegate applicationDidFinishLaunching:sender]; +} + +- (void)applicationDidHide:sender +{ + if ([delegate respondsTo:@selector(applicationDidHide:)]) + [delegate applicationDidHide:sender]; +} + +- (void)applicationDidResignActive:sender +{ + if ([delegate respondsTo:@selector(applicationDidResignActive:)]) + [delegate applicationDidResignActive:sender]; +} + +- (void)applicationDidUnhide:sender +{ + if ([delegate respondsTo:@selector(applicationDidUnhide:)]) + [delegate applicationDidUnhide:sender]; +} + +- (void)applicationDidUpdate:sender +{ + if ([delegate respondsTo:@selector(applicationDidUpdate:)]) + [delegate applicationDidUpdate:sender]; +} + +- (BOOL)applicationOpenUntitledFile:(NSApplication *)app +{ + BOOL result = NO; + + if ([delegate respondsTo:@selector(applicationOpenUntitledFile:)]) + result = [delegate applicationOpenUntitledFile:app]; + + return result; +} + +- (BOOL)applicationShouldTerminate:sender +{ + BOOL result = YES; + + if ([delegate respondsTo:@selector(applicationShouldTerminate:)]) + result = [delegate applicationShouldTerminate:sender]; + + return result; +} + +- (void)applicationWillBecomeActive:sender +{ + if ([delegate respondsTo:@selector(applicationWillBecomeActive:)]) + [delegate applicationWillBecomeActive:sender]; +} + +- (void)applicationWillFinishLaunching:sender +{ + if ([delegate respondsTo:@selector(applicationWillFinishLaunching:)]) + [delegate applicationWillFinishLaunching:sender]; +} + +- (void)applicationWillHide:sender +{ + if ([delegate respondsTo:@selector(applicationWillHide:)]) + [delegate applicationWillHide:sender]; +} + +- (void)applicationWillResignActive:sender +{ + if ([delegate respondsTo:@selector(applicationWillResignActive:)]) + [delegate applicationWillResignActive:sender]; +} + +- (void)applicationWillUnhide:sender +{ + if ([delegate respondsTo:@selector(applicationWillUnhide:)]) + [delegate applicationWillUnhide:sender]; +} + +- (void)applicationWillUpdate:sender +{ + if ([delegate respondsTo:@selector(applicationWillUpdate:)]) + [delegate applicationWillUpdate:sender]; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: window_list]; + // We don't want to code the event queue do we? + //[aCoder encodeObject: event_queue]; + //[aCoder encodeObject: current_event]; + [aCoder encodeObjectReference: key_window withName: @"Key window"]; + [aCoder encodeObjectReference: main_window withName: @"Main window"]; + [aCoder encodeObjectReference: delegate withName: @"Delegate"]; + [aCoder encodeObject: main_menu]; + [aCoder encodeObjectReference: windows_menu withName: @"Windows menu"]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + window_list = [aDecoder decodeObject]; + [aDecoder decodeObjectAt: &key_window withName: NULL]; + [aDecoder decodeObjectAt: &main_window withName: NULL]; + [aDecoder decodeObjectAt: &delegate withName: NULL]; + main_menu = [aDecoder decodeObject]; + [aDecoder decodeObjectAt: &windows_menu withName: NULL]; + + return self; +} + +@end + +// +// Backend methods +// empty implementations +// +@implementation NSApplication (GNUstepBackend) + +// Get next event +- (NSEvent *)getNextEvent +{ + [event_queue enqueueObject: NullEvent]; + return NullEvent; +} + +// handle a non-translated event +- (void)handleNullEvent +{} + +@end diff --git a/Source/NSBitmapImageRep.m b/Source/NSBitmapImageRep.m new file mode 100644 index 000000000..70a049158 --- /dev/null +++ b/Source/NSBitmapImageRep.m @@ -0,0 +1,206 @@ +/* + NSBitmapImageRep.m + + Bitmap image representations + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSBitmapImageRep + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSBitmapImageRep class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Allocating and Initializing a New NSBitmapImageRep Object +// ++ (id)imageRepWithData:(NSData *)tiffData +{ + return nil; +} + ++ (NSArray *)imageRepsWithData:(NSData *)tiffData +{ + return nil; +} + +// +// Producing a TIFF Representation of the Image +// ++ (NSData *)TIFFRepresentationOfImageRepsInArray:(NSArray *)anArray +{ + return nil; +} + ++ (NSData *)TIFFRepresentationOfImageRepsInArray:(NSArray *)anArray + usingCompression:(NSTIFFCompression)compressionType +factor:(float)factor +{ + return nil; +} + +// +// Setting and Checking Compression Types +// ++ (void)getTIFFCompressionTypes:(const NSTIFFCompression **)list + count:(int *)numTypes +{} + ++ (NSString *)localizedNameForTIFFCompressionType:(NSTIFFCompression)compression +{ + return nil; +} + +// +// Instance methods +// +// +// Allocating and Initializing a New NSBitmapImageRep Object +// +- (id)initWithData:(NSData *)tiffData +{ + return nil; +} + +- (id)initWithFocusedViewRect:(NSRect)rect +{ + return nil; +} + +- (id)initWithBitmapDataPlanes:(unsigned char **)planes + pixelsWide:(int)width +pixelsHigh:(int)height + bitsPerSample:(int)bps +samplesPerPixel:(int)spp + hasAlpha:(BOOL)alpha +isPlanar:(BOOL)config + colorSpaceName:(NSString *)colorSpaceName +bytesPerRow:(int)rowBytes + bitsPerPixel:(int)pixelBits +{ + return nil; +} + +// +// Getting Information about the Image +// +- (int)bitsPerPixel +{ + return 0; +} + +- (int)samplesPerPixel +{ + return 0; +} + +- (BOOL)isPlanar +{ + return NO; +} + +- (int)numberOfPlanes +{ + return 0; +} + +- (int)bytesPerPlane +{ + return 0; +} + +- (int)bytesPerRow +{ + return 0; +} + +// +// Getting Image Data +// +- (unsigned char *)bitmapData +{ + return NULL; +} + +- (void)getBitmapDataPlanes:(unsigned char **)data +{} + +// +// Producing a TIFF Representation of the Image +// +- (NSData *)TIFFRepresentation +{ + return nil; +} + +- (NSData *)TIFFRepresentationUsingCompression:(NSTIFFCompression)compressionType + factor:(float)factor +{ + return nil; +} + +// +// Setting and Checking Compression Types +// +- (BOOL)canBeCompressedUsing:(NSTIFFCompression)compression +{ + return NO; +} + +- (void)getCompression:(NSTIFFCompression *)compression + factor:(float *)factor +{} + +- (void)setCompression:(NSTIFFCompression)compression + factor:(float)factor +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSBox.m b/Source/NSBox.m new file mode 100644 index 000000000..8b22fd4a1 --- /dev/null +++ b/Source/NSBox.m @@ -0,0 +1,244 @@ +/* + NSBox.m + + Simple box view that can display a border and title + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +@implementation NSBox + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSBox class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// +- initWithFrame:(NSRect)frameRect +{ + [super initWithFrame:frameRect]; + + cell = [[NSTextFieldCell alloc] initTextCell:@"Title"]; + offsets.width = 5; + offsets.height = 5; + border_rect = bounds; + border_type = NSLineBorder; + title_position = NSAtTop; + title_rect = NSZeroRect; + [self setContentView: [[NSView alloc] init]]; + + return self; +} + +- (void)dealloc +{ + if (cell) [cell release]; + if (content_view) [content_view release]; + [super dealloc]; +} + +// +// Getting and Modifying the Border and Title +// +- (NSRect)borderRect +{ + return border_rect; +} + +- (NSBorderType)borderType +{ + return border_type; +} + +- (void)setBorderType:(NSBorderType)aType +{ + border_type = aType; +} + +- (void)setTitle:(NSString *)aString +{ + [cell setStringValue:aString]; +} + +- (void)setTitleFont:(NSFont *)fontObj +{ + [cell setFont:fontObj]; +} + +- (void)setTitlePosition:(NSTitlePosition)aPosition +{ + title_position = aPosition; +} + +- (NSString *)title +{ + return [cell stringValue]; +} + +- (id)titleCell +{ + return cell; +} + +- (NSFont *)titleFont +{ + return [cell font]; +} + +- (NSTitlePosition)titlePosition +{ + return title_position; +} + +- (NSRect)titleRect +{ + return title_rect; +} + +// +// Setting and Placing the Content View +// +- (id)contentView +{ + return content_view; +} + +- (NSSize)contentViewMargins +{ + return offsets; +} + +- (void)setContentView:(NSView *)aView +{ + NSRect r; + + if (content_view) + { + // Tell view that it is no longer in a window + [content_view viewWillMoveToWindow:nil]; + [content_view release]; + } + content_view = aView; + [content_view retain]; + + // We only have one view in our subview array + [sub_views release]; + sub_views = [NSMutableArray array]; + if ([sub_views count] == 0) + { + [sub_views addObject:aView]; + } + + [content_view setSuperview:self]; + [content_view setNextResponder:self]; + [content_view viewWillMoveToWindow:window]; + r.origin.x = bounds.origin.x + offsets.width; + r.origin.y = bounds.origin.y + offsets.height; + r.size.width = bounds.size.width - (2 * offsets.width); + r.size.height = bounds.size.height - (2 * offsets.height); + [content_view setFrame:r]; +} + +- (void)setContentViewMargins:(NSSize)offsetSize +{ + offsets = offsetSize; +} + +// +// Resizing the Box +// +- (void)setFrameFromContentFrame:(NSRect)contentFrame +{ +} + +- (void)sizeToFit +{} + +// +// Managing the NSView Hierarchy +// +- (void)addSubview:(NSView *)aView +{ + // Subviews get added to our content view's list + [content_view addSubview:aView]; +} + +// +// Displaying +// +- (void)drawRect:(NSRect)rect +{ + NSColor *c = [NSColor redColor]; + + PSsetcolor(c); + PSrectstroke(border_rect.origin.x, border_rect.origin.y, + border_rect.size.width, border_rect.size.height); +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: cell]; + [aCoder encodeObject: content_view]; + [aCoder encodeSize: offsets]; + [aCoder encodeRect: border_rect]; + [aCoder encodeRect: title_rect]; + [aCoder encodeValueOfObjCType: @encode(NSBorderType) at: &border_type]; + [aCoder encodeValueOfObjCType: @encode(NSTitlePosition) at: &title_position]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + cell = [aDecoder decodeObject]; + content_view = [aDecoder decodeObject]; + offsets = [aDecoder decodeSize]; + border_rect = [aDecoder decodeRect]; + title_rect = [aDecoder decodeRect]; + [aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &border_type]; + [aDecoder decodeValueOfObjCType: @encode(NSTitlePosition) + at: &title_position]; + + return self; +} + +@end diff --git a/Source/NSBrowser.m b/Source/NSBrowser.m new file mode 100644 index 000000000..fda69f165 --- /dev/null +++ b/Source/NSBrowser.m @@ -0,0 +1,469 @@ +/* + NSBrowser.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSBrowser + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSBrowser class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Setting Component Classes +// ++ (Class)cellClass +{ + return NULL; +} + +// +// Instance methods +// + +// +// Setting the Delegate +// +- (id)delegate +{ + return nil; +} + +- (void)setDelegate:(id)anObject +{} + +// +// Target and Action +// +- (SEL)doubleAction +{ + return NULL; +} + +- (BOOL)sendAction +{ + return NO; +} + +- (void)setDoubleAction:(SEL)aSelector +{} + +// +// Setting Component Classes +// +- (id)cellPrototype +{ + return nil; +} + +- (Class)matrixClass +{ + return NULL; +} + +- (void)setCellClass:(Class)classId +{} + +- (void)setCellPrototype:(NSCell *)aCell +{} + +- (void)setMatrixClass:(Class)classId +{} + +// +// Setting NSBrowser Behavior +// +- (BOOL)reusesColumns +{ + return NO; +} + +- (void)setReusesColumns:(BOOL)flag +{} + +- (void)setTakesTitleFromPreviousColumn:(BOOL)flag +{} + +- (BOOL)takesTitleFromPreviousColumn +{ + return NO; +} + +// +// Allowing Different Types of Selection +// +- (BOOL)allowsBranchSelection +{ + return NO; +} + +- (BOOL)allowsEmptySelection +{ + return NO; +} + +- (BOOL)allowsMultipleSelection +{ + return NO; +} + +- (void)setAllowsBranchSelection:(BOOL)flag +{} + +- (void)setAllowsEmptySelection:(BOOL)flag +{} + +- (void)setAllowsMultipleSelection:(BOOL)flag +{} + +// +// Setting Arrow Key Behavior +// +- (BOOL)acceptsArrowKeys +{ + return NO; +} + +- (BOOL)sendsActionOnArrowKeys +{ + return NO; +} + +- (void)setAcceptsArrowKeys:(BOOL)flag +{} + +- (void)setSendsActionOnArrowKeys:(BOOL)flag +{} + +// +// Showing a Horizontal Scroller +// +- (void)setHasHorizontalScroller:(BOOL)flag +{} + +- (BOOL)hasHorizontalScroller +{ + return NO; +} + +// +// Setting the NSBrowser's Appearance +// +- (int)maxVisibleColumns +{ + return 0; +} + +- (int)minColumnWidth +{ + return 0; +} + +- (BOOL)separatesColumns +{ + return NO; +} + +- (void)setMaxVisibleColumns:(int)columnCount +{} + +- (void)setMinColumnWidth:(int)columnWidth +{} + +- (void)setSeparatesColumns:(BOOL)flag +{} + +// +// Manipulating Columns +// +- (void)addColumn +{} + +- (int)columnOfMatrix:(NSMatrix *)matrix +{ + return 0; +} + +- (void)displayAllColumns +{} + +- (void)displayColumn:(int)column +{} + +- (int)firstVisibleColumn +{ + return 0; +} + +- (BOOL)isLoaded +{ + return NO; +} + +- (int)lastColumn +{ + return 0; +} + +- (int)lastVisibleColumn +{ + return 0; +} + +- (void)loadColumnZero +{} + +- (int)numberOfVisibleColumns +{ + return 0; +} + +- (void)reloadColumn:(int)column +{} + +- (void)selectAll:(id)sender +{} + +- (int)selectedColumn +{ + return 0; +} + +- (void)setLastColumn:(int)column +{} + +- (void)validateVisibleColumns +{} + +// +// Manipulating Column Titles +// +- (void)drawTitle:(NSString *)title + inRect:(NSRect)aRect +ofColumn:(int)column +{} + +- (BOOL)isTitled +{ + return NO; +} + +- (void)setTitled:(BOOL)flag +{} + +- (void)setTitle:(NSString *)aString + ofColumn:(int)column +{} + +- (NSRect)titleFrameOfColumn:(int)column +{ + return NSZeroRect; +} + +- (float)titleHeight +{ + return 0; +} + +- (NSString *)titleOfColumn:(int)column +{ + return nil; +} + +// +// Scrolling an NSBrowser +// +- (void)scrollColumnsLeftBy:(int)shiftAmount +{} + +- (void)scrollColumnsRightBy:(int)shiftAmount +{} + +- (void)scrollColumnToVisible:(int)column +{} + +- (void)scrollViaScroller:(NSScroller *)sender +{} + +- (void)updateScroller +{} + +// +// Event Handling +// +- (void)doClick:(id)sender +{} + +- (void)doDoubleClick:(id)sender +{} + +// +// Getting Matrices and Cells +// +- (id)loadedCellAtRow:(int)row + column:(int)column +{ + return nil; +} + +- (NSMatrix *)matrixInColumn:(int)column +{ + return nil; +} + +- (id)selectedCell +{ + return nil; +} + +- (id)selectedCellInColumn:(int)column +{ + return nil; +} + +- (NSArray *)selectedCells +{ + return nil; +} + +// +// Getting Column Frames +// +- (NSRect)frameOfColumn:(int)column +{ + return NSZeroRect; +} + +- (NSRect)frameOfInsideOfColumn:(int)column +{ + return NSZeroRect; +} + +// +// Manipulating Paths +// +- (NSString *)path +{ + return nil; +} + +- (NSString *)pathSeparator +{ + return nil; +} + +- (NSString *)pathToColumn:(int)column +{ + return nil; +} + +- (BOOL)setPath:(NSString *)path +{ + return NO; +} + +- (void)setPathSeparator:(NSString *)aString +{} + +// +// Arranging an NSBrowser's Components +// +- (void)tile +{} + +// +// Methods Implemented by the Delegate +// +- (void)browser:(NSBrowser *)sender +createRowsForColumn:(int)column +inMatrix:(NSMatrix *)matrix +{} + +- (BOOL)browser:(NSBrowser *)sender + isColumnValid:(int)column +{ + return NO; +} + +- (int)browser:(NSBrowser *)sender +numberOfRowsInColumn:(int)column +{ + return 0; +} + +- (BOOL)browser:(NSBrowser *)sender + selectCell:(NSString *)title +inColumn:(int)column +{ + return NO; +} + +- (NSString *)browser:(NSBrowser *)sender + titleOfColumn:(int)column +{ + return nil; +} + +- (void)browser:(NSBrowser *)sender +willDisplayCell:(id)cell +atRow:(int)row +column:(int)column +{} + +- (void)browserDidScroll:(NSBrowser *)sender +{} + +- (void)browserWillScroll:(NSBrowser *)sender +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSBrowserCell.m b/Source/NSBrowserCell.m new file mode 100644 index 000000000..0130c53e6 --- /dev/null +++ b/Source/NSBrowserCell.m @@ -0,0 +1,121 @@ +/* + NSBrowserCell.m + + Cell class for the NSBrowser + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSBrowserCell + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSBrowserCell class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Accessing Graphic Attributes +// ++ (NSImage *)branchImage +{ + return nil; +} + ++ (NSImage *)highlightedBranchImage +{ + return nil; +} + +// +// Instance methods +// + +// +// Accessing Graphic Attributes +// +- (NSImage *)alternateImage +{ + return nil; +} + +- (void)setAlternateImage:(NSImage *)anImage +{} + +// +// Placing in the Browser Hierarchy +// +- (BOOL)isLeaf +{ + return NO; +} + +- (void)setLeaf:(BOOL)flag +{} + +// +// Determining Loaded Status +// +- (BOOL)isLoaded +{ + return NO; +} + +- (void)setLoaded:(BOOL)flag +{} + +// +// Setting State +// +- (void)reset +{} + +- (void)set +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSButton.m b/Source/NSButton.m new file mode 100644 index 000000000..071b58f07 --- /dev/null +++ b/Source/NSButton.m @@ -0,0 +1,346 @@ +/* + NSButton.m + + The button class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include + +// +// class variables +// +id MB_NSBUTTON_CLASS; + +// +// NSButton implementation +// +@implementation NSButton + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSButton class]) + { + // Initial version + [self setVersion:1]; + + // Set our cell class to NSButtonCell + [self setCellClass:[NSButtonCell class]]; + } +} + +// +// Initializing the NSButton Factory +// ++ (Class)cellClass +{ + return MB_NSBUTTON_CLASS; +} + ++ (void)setCellClass:(Class)classId +{ + MB_NSBUTTON_CLASS = classId; +} + +// +// Instance methods +// +// +// Initialization +// +- init +{ + return [self initWithFrame:NSZeroRect]; +} + +- initWithFrame:(NSRect)frameRect +{ + [super initWithFrame:frameRect]; + + // set our cell + [[self cell] release]; + [self setCell:[[MB_NSBUTTON_CLASS alloc] init]]; + + return self; +} + +// +// Setting the Button Type +// +- (void)setType:(NSButtonType)aType +{ + [cell setType:aType]; + [self display]; +} + +// +// Setting the State +// +- (void)setState:(int)value +{ + [cell setState:value]; + [self display]; +} + +- (int)state +{ + return [cell state]; +} + +// +// Setting the Repeat Interval +// +- (void)getPeriodicDelay:(float *)delay + interval:(float *)interval +{} + +- (void)setPeriodicDelay:(float)delay + interval:(float)interval +{} + +// +// Setting the Titles +// +- (NSString *)alternateTitle +{ + return [cell alternateTitle]; +} + +- (void)setAlternateTitle:(NSString *)aString +{ + [cell setAlternateTitle:aString]; + [self display]; +} + +- (void)setTitle:(NSString *)aString +{ + [cell setTitle:aString]; + [self display]; +} + +- (NSString *)title +{ + return [cell title]; +} + +// +// Setting the Images +// +- (NSImage *)alternateImage +{ + return [cell alternateImage]; +} + +- (NSImage *)image +{ + return [cell image]; +} + +- (NSCellImagePosition)imagePosition +{ + return [cell imagePosition]; +} + +- (void)setAlternateImage:(NSImage *)anImage +{ + [cell setAlternateImage:anImage]; + [self display]; +} + +- (void)setImage:(NSImage *)anImage +{ + [cell setImage:anImage]; + [self display]; +} + +- (void)setImagePosition:(NSCellImagePosition)aPosition +{ + [cell setImagePosition:aPosition]; + [self display]; +} + +// +// Modifying Graphic Attributes +// +- (BOOL)isBordered +{ + return [cell isBordered]; +} + +- (BOOL)isTransparent +{ + return [cell isTransparent]; +} + +- (void)setBordered:(BOOL)flag +{ + [cell setBordered:flag]; + [self display]; +} + +- (void)setTransparent:(BOOL)flag +{ + [cell setTransparent:flag]; + [self display]; +} + +// +// Displaying +// +- (void)drawRect:(NSRect)rect +{ + [cell drawWithFrame:rect inView:self]; +} + +- (void)highlight:(BOOL)flag +{ +} + +// +// Setting the Key Equivalent +// +- (NSString *)keyEquivalent +{ + return nil; +} + +- (unsigned int)keyEquivalentModifierMask +{ + return 0; +} + +- (void)setKeyEquivalent:(NSString *)aKeyEquivalent +{} + +- (void)setKeyEquivalentModifierMask:(unsigned int)mask +{} + +// +// Handling Events and Action Messages +// +- (void)mouseDown:(NSEvent *)theEvent +{ + NSApplication *theApp = [NSApplication sharedApplication]; + BOOL mouseUp, done; + NSEvent *e; + unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask + | NSMouseMovedMask; + + NSDebugLog(@"NSButton mouseDown\n"); + + // capture mouse + [[self window] captureMouse: self]; + + done = NO; + e = theEvent; + while (!done) + { + mouseUp = [cell trackMouse: e inRect: bounds + ofView:self untilMouseUp:YES]; + e = [theApp currentEvent]; + + // If mouse went up then we are done + if ((mouseUp) || ([e type] == NSLeftMouseUp)) + done = YES; + else + { + NSDebugLog(@"NSButton process another event\n"); + e = [theApp nextEventMatchingMask:event_mask untilDate:nil + inMode:nil dequeue:YES]; + } + } + + // Release mouse + [[self window] releaseMouse: self]; + + // If the mouse went up in the button + if (mouseUp) + { + // Unhighlight the button + [cell highlight: NO withFrame: bounds + inView: self]; + + // + // Perform different state changes based upon our type + // + switch ([cell type]) + { + case NSMomentaryChangeButton: + case NSPushOnPushOffButton: + case NSToggleButton: + case NSSwitchButton: + case NSRadioButton: + case NSOnOffButton: + // Toggle our state + if ([self state]) + { + [self setState:0]; + NSDebugLog(@"toggle state off\n"); + } + else + { + [self setState:1]; + NSDebugLog(@"toggle state on\n"); + } + } + + // Have the target perform the action + [self sendAction:[self action] to:[self target]]; + } +} + +- (void)performClick:(id)sender +{ + [cell performClick:sender]; +} + +- (BOOL)performKeyEquivalent:(NSEvent *)anEvent +{ + return NO; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSButtonCell.m b/Source/NSButtonCell.m new file mode 100644 index 000000000..2d1067d0c --- /dev/null +++ b/Source/NSButtonCell.m @@ -0,0 +1,282 @@ +/* + NSButtonCell.m + + The button cell class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include + +// +// NSButtonCell implementation +// +@implementation NSButtonCell + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSButtonCell class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// +- init +{ + [self initTextCell:[NSString stringWithCString:"Button"]]; + return self; +} + +- initImageCell:(NSImage *)anImage +{ + [super initImageCell:anImage]; + cell_type = NSMomentaryPushButton; + [self setEnabled:YES]; + transparent = NO; + [self setBordered:YES]; + return self; +} + +- initTextCell:(NSString *)aString +{ + [super initTextCell:aString]; + support = [NSFont userFixedPitchFontOfSize:12]; + alt_contents = @"Button"; + cell_type = NSMomentaryPushButton; + [self setEnabled:YES]; + transparent = NO; + [self setBordered:YES]; + return self; +} + +- (void)dealloc +{ + [super dealloc]; +} + +// +// Setting the Titles +// +- (NSString *)alternateTitle +{ + return alt_contents; +} + +- (void)setAlternateTitle:(NSString *)aString +{ + alt_contents = aString; + // update our state + [self setState:[self state]]; +} + +- (void)setFont:(NSFont *)fontObject +{ + [super setFont:fontObject]; +} + +- (void)setTitle:(NSString *)aString +{ + [self setStringValue:aString]; + // update our state + [self setState:[self state]]; +} + +- (NSString *)title +{ + return [self stringValue]; +} + +// +// Setting the Images +// +- (NSImage *)alternateImage +{ + return alt_image; +} + +- (NSCellImagePosition)imagePosition +{ + return image_position; +} + +- (void)setAlternateImage:(NSImage *)anImage +{ + alt_image = anImage; +} + +- (void)setImagePosition:(NSCellImagePosition)aPosition +{ + image_position = aPosition; +} + +// +// Setting the Repeat Interval +// +- (void)getPeriodicDelay:(float *)delay + interval:(float *)interval +{} + +- (void)setPeriodicDelay:(float)delay + interval:(float)interval +{} + +// +// Setting the Key Equivalent +// +- (NSString *)keyEquivalent +{ + return nil; +} + +- (NSFont *)keyEquivalentFont +{ + return nil; +} + +- (unsigned int)keyEquivalentModifierMask +{ + return 0; +} + +- (void)setKeyEquivalent:(NSString *)aKeyEquivalent +{} + +- (void)setKeyEquivalentModifierMask:(unsigned int)mask +{} + +- (void)setKeyEquivalentFont:(NSFont *)fontObj +{} + +- (void)setKeyEquivalentFont:(NSString *)fontName + size:(float)fontSize +{} + +// +// Modifying Graphic Attributes +// +- (BOOL)isOpaque +{ + return NO; +} + +- (BOOL)isTransparent +{ + return transparent; +} + +- (void)setTransparent:(BOOL)flag +{ + transparent = flag; +} + +// +// Modifying Graphic Attributes +// +- (int)highlightsBy +{ + return 0; +} + +- (void)setHighlightsBy:(int)aType +{} + +- (void)setShowsStateBy:(int)aType +{} + +- (void)setType:(NSButtonType)aType +{ + cell_type = aType; + + // update our state + [self setState:[self state]]; +} + +- (int)showsStateBy +{ + return 0; +} + +- (void)setState:(int)value +{ + [super setState:value]; +} + +// +// Displaying +// +- (void)drawWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView +{ + // Save last view drawn to + control_view = controlView; +} + +// +// Simulating a Click +// +- (void)performClick:(id)sender +{ +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + NSLog(@"NSButtonCell: start encoding\n"); + [aCoder encodeObject: alt_contents]; + [aCoder encodeObject: alt_image]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &transparent]; + NSLog(@"NSButtonCell: finish encoding\n"); +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + NSLog(@"NSButtonCell: start decoding\n"); + alt_contents = [aDecoder decodeObject]; + alt_image = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &transparent]; + NSLog(@"NSButtonCell: finish decoding\n"); + return self; +} + +@end diff --git a/Source/NSCachedImageRep.m b/Source/NSCachedImageRep.m new file mode 100644 index 000000000..89c129abb --- /dev/null +++ b/Source/NSCachedImageRep.m @@ -0,0 +1,92 @@ +/* + NSCachedImageRep.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSCachedImageRep + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSCachedImageRep class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Initializing an NSCachedImageRep +// +- (id)initWithSize:(NSSize)aSize + depth:(NSWindowDepth)aDepth +separate:(BOOL)separate + alpha:(BOOL)alpha +{ + return nil; +} + +- (id)initWithWindow:(NSWindow *)aWindow + rect:(NSRect)aRect +{ + return nil; +} + +// +// Getting the Representation +// +- (NSRect)rect +{ + return NSZeroRect; +} + +- (NSWindow *)window +{ + return nil; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSCell.m b/Source/NSCell.m new file mode 100644 index 000000000..2a567563b --- /dev/null +++ b/Source/NSCell.m @@ -0,0 +1,789 @@ +/* + NSCell.m + + The abstract cell class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include + +@implementation NSCell + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSCell class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Tracking the Mouse +// ++ (BOOL)prefersTrackingUntilMouseUp +{ + return NO; +} + +// +// Instance methods +// + +// +// Initializing an NSCell +// +- init +{ + [super init]; + cell_type = NSNullCellType; + image_position = NSNoImage; + cell_state = NO; + cell_highlighted = NO; + cell_enabled = YES; + cell_editable = NO; + cell_bordered = NO; + cell_bezeled = NO; + cell_scrollable = NO; + cell_selectable = NO; + cell_continuous = NO; + cell_float_autorange = NO; + cell_float_left = 0; + cell_float_right = 0; + return self; +} + +- (id)initImageCell:(NSImage *)anImage +{ + [super init]; + + // Not an image class --then forget it + if (![anImage isKindOfClass:[NSImage class]]) + return nil; + + support = anImage; + cell_type = NSImageCellType; + image_position = NSImageOnly; + cell_state = NO; + cell_highlighted = NO; + cell_enabled = YES; + cell_editable = NO; + cell_bordered = NO; + cell_bezeled = NO; + cell_scrollable = NO; + cell_selectable = NO; + cell_continuous = NO; + cell_float_autorange = NO; + cell_float_left = 0; + cell_float_right = 0; + return self; +} + +- (id)initTextCell:(NSString *)aString +{ + [super init]; + + // Not a string class --then forget it + //if (![aString isKindOfClass:[NSString class]]) + // return nil; + + support = [NSFont userFontOfSize:12]; + contents = aString; + cell_type = NSTextCellType; + text_align = NSLeftTextAlignment; + image_position = NSNoImage; + cell_state = NO; + cell_highlighted = NO; + cell_enabled = YES; + cell_editable = NO; + cell_bordered = NO; + cell_bezeled = NO; + cell_scrollable = NO; + cell_selectable = NO; + cell_continuous = NO; + cell_float_autorange = YES; + cell_float_left = 0; + cell_float_right = 6; + return self; +} + +// +// Determining Component Sizes +// +- (void)calcDrawInfo:(NSRect)aRect +{} + +- (NSSize)cellSize +{ + return NSZeroSize; +} + +- (NSSize)cellSizeForBounds:(NSRect)aRect +{ + return NSZeroSize; +} + +- (NSRect)drawingRectForBounds:(NSRect)theRect +{ + return NSZeroRect; +} + +- (NSRect)imageRectForBounds:(NSRect)theRect +{ + return NSZeroRect; +} + +- (NSRect)titleRectForBounds:(NSRect)theRect +{ + return NSZeroRect; +} + +// +// Setting the NSCell's Type +// +- (void)setType:(NSCellType)aType +{ + cell_type = aType; +} + +- (NSCellType)type +{ + return cell_type; +} + +// +// Setting the NSCell's State +// +- (void)setState:(int)value +{ + cell_state = value; +} + +- (int)state +{ + return cell_state; +} + +// +// Enabling and Disabling the NSCell +// +- (BOOL)isEnabled +{ + return cell_enabled; +} + +- (void)setEnabled:(BOOL)flag +{ + cell_enabled = flag; +} + +// +// Setting the Image +// +- (NSImage *)image +{ + if (cell_type == NSImageCellType) + return support; + else + return nil; +} + +- (void)setImage:(NSImage *)anImage +{ + // Not an image class --then forget it + if (![anImage isKindOfClass:[NSImage class]]) + return; + + // Only set the image if we are an image cell + if (cell_type == NSImageCellType) + support = anImage; +} + +// +// Setting the NSCell's Value +// +- (double)doubleValue +{ + return [contents doubleValue]; +} + +- (float)floatValue; +{ + return [contents floatValue]; +} + +- (int)intValue +{ + return [contents intValue]; +} + +- (NSString *)stringValue +{ + return contents; +} + +- (void)setDoubleValue:(double)aDouble +{ + char c[256]; + unsigned int w = cell_float_left + cell_float_right; + + // Default printf formatting + if (cell_float_left == 0) + sprintf(c, "%f", aDouble); + else + if (cell_float_autorange) + sprintf(c, "%*f", w, aDouble); + else + sprintf(c, "%*.*f", w, cell_float_right, aDouble); + + contents = [NSString stringWithCString:c]; +} + +- (void)setFloatValue:(float)aFloat +{ + char c[256]; + unsigned int w = cell_float_left + cell_float_right; + + // Default printf formatting + if (cell_float_left == 0) + sprintf(c, "%f", aFloat); + else + if (cell_float_autorange) + sprintf(c, "%*f", w, aFloat); + else + sprintf(c, "%*.*f", w, cell_float_right, aFloat); + + contents = [NSString stringWithCString:c]; +} + +- (void)setIntValue:(int)anInt +{ + char c[256]; + sprintf(c, "%d", anInt); + contents = [NSString stringWithCString:c]; +} + +- (void)setStringValue:(NSString *)aString +{ + contents = aString; +} + +// +// Interacting with Other NSCells +// +- (void)takeDoubleValueFrom:(id)sender +{ + [self setDoubleValue:[sender doubleValue]]; +} + +- (void)takeFloatValueFrom:(id)sender +{ + [self setFloatValue:[sender floatValue]]; +} + +- (void)takeIntValueFrom:(id)sender +{ + [self setIntValue:[sender intValue]]; +} + +- (void)takeStringValueFrom:(id)sender +{ + [self setStringValue:[sender stringValue]]; +} + +// +// Modifying Text Attributes +// +- (NSTextAlignment)alignment +{ + return text_align; +} + +- (NSFont *)font +{ + if ([support isKindOfClass:[NSFont class]]) + return support; + else + return nil; +} + +- (BOOL)isEditable +{ + return cell_editable; +} + +- (BOOL)isSelectable +{ + return cell_selectable; +} + +- (BOOL)isScrollable +{ + return cell_scrollable; +} + +- (void)setAlignment:(NSTextAlignment)mode +{ + text_align = mode; +} + +- (void)setEditable:(BOOL)flag +{ + cell_editable = flag; + // If its editable then its selectable + if (flag) + cell_selectable = flag; +} + +- (void)setFont:(NSFont *)fontObject +{ + // Not a font --then forget it + if (![fontObject isKindOfClass:[NSFont class]]) + return; + + // Only set the font if we are a text cell + if ([support isKindOfClass:[NSFont class]]) + support = fontObject; +} + +- (void)setSelectable:(BOOL)flag +{ + cell_selectable = flag; + // If its not selectable then its not editable + if (!flag) + cell_editable = NO; +} + +- (void)setScrollable:(BOOL)flag +{ + cell_scrollable = flag; +} + +- (NSText *)setUpFieldEditorAttributes:(NSText *)textObject +{ + return nil; +} + +- (void)setWraps:(BOOL)flag +{} + +- (BOOL)wraps +{ + return NO; +} + +// +// Editing Text +// +- (void)editWithFrame:(NSRect)aRect + inView:(NSView *)controlView +editor:(NSText *)textObject + delegate:(id)anObject +event:(NSEvent *)theEvent +{} + +- (void)endEditing:(NSText *)textObject +{} + +- (void)selectWithFrame:(NSRect)aRect + inView:(NSView *)controlView +editor:(NSText *)textObject + delegate:(id)anObject +start:(int)selStart + length:(int)selLength +{} + +// +// Validating Input +// +- (int)entryType +{ + return entry_type; +} + +- (BOOL)isEntryAcceptable:(NSString *)aString +{ + return YES; +} + +- (void)setEntryType:(int)aType +{ + entry_type = aType; +} + +// +// Formatting Data +// +- (void)setFloatingPointFormat:(BOOL)autoRange + left:(unsigned int)leftDigits + right:(unsigned int)rightDigits +{ + cell_float_autorange = autoRange; + cell_float_left = leftDigits; + cell_float_right = rightDigits; +} + +// +// Modifying Graphic Attributes +// +- (BOOL)isBezeled +{ + return cell_bezeled; +} + +- (BOOL)isBordered +{ + return cell_bordered; +} + +- (BOOL)isOpaque +{ + return NO; +} + +- (void)setBezeled:(BOOL)flag +{ + cell_bezeled = flag; +} + +- (void)setBordered:(BOOL)flag +{ + cell_bordered = flag; +} + +// +// Setting Parameters +// +- (int)cellAttribute:(NSCellAttribute)aParameter +{ + return 0; +} + +- (void)setCellAttribute:(NSCellAttribute)aParameter + to:(int)value +{} + +// +// Displaying +// +- (NSView *)controlView +{ + return control_view; +} + +- (void)drawInteriorWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView +{} + +- (void)drawWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView +{} + +- (void)highlight:(BOOL)lit + withFrame:(NSRect)cellFrame + inView:(NSView *)controlView +{ + cell_highlighted = lit; +} + +- (BOOL)isHighlighted +{ + return cell_highlighted; +} + +// +// Target and Action +// +- (SEL)action +{ + return NULL; +} + +- (BOOL)isContinuous +{ + return cell_continuous; +} + +- (int)sendActionOn:(int)mask +{ + return 0; +} + +- (void)setAction:(SEL)aSelector +{} + +- (void)setContinuous:(BOOL)flag +{ + cell_continuous = flag; +} + +- (void)setTarget:(id)anObject +{} + +- (id)target +{ + return nil; +} + +// +// Assigning a Tag +// +- (void)setTag:(int)anInt +{} + +- (int)tag +{ + return -1; +} + +// +// Handling Keyboard Alternatives +// +- (NSString *)keyEquivalent +{ + return nil; +} + +// +// Tracking the Mouse +// +- (BOOL)continueTracking:(NSPoint)lastPoint + at:(NSPoint)currentPoint + inView:(NSView *)controlView +{ + return YES; +} + +- (int)mouseDownFlags +{ + return 0; +} + +- (void)getPeriodicDelay:(float *)delay + interval:(float *)interval +{} + +- (BOOL)startTrackingAt:(NSPoint)startPoint + inView:(NSView *)controlView +{ + // If the point is in the view then yes start tracking + if ([controlView mouse: startPoint inRect: [controlView bounds]]) + return YES; + else + return NO; +} + +- (void)stopTracking:(NSPoint)lastPoint + at:(NSPoint)stopPoint + inView:(NSView *)controlView + mouseIsUp:(BOOL)flag +{ +} + +- (BOOL)trackMouse:(NSEvent *)theEvent + inRect:(NSRect)cellFrame + ofView:(NSView *)controlView + untilMouseUp:(BOOL)flag +{ + NSApplication *theApp = [NSApplication sharedApplication]; + NSEvent *e; + unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask + | NSMouseMovedMask; + NSPoint location = [theEvent locationInWindow]; + NSPoint point = [controlView convertPoint: location fromView: nil]; + NSPoint last_point; + BOOL done; + NSRect r; + BOOL untilMU, mouseWentUp; + + NSDebugLog(@"NSCell start tracking\n"); + NSDebugLog(@"NSCell tracking in rect %f %f %f %f\n", + cellFrame.origin.x, cellFrame.origin.y, + cellFrame.size.width, cellFrame.size.height); + NSDebugLog(@"NSCell initial point %f %f\n", point.x, point.y); + + if (![self startTrackingAt: point inView: controlView]) + return NO; + + // If point is in cellFrame then highlight the cell + if ([controlView mouse: point inRect: cellFrame]) + [self highlight:YES withFrame:cellFrame inView:controlView]; + else + return NO; + + // Get next mouse events until a mouse up is obtained + NSDebugLog(@"NSCell get mouse events\n"); + mouseWentUp = NO; + done = NO; + while (!done) + { + last_point = point; + e = [theApp nextEventMatchingMask:event_mask untilDate:nil + inMode:nil dequeue:YES]; + location = [e locationInWindow]; + point = [controlView convertPoint: location fromView: nil]; + NSDebugLog(@"NSCell location %f %f\n", location.x, location.y); + NSDebugLog(@"NSCell point %f %f\n", point.x, point.y); + + if (![controlView mouse: point inRect: cellFrame]) + { + NSDebugLog(@"NSCell point not in cell frame\n"); + // If point not in cell then unhighlight cell + [self highlight: NO withFrame: cellFrame + inView: controlView]; + + // Do we now return or keep tracking + if ((![[self class] prefersTrackingUntilMouseUp]) + || (!flag)) + { + NSDebugLog(@"NSCell return immediately\n"); + done = YES; + continue; + } + } + + // should we continue tracking? + if (![self continueTracking: last_point at: point + inView: controlView]) + { + NSDebugLog(@"NSCell stop tracking\n"); + done = YES; + continue; + } + + // Did the mouse go up? + if ([e type] == NSLeftMouseUp) + { + NSDebugLog(@"NSCell mouse went up\n"); + mouseWentUp = YES; + done = YES; + } + } + + // Tell ourselves to stop tracking + [self stopTracking: last_point at: point + inView: controlView mouseIsUp: mouseWentUp]; + + // Return YES only if the mouse went up within the cell + if ((mouseWentUp) && + ([controlView mouse: point inRect: cellFrame])) + { + NSDebugLog(@"NSCell mouse went up in cell\n"); + return YES; + } + + // Otherwise return NO + NSDebugLog(@"NSCell mouse did not go up in cell\n"); + return NO; +} + +// +// Managing the Cursor +// +- (void)resetCursorRect:(NSRect)cellFrame + inView:(NSView *)controlView +{} + +// +// Comparing to Another NSCell +// +- (NSComparisonResult)compare:(id)otherCell +{ + return 0; +} + +// +// Using the NSCell to Represent an Object +// +- (id)representedObject +{ + return nil; +} + +- (void)setRepresentedObject:(id)anObject +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: contents]; + [aCoder encodeObject: support]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_state]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_highlighted]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_enabled]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_editable]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_bordered]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_bezeled]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_scrollable]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_selectable]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_continuous]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_float_autorange]; + [aCoder encodeValueOfObjCType: "I" at: &cell_float_left]; + [aCoder encodeValueOfObjCType: "I" at: &cell_float_right]; + [aCoder encodeValueOfObjCType: "I" at: &image_position]; + [aCoder encodeValueOfObjCType: "i" at: &cell_type]; + [aCoder encodeValueOfObjCType: @encode(NSTextAlignment) at: &text_align]; + [aCoder encodeValueOfObjCType: "i" at: &entry_type]; + [aCoder encodeObjectReference: control_view withName: @"Control view"]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + contents = [aDecoder decodeObject]; + support = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_state]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_highlighted]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_enabled]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_editable]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_bordered]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_bezeled]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_scrollable]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_selectable]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_continuous]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_float_autorange]; + [aDecoder decodeValueOfObjCType: "I" at: &cell_float_left]; + [aDecoder decodeValueOfObjCType: "I" at: &cell_float_right]; + [aDecoder decodeValueOfObjCType: "I" at: &image_position]; + [aDecoder decodeValueOfObjCType: "i" at: &cell_type]; + [aDecoder decodeValueOfObjCType: @encode(NSTextAlignment) at: &text_align]; + [aDecoder decodeValueOfObjCType: "i" at: &entry_type]; + [aDecoder decodeObjectAt: &control_view withName: NULL]; + + return self; +} + +@end diff --git a/Source/NSClipView.m b/Source/NSClipView.m new file mode 100644 index 000000000..281056879 --- /dev/null +++ b/Source/NSClipView.m @@ -0,0 +1,135 @@ +/* + NSClipView.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSClipView + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSClipView class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Managing the Document View +// +- (NSRect)documentRect +{ + return NSZeroRect; +} + +- (id)documentView +{ + return nil; +} + +- (NSRect)documentVisibleRect +{ + return NSZeroRect; +} + +- (void)setDocumentView:(NSView *)aView +{} + +// +// Setting the Cursor +// +- (NSCursor *)documentCursor +{ + return nil; +} + +- (void)setDocumentCursor:(NSCursor *)anObject +{} + +// +// Setting the Background Color +// +- (NSColor *)backgroundColor +{ + return nil; +} + +- (void)setBackgroundColor:(NSColor *)color +{} + +// +// Scrolling +// +- (BOOL)autoscroll:(NSEvent *)theEvent +{ + return NO; +} + +- (NSPoint)constrainScrollPoint:(NSPoint)newOrigin +{ + return NSZeroPoint; +} + +- (BOOL)copiesOnScroll +{ + return NO; +} + +- (void)scrollToPoint:(NSPoint)newOrigin +{} + +- (void)setCopiesOnScroll:(BOOL)flag +{} + +// +// Responding to a Changed Frame +// +- (void)viewFrameChanged:(NSNotification *)notification +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSColor.m b/Source/NSColor.m new file mode 100644 index 000000000..6bbc7f81f --- /dev/null +++ b/Source/NSColor.m @@ -0,0 +1,507 @@ +/* + NSColor.m + + The colorful color class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +// Global strings +NSString *NSCalibratedWhiteColorSpace; +NSString *NSCalibratedBlackColorSpace; +NSString *NSCalibratedRGBColorSpace; +NSString *NSDeviceWhiteColorSpace; +NSString *NSDeviceBlackColorSpace; +NSString *NSDeviceRGBColorSpace; +NSString *NSDeviceCMYKColorSpace; +NSString *NSNamedColorSpace; +NSString *NSCustomColorSpace; + +// Global gray values +const float NSBlack = 0; +const float NSDarkGray = .502; +const float NSWhite = 1; +const float NSLightGray = .753; + +@implementation NSColor + +//////////////////////////////////////////////////////////// +// +// Internal methods +// +- (void)setRed:(float)value +{ + if (value < 0) value = 0; + if (value > 1) value = 1; + RGB_component.red = value; +} + +- (void)setGreen:(float)value +{ + if (value < 0) value = 0; + if (value > 1) value = 1; + RGB_component.green = value; +} + +- (void)setBlue:(float)value +{ + if (value < 0) value = 0; + if (value > 1) value = 1; + RGB_component.blue = value; +} + +- (void)setClear:(BOOL)flag +{ + is_clear = flag; +} + +//////////////////////////////////////////////////////////// +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSColor class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Creating an NSColor from Component Values +// ++ (NSColor *)colorWithCalibratedHue:(float)hue + saturation:(float)saturation + brightness:(float)brightness + alpha:(float)alpha +{ + return nil; +} + ++ (NSColor *)colorWithCalibratedRed:(float)red + green:(float)green + blue:(float)blue + alpha:(float)alpha +{ + NSColor *c; + + c = [[[NSColor alloc] init] autorelease]; + [c setRed:red]; + [c setGreen:green]; + [c setBlue:blue]; + [c setClear:NO]; + return c; +} + ++ (NSColor *)colorWithCalibratedWhite:(float)white + alpha:(float)alpha +{ + return nil; +} + ++ (NSColor *)colorWithCatalogName:(NSString *)listName + colorName:(NSString *)colorName +{ + return nil; +} + ++ (NSColor *)colorWithDeviceCyan:(float)cyan + magenta:(float)magenta + yellow:(float)yellow + black:(float)black + alpha:(float)alpha +{ + return nil; +} + ++ (NSColor *)colorWithDeviceHue:(float)hue + saturation:(float)saturation + brightness:(float)brightness + alpha:(float)alpha +{ + return nil; +} + ++ (NSColor *)colorWithDeviceRed:(float)red + green:(float)green + blue:(float)blue + alpha:(float)alpha +{ + return self; +} + ++ (NSColor *)colorWithDeviceWhite:(float)white + alpha:(float)alpha +{ + return nil; +} + +// +// Creating an NSColor With Preset Components +// ++ (NSColor *)blackColor +{ + return [self colorWithCalibratedRed:0 + green:0 + blue:0 + alpha:1]; +} + ++ (NSColor *)blueColor +{ + return [self colorWithCalibratedRed:0 + green:0 + blue:1.0 + alpha:1]; +} + ++ (NSColor *)brownColor +{ + return [self colorWithCalibratedRed:0.6 + green:0.4 + blue:0.2 + alpha:1]; +} + ++ (NSColor *)clearColor +{ + NSColor *c; + c = [self colorWithCalibratedRed:0 + green:1.0 + blue:1.0 + alpha:1]; + [c setClear:YES]; + return c; +} + ++ (NSColor *)cyanColor +{ + return [self colorWithCalibratedRed:0 + green:1.0 + blue:1.0 + alpha:1]; +} + ++ (NSColor *)darkGrayColor +{ + return [self colorWithCalibratedRed:0.502 + green:0.502 + blue:0.502 + alpha:1]; +} + ++ (NSColor *)grayColor +{ + return [self colorWithCalibratedRed:0.753 + green:0.753 + blue:0.753 + alpha:1]; +} + ++ (NSColor *)greenColor +{ + return [self colorWithCalibratedRed:0 + green:1.0 + blue:0 + alpha:1]; +} + ++ (NSColor *)lightGrayColor +{ + return [self colorWithCalibratedRed:0.9 + green:0.9 + blue:0.9 + alpha:1]; +} + ++ (NSColor *)magentaColor +{ + return [self colorWithCalibratedRed:1.0 + green:0 + blue:1.0 + alpha:1]; +} + ++ (NSColor *)orangeColor; +{ + return [self colorWithCalibratedRed:1.0 + green:0.5 + blue:0 + alpha:1]; +} + ++ (NSColor *)purpleColor; +{ + return [self colorWithCalibratedRed:0.5 + green:0 + blue:0.5 + alpha:1]; +} + ++ (NSColor *)redColor; +{ + return [self colorWithCalibratedRed:1.0 + green:0 + blue:0 + alpha:1]; +} + ++ (NSColor *)whiteColor; +{ + return [self colorWithCalibratedRed:1.0 + green:1.0 + blue:1.0 + alpha:1]; +} + ++ (NSColor *)yellowColor +{ + return [self colorWithCalibratedRed:1.0 + green:1.0 + blue:0 + alpha:1]; +} + +// +// Ignoring Alpha Components +// ++ (BOOL)ignoresAlpha +{ + return YES; +} + ++ (void)setIgnoresAlpha:(BOOL)flag +{} + +// +// Copying and Pasting +// ++ (NSColor *)colorFromPasteboard:(NSPasteboard *)pasteBoard +{ + return nil; +} + +//////////////////////////////////////////////////////////// +// +// Instance methods +// +// +// Retrieving a Set of Components +// +- (void)getCyan:(float *)cyan + magenta:(float *)magenta + yellow:(float *)yellow + black:(float *)black + alpha:(float *)alpha +{} + +- (void)getHue:(float *)hue + saturation:(float *)saturation + brightness:(float *)brightness + alpha:(float *)alpha +{} + +- (void)getRed:(float *)red + green:(float *)green + blue:(float *)blue + alpha:(float *)alpha +{} + +- (void)getWhite:(float *)white + alpha:(float *)alpha +{} + +// +// Retrieving Individual Components +// +- (float)alphaComponent +{ + return alpha_component; +} + +- (float)blackComponent +{ + return 0; +} + +- (float)blueComponent +{ + return RGB_component.blue; +} + +- (float)brightnessComponent +{ + return 0; +} + +- (NSString *)catalogNameComponent +{ + return nil; +} + +- (NSString *)colorNameComponent +{ + return nil; +} + +- (float)cyanComponent +{ + return 0; +} + +- (float)greenComponent +{ + return RGB_component.green; +} + +- (float)hueComponent +{ + return 0; +} + +- (NSString *)localizedCatalogNameComponent +{ + return nil; +} + +- (NSString *)localizedColorNameComponent +{ + return nil; +} + +- (float)magentaComponent +{ + return 0; +} + +- (float)redComponent +{ + return RGB_component.red; +} + +- (float)saturationComponent +{ + return 0; +} + +- (float)whiteComponent +{ + return 0; +} + +- (float)yellowComponent +{ + return 0; +} + +// +// Converting to Another Color Space +// +- (NSString *)colorSpaceName +{ + return nil; +} + +- (NSColor *)colorUsingColorSpaceName:(NSString *)colorSpace +{ + return nil; +} + +- (NSColor *)colorUsingColorSpaceName:(NSString *)colorSpace + device:(NSDictionary *)deviceDescription +{ + return nil; +} + +// +// Changing the Color +// +- (NSColor *)blendedColorWithFraction:(float)fraction + ofColor:(NSColor *)aColor +{ + return nil; +} + +- (NSColor *)colorWithAlphaComponent:(float)alpha +{ + return nil; +} + +// +// Copying and Pasting +// +- (void)writeToPasteboard:(NSPasteboard *)pasteBoard +{} + +// +// Drawing +// +- (void)drawSwatchInRect:(NSRect)rect +{} + +- (void)set +{ +} + +// +// Destroying +// +- (void)dealloc +{ + [super dealloc]; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeValueOfObjCType: "f" at: &RGB_component.red]; + [aCoder encodeValueOfObjCType: "f" at: &RGB_component.green]; + [aCoder encodeValueOfObjCType: "f" at: &RGB_component.blue]; + [aCoder encodeValueOfObjCType: "f" at: &alpha_component]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_clear]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + [aDecoder decodeValueOfObjCType: "f" at: &RGB_component.red]; + [aDecoder decodeValueOfObjCType: "f" at: &RGB_component.green]; + [aDecoder decodeValueOfObjCType: "f" at: &RGB_component.blue]; + [aDecoder decodeValueOfObjCType: "f" at: &alpha_component]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_clear]; + + return self; +} + +@end diff --git a/Source/NSColorList.m b/Source/NSColorList.m new file mode 100644 index 000000000..ddd1cfaac --- /dev/null +++ b/Source/NSColorList.m @@ -0,0 +1,150 @@ +/* + NSColorList.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +// NSColorList notifications +NSString *NSColorListChangedNotification; + +@implementation NSColorList + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSColorList class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Getting All Color Lists +// ++ (NSArray *)availableColorLists +{ + return nil; +} + +// +// Getting a Color List by Name +// ++ (NSColorList *)colorListNamed:(NSString *)name +{ + return nil; +} + +// +// Instance methods +// +// +// Initializing an NSColorList +// +- (id)initWithName:(NSString *)name +{ + return nil; +} + +- (id)initWithName:(NSString *)name + fromFile:(NSString *)path +{ + return nil; +} + +// +// Getting a Color List by Name +// +- (NSString *)name +{ + return nil; +} + +// +// Managing Colors by Key +// +- (NSArray *)allKeys +{ + return nil; +} + +- (NSColor *)colorWithKey:(NSString *)key +{ + return nil; +} + +- (void)insertColor:(NSColor *)color + key:(NSString *)key +atIndex:(unsigned)location +{} + +- (void)removeColorWithKey:(NSString *)key +{} + +- (void)setColor:(NSColor *)aColor + forKey:(NSString *)key +{} + +// +// Editing +// +- (BOOL)isEditable +{ + return NO; +} + +// +// Writing and Removing Files +// +- (BOOL)writeToFile:(NSString *)path +{ + return NO; +} + +- (void)removeFile +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSColorPanel.m b/Source/NSColorPanel.m new file mode 100644 index 000000000..15a69be94 --- /dev/null +++ b/Source/NSColorPanel.m @@ -0,0 +1,167 @@ +/* + NSColorPanel.m + + System generic color panel + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +// NSColorPanel notifications +NSString *NSColorPanelColorChangedNotification; + +@implementation NSColorPanel + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSColorPanel class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Creating the NSColorPanel +// ++ (NSColorPanel *)sharedColorPanel +{ + return nil; +} + ++ (BOOL)sharedColorPanelExists +{ + return NO; +} + +// +// Setting the NSColorPanel +// ++ (void)setPickerMask:(int)mask +{} + ++ (void)setPickerMode:(int)mode +{} + +// +// Setting Color +// ++ (BOOL)dragColor:(NSColor **)aColor + withEvent:(NSEvent *)anEvent +fromView:(NSView *)sourceView +{ + return NO; +} + +// +// Instance methods +// + +// +// Setting the NSColorPanel +// +- (NSView *)accessoryView +{ + return nil; +} + +- (BOOL)isContinuous +{ + return NO; +} + +- (int)mode +{ + return 0; +} + +- (void)setAccessoryView:(NSView *)aView +{} + +- (void)setAction:(SEL)aSelector +{} + +- (void)setContinuous:(BOOL)flag +{} + +- (void)setMode:(int)mode +{} + +- (void)setShowsAlpha:(BOOL)flag +{} + +- (void)setTarget:(id)anObject +{} + +- (BOOL)showsAlpha +{ + return NO; +} + +// +// Attaching a Color List +// +- (void)attachColorList:(NSColorList *)aColorList +{} + +- (void)detachColorList:(NSColorList *)aColorList +{} + +// +// Setting Color +// +- (float)alpha +{ + return 0; +} + +- (NSColor *)color +{ + return nil; +} + +- (void)setColor:(NSColor *)aColor +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSColorPicker.m b/Source/NSColorPicker.m new file mode 100644 index 000000000..84605ff89 --- /dev/null +++ b/Source/NSColorPicker.m @@ -0,0 +1,101 @@ +/* + NSColorPicker.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSColorPicker + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSColorPicker class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// + +// +// Initializing an NSColorPicker +// +- (id)initWithPickerMask:(int)aMask + colorPanel:(NSColorPanel *)colorPanel +{ + return nil; +} + +// +// Getting the Color Panel +// +- (NSColorPanel *)colorPanel +{ + return nil; +} + +// +// Adding Button Images +// +- (void)insertNewButtonImage:(NSImage *)newImage + in:(NSButtonCell *)newButtonCell +{} + +- (NSImage *)provideNewButtonImage +{ + return nil; +} + +// +// Setting the Mode +// +- (void)setMode:(int)mode +{} + +// +// Using Color Lists +// +- (void)attachColorList:(NSColorList *)colorList +{} + +- (void)detachColorList:(NSColorList *)colorList +{} + +// +// Responding to a Resized View +// +- (void)viewSizeChanged:(id)sender +{} + +@end diff --git a/Source/NSColorWell.m b/Source/NSColorWell.m new file mode 100644 index 000000000..452edfdac --- /dev/null +++ b/Source/NSColorWell.m @@ -0,0 +1,111 @@ +/* + NSColorWell.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSColorWell + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSColorWell class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// + +// +// Drawing +// +- (void)drawWellInside:(NSRect)insideRect +{} + +// +// Activating +// +- (void)activate:(BOOL)exclusive +{} + +- (void)deactivate +{} + +- (BOOL)isActive +{ + return NO; +} + +// +// Managing Color +// +- (NSColor *)color +{ + return nil; +} + +- (void)setColor:(NSColor *)color +{} + +- (void)takeColorFrom:(id)sender +{} + +// +// Managing Borders +// +- (BOOL)isBordered +{ + return NO; +} + +- (void)setBordered:(BOOL)bordered +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSControl.m b/Source/NSControl.m new file mode 100644 index 000000000..07ef56475 --- /dev/null +++ b/Source/NSControl.m @@ -0,0 +1,429 @@ +/* + NSControl.m + + The abstract control class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +// +// Class variables +// +id MB_NSCONTROL_CELL_CLASS; + +// NSControl notifications +NSString *NSControlTextDidBeginEditingNotification; +NSString *NSControlTextDidEndEditingNotification; +NSString *NSControlTextDidChangeNotification; + +@implementation NSControl + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSControl class]) + { + NSLog(@"Initialize NSControl class\n"); + + // Initial version + [self setVersion:1]; + + // Set cell class + [self setCellClass:[NSCell class]]; + } +} + +// +// Setting the Control's Cell +// ++ (Class)cellClass +{ + return MB_NSCONTROL_CELL_CLASS; +} + ++ (void)setCellClass:(Class)factoryId +{ + MB_NSCONTROL_CELL_CLASS = factoryId; +} + +// +// Instance methods +// +// +// Initializing an NSControl Object +// +- (id)initWithFrame:(NSRect)frameRect +{ + [super initWithFrame:frameRect]; + + // create our cell + [self setCell:[[MB_NSCONTROL_CELL_CLASS alloc] init]]; + + tag = 0; + + return self; +} + +- (void)dealloc +{ + // release our cell + [cell release]; + + [super dealloc]; +} + +// +// Setting the Control's Cell +// +- (id)cell +{ + return cell; +} + +- (void)setCell:(NSCell *)aCell +{ + // Not a cell class --then forget it + if (![aCell isKindOfClass:[NSCell class]]) + return; + + cell = aCell; +} + +// +// Enabling and Disabling the Control +// +- (BOOL)isEnabled +{ + return [[self selectedCell] isEnabled]; +} + +- (void)setEnabled:(BOOL)flag +{ + [[self selectedCell] setEnabled:flag]; +} + +// +// Identifying the Selected Cell +// +- (id)selectedCell +{ + if ([cell state]) + return cell; + else + return nil; +} + +- (int)selectedTag +{ + return [[self selectedCell] tag]; +} + +// +// Setting the Control's Value +// +- (double)doubleValue +{ + return [[self selectedCell] doubleValue]; +} + +- (float)floatValue +{ + return [[self selectedCell] floatValue]; +} + +- (int)intValue +{ + return [[self selectedCell] intValue]; +} + +- (void)setDoubleValue:(double)aDouble +{ + [[self selectedCell] setDoubleValue:aDouble]; +} + +- (void)setFloatValue:(float)aFloat +{ + [[self selectedCell] setFloatValue:aFloat]; +} + +- (void)setIntValue:(int)anInt +{ + [[self selectedCell] setIntValue:anInt]; +} + +- (void)setNeedsDisplay +{ + [super setNeedsDisplay:YES]; +} + +- (void)setStringValue:(NSString *)aString +{ + [[self selectedCell] setStringValue:aString]; +} + +- (NSString *)stringValue +{ + return [[self selectedCell] stringValue]; +} + +// +// Interacting with Other Controls +// +- (void)takeDoubleValueFrom:(id)sender +{ + [[self selectedCell] takeDoubleValueFrom:sender]; +} + +- (void)takeFloatValueFrom:(id)sender +{ + [[self selectedCell] takeFloatValueFrom:sender]; +} + +- (void)takeIntValueFrom:(id)sender +{ + [[self selectedCell] takeIntValueFrom:sender]; +} + +- (void)takeStringValueFrom:(id)sender +{ + [[self selectedCell] takeStringValueFrom:sender]; +} + +// +// Formatting Text +// +- (NSTextAlignment)alignment +{ + if (cell) + return [cell alignment]; + else + return NSLeftTextAlignment; +} + +- (NSFont *)font +{ + if (cell) + return [cell font]; + else + return nil; +} + +- (void)setAlignment:(NSTextAlignment)mode +{ + if (cell) [cell setAlignment:mode]; +} + +- (void)setFont:(NSFont *)fontObject +{ + if (cell) [cell setFont:fontObject]; +} + +- (void)setFloatingPointFormat:(BOOL)autoRange + left:(unsigned)leftDigits +right:(unsigned)rightDigits +{} + +// +// Managing the Field Editor +// +- (BOOL)abortEditing +{ + return NO; +} + +- (NSText *)currentEditor +{ + return nil; +} + +- (void)validateEditing +{} + +// +// Resizing the Control +// +- (void)calcSize +{} + +- (void)sizeToFit +{} + +// +// Displaying the Control and Cell +// +- (void)drawCell:(NSCell *)aCell +{ + if (cell == aCell) [cell drawWithFrame:frame inView:self]; +} + +- (void)drawCellInside:(NSCell *)aCell +{ + if (cell == aCell) [cell drawInteriorWithFrame:frame inView:self]; +} + +- (void)selectCell:(NSCell *)aCell +{ + if (cell == aCell) [cell setState:1]; +} + +- (void)updateCell:(NSCell *)aCell +{ + [self drawCell:aCell]; +} + +- (void)updateCellInside:(NSCell *)aCell +{ + [self drawCellInside:aCell]; +} + +// +// Target and Action +// +- (SEL)action +{ + return [cell action]; +} + +- (BOOL)isContinuous +{ + return [cell isContinuous]; +} + +- (BOOL)sendAction:(SEL)theAction + to:(id)theTarget +{ + NSApplication *theApp = [NSApplication sharedApplication]; + + return [theApp sendAction:theAction to:theTarget from:self]; +} + +- (int)sendActionOn:(int)mask +{ + return 0; +} + +- (void)setAction:(SEL)aSelector +{ + [cell setAction:aSelector]; +} + +- (void)setContinuous:(BOOL)flag +{ + [cell setContinuous:flag]; +} + +- (void)setTarget:(id)anObject +{ + [cell setTarget:anObject]; +} + +- (id)target +{ + return [cell target]; +} + +// +// Assigning a Tag +// +- (void)setTag:(int)anInt +{ + tag = anInt; +} + +- (int)tag +{ + return tag; +} + +// +// Tracking the Mouse +// +- (void)mouseDown:(NSEvent *)theEvent +{ + //NSRect f; + + //f = MBConvertRectToWindow(bounds); + //[cell trackMouse:theEvent inRect:f ofView:self untilMouseUp:YES]; +} + +- (BOOL)ignoresMultiClick +{ + return NO; +} + +- (void)setIgnoresMultiClick:(BOOL)flag +{} + +// +// Methods Implemented by the Delegate +// +- (BOOL)control:(NSControl *)control +textShouldBeginEditing:(NSText *)fieldEditor +{ + return NO; +} + +- (BOOL)control:(NSControl *)control +textShouldEndEditing:(NSText *)fieldEditor +{ + return NO; +} + +- (void)controlTextDidBeginEditing:(NSNotification *)aNotification +{} + +- (void)controlTextDidEndEditing:(NSNotification *)aNotification +{} + +- (void)controlTextDidChange:(NSNotification *)aNotification +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeValueOfObjCType: "i" at: &tag]; + [aCoder encodeObject: cell]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + [aDecoder decodeValueOfObjCType: "i" at: &tag]; + cell = [aDecoder decodeObject]; + + return self; +} + +@end diff --git a/Source/NSCursor.m b/Source/NSCursor.m new file mode 100644 index 000000000..b706761d7 --- /dev/null +++ b/Source/NSCursor.m @@ -0,0 +1,160 @@ +/* + NSCursor.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSCursor + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSCursor class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Setting the Cursor +// ++ (void)hide +{} + ++ (void)pop +{} + ++ (void)setHiddenUntilMouseMoves:(BOOL)flag +{} + ++ (void)unhide +{} + +// +// Getting the Cursor +// ++ (NSCursor *)arrowCursor +{ + return nil; +} + ++ (NSCursor *)currentCursor +{ + return nil; +} + ++ (NSCursor *)IBeamCursor +{ + return nil; +} + +// +// Instance methods +// + +// +// Initializing a New NSCursor Object +// +- (id)initWithImage:(NSImage *)newImage +{ + return nil; +} + +// +// Defining the Cursor +// +- (NSPoint)hotSpot +{ + return NSZeroPoint; +} + +- (NSImage *)image +{ + return nil; +} + +- (void)setHotSpot:(NSPoint)spot +{} + +- (void)setImage:(NSImage *)newImage +{} + +// +// Setting the Cursor +// +- (BOOL)isSetOnMouseEntered +{ + return NO; +} + +- (BOOL)isSetOnMouseExited +{ + return NO; +} + +- (void)mouseEntered:(NSEvent *)theEvent +{} + +- (void)mouseExited:(NSEvent *)theEvent +{} + +- (void)pop +{} + +- (void)push +{} + +- (void)set +{} + +- (void)setOnMouseEntered:(BOOL)flag +{} + +- (void)setOnMouseExited:(BOOL)flag +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSCustomImageRep.m b/Source/NSCustomImageRep.m new file mode 100644 index 000000000..ee873adcf --- /dev/null +++ b/Source/NSCustomImageRep.m @@ -0,0 +1,85 @@ +/* + NSCustomImageRep.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSCustomImageRep + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSCustomImageRep class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// + +- (id)initWithDrawSelector:(SEL)aSelector + delegate:(id)anObject +{ + return nil; +} + +// +// Identifying the Object +// +- (id)delegate +{ + return nil; +} + +- (SEL)drawSelector +{ + return NULL; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSDPSContext.m b/Source/NSDPSContext.m new file mode 100644 index 000000000..6c8427c77 --- /dev/null +++ b/Source/NSDPSContext.m @@ -0,0 +1,344 @@ +/* + NSDPSContext.m + + Encapsulation of Display Postscript contexts + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include + +// +// DPS exceptions +// +NSString *DPSPostscriptErrorException; +NSString *DPSNameTooLongException; +NSString *DPSResultTagCheckException; +NSString *DPSResultTypeCheckException; +NSString *DPSInvalidContextException; +NSString *DPSSelectException; +NSString *DPSConnectionClosedException; +NSString *DPSReadException; +NSString *DPSWriteException; +NSString *DPSInvalidFDException; +NSString *DPSInvalidTEException; +NSString *DPSInvalidPortException; +NSString *DPSOutOfMemoryException; +NSString *DPSCantConnectException; + +// +// Class variables +// +NSMutableDictionary *GNU_CONTEXT_THREAD_DICT; +NSRecursiveLock *GNU_CONTEXT_LOCK; +BOOL GNU_CONTEXT_TRACED; +BOOL GNU_CONTEXT_SYNCHRONIZED; + +@implementation NSDPSContext + ++ (void)initialize +{ + if (self == [NSDPSContext class]) + { + // Set initial version + [self setVersion: 1]; + + // Allocate dictionary for maintaining + // mapping of threads to contexts + GNU_CONTEXT_THREAD_DICT = [NSMutableDictionary dictionary]; + // Create lock for serializing access to dictionary + GNU_CONTEXT_LOCK = [[NSRecursiveLock alloc] init]; + + GNU_CONTEXT_TRACED = NO; + GNU_CONTEXT_SYNCHRONIZED = NO; + } +} + +// +// Initializing a Context +// +- init +{ + NSMutableData *data = [NSMutableData data]; + + return [self initWithMutableData: data + forDebugging: NO + languageEncoding: NULL + nameEncoding: NULL + textProc: NULL + errorProc: NULL]; +} + +// Default initializer +- initWithMutableData:(NSMutableData *)data + forDebugging:(BOOL)debug + languageEncoding:(DPSProgramEncoding)langEnc + nameEncoding:(DPSNameEncoding)nameEnc + textProc:(DPSTextProc)tProc + errorProc:(DPSErrorProc)errorProc +{ + [super init]; + context_data = data; + is_screen_context = YES; + error_proc = errorProc; + text_proc = tProc; + chained_parent = nil; + chained_child = nil; + + return self; +} + +// +// Testing the Drawing Destination +// +- (BOOL)isDrawingToScreen +{ + return is_screen_context; +} + +// +// Accessing Context Data +// +- (NSMutableData *)mutableData +{ + return context_data; +} + +// +// Setting and Identifying the Current Context +// ++ (NSDPSContext *)currentContext +{ + NSThread *current_thread = [NSThread currentThread]; + NSDPSContext *current_context; + + // Get current context for current thread + [GNU_CONTEXT_LOCK lock]; + current_context = [GNU_CONTEXT_THREAD_DICT objectForKey: current_thread]; + + // If not in dictionary then create one + if (!current_context) + { + current_context = [[NSDPSContext alloc] init]; + [self setCurrentContext: current_context]; + } + [GNU_CONTEXT_LOCK unlock]; + + return current_context; +} + ++ (void)setCurrentContext:(NSDPSContext *)context +{ + NSThread *current_thread = [NSThread currentThread]; + + [GNU_CONTEXT_LOCK lock]; + + // If no context then remove from dictionary + if (!context) + [GNU_CONTEXT_THREAD_DICT removeObjectForKey: current_thread]; + else + [GNU_CONTEXT_THREAD_DICT setObject: context + forKey: current_thread]; + + [GNU_CONTEXT_LOCK unlock]; +} + +- (NSDPSContext *)DPSContext +{ + return self; +} + +// +// Controlling the Context +// +- (void)flush +{} + +- (void)interruptExecution +{} + +- (void)notifyObjectWhenFinishedExecuting:(id )obj +{} + +- (void)resetCommunication +{} + +- (void)wait +{} + +// +// Managing Returned Text and Errors +// ++ (NSString *)stringForDPSError:(const DPSBinObjSeqRec *)error +{ + return nil; +} + +- (DPSErrorProc)errorProc +{ + return error_proc; +} + +- (void)setErrorProc:(DPSErrorProc)proc +{ + error_proc = proc; +} + +- (void)setTextProc:(DPSTextProc)proc +{ + text_proc = proc; +} + +- (DPSTextProc)textProc +{ + return text_proc; +} + +// +// Sending Raw Data +// +- (void)printFormat:(NSString *)format,... +{} + +- (void)printFormat:(NSString *)format arguments:(va_list)argList +{} + +- (void)writeData:(NSData *)buf +{} + +- (void)writePostScriptWithLanguageEncodingConversion:(NSData *)buf +{} + +// +// Managing Binary Object Sequences +// +- (void)awaitReturnValues +{} + +- (void)writeBOSArray:(const void *)data + count:(unsigned int)items + ofType:(DPSDefinedType)type +{} + +- (void)writeBOSNumString:(const void *)data + length:(unsigned int)count + ofType:(DPSDefinedType)type + scale:(int)scale +{} + +- (void)writeBOSString:(const void *)data + length:(unsigned int)bytes +{} + +- (void)writeBinaryObjectSequence:(const void *)data + length:(unsigned int)bytes +{} + +- (void)updateNameMap +{} + +// +// Managing Chained Contexts +// +- (void)setParentContext:(NSDPSContext *)parent +{ + chained_parent = parent; +} + +- (void)chainChildContext:(NSDPSContext *)child +{ + if (child) + { + chained_child = child; + [child setParentContext: self]; + } +} + +- (NSDPSContext *)childContext +{ + return chained_child; +} + +- (NSDPSContext *)parentContext +{ + return chained_parent; +} + +- (void)unchainContext +{ + if (chained_child) + { + [chained_child setParentContext: nil]; + chained_child = nil; + } +} + +// +// Debugging Aids +// ++ (BOOL)areAllContextsOutputTraced +{ + return GNU_CONTEXT_TRACED; +} + ++ (BOOL)areAllContextsSynchronized +{ + return GNU_CONTEXT_SYNCHRONIZED; +} + ++ (void)setAllContextsOutputTraced:(BOOL)flag +{ + GNU_CONTEXT_TRACED = flag; +} + ++ (void)setAllContextsSynchronized:(BOOL)flag +{ + GNU_CONTEXT_SYNCHRONIZED = flag; +} + +- (BOOL)isOutputTraced +{ + return is_output_traced; +} + +- (BOOL)isSynchronized +{ + return is_synchronized; +} + +- (void)setOutputTraced:(BOOL)flag +{ + is_output_traced = flag; +} + +- (void)setSynchronized:(BOOL)flag +{ + is_synchronized = flag; +} + +@end diff --git a/Source/NSDataLink.m b/Source/NSDataLink.m new file mode 100644 index 000000000..9998c0566 --- /dev/null +++ b/Source/NSDataLink.m @@ -0,0 +1,203 @@ +/* + NSDataLink.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +// Global strings +NSString *NSDataLinkFileNameExtension = @"dlf"; + +@implementation NSDataLink + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSDataLink class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// +// Instance methods +// +// Initializing a Link +// +- (id)initLinkedToFile:(NSString *)filename +{ + return nil; +} + +- (id)initLinkedToSourceSelection:(NSSelection *)selection + managedBy:(NSDataLinkManager *)linkManager +supportingTypes:(NSArray *)newTypes +{ + return nil; +} + +- (id)initWithContentsOfFile:(NSString *)filename +{ + return nil; +} + +- (id)initWithPasteboard:(NSPasteboard *)pasteboard +{ + return nil; +} + +// +// Exporting a Link +// +- (BOOL)saveLinkIn:(NSString *)directoryName +{ + return NO; +} + +- (BOOL)writeToFile:(NSString *)filename +{ + return NO; +} + +- (void)writeToPasteboard:(NSPasteboard *)pasteboard +{} + +// +// Information about the Link +// +- (NSDataLinkDisposition)disposition +{ + return 0; +} + +- (NSDataLinkNumber)linkNumber +{ + return 0; +} + +- (NSDataLinkManager *)manager +{ + return nil; +} + +// +// Information about the Link's Source +// +- (NSDate *)lastUpdateTime +{ + return nil; +} + +- (BOOL)openSource +{ + return NO; +} + +- (NSString *)sourceApplicationName +{ + return nil; +} + +- (NSString *)sourceFilename +{ + return nil; +} + +- (NSSelection *)sourceSelection +{ + return nil; +} + +- (NSArray *)types +{ + return nil; +} + +// +// Information about the Link's Destination +// +- (NSString *)destinationApplicationName +{ + return nil; +} + +- (NSString *)destinationFilename +{ + return nil; +} + +- (NSSelection *)destinationSelection +{ + return nil; +} + +// +// Changing the Link +// +- (BOOL)break +{ + return NO; +} + +- (void)noteSourceEdited +{} + +- (void)setUpdateMode:(NSDataLinkUpdateMode)mode +{} + +- (BOOL)updateDestination +{ + return NO; +} + +- (NSDataLinkUpdateMode)updateMode +{ + return 0; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSDataLinkManager.m b/Source/NSDataLinkManager.m new file mode 100644 index 000000000..b4b902b45 --- /dev/null +++ b/Source/NSDataLinkManager.m @@ -0,0 +1,252 @@ +/* + NSDataLinkManager.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSDataLinkManager + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSDataLinkManager class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// +// +// Initializing and Freeing a Link Manager +// +- (id)initWithDelegate:(id)anObject +{ + return nil; +} + +- (id)initWithDelegate:(id)anObject + fromFile:(NSString *)path +{ + return nil; +} + +// +// Adding and Removing Links +// +- (BOOL)addLink:(NSDataLink *)link + at:(NSSelection *)selection +{ + return NO; +} + +- (BOOL)addLinkAsMarker:(NSDataLink *)link + at:(NSSelection *)selection +{ + return NO; +} + +- (NSDataLink *)addLinkPreviouslyAt:(NSSelection *)oldSelection + fromPasteboard:(NSPasteboard *)pasteboard +at:(NSSelection *)selection +{ + return nil; +} + +- (void)breakAllLinks +{} + +- (void)writeLinksToPasteboard:(NSPasteboard *)pasteboard +{} + +// +// Informing the Link Manager of Document Status +// +- (void)noteDocumentClosed +{} + +- (void)noteDocumentEdited +{} + +- (void)noteDocumentReverted +{} + +- (void)noteDocumentSaved +{} + +- (void)noteDocumentSavedAs:(NSString *)path +{} + +- (void)noteDocumentSavedTo:(NSString *)path +{} + +// +// Getting and Setting Information about the Link Manager +// +- (id)delegate +{ + return nil; +} + +- (BOOL)delegateVerifiesLinks +{ + return NO; +} + +- (NSString *)filename +{ + return nil; +} + +- (BOOL)interactsWithUser +{ + return NO; +} + +- (BOOL)isEdited +{ + return NO; +} + +- (void)setDelegateVerifiesLinks:(BOOL)flag +{} + +- (void)setInteractsWithUser:(BOOL)flag +{} + +// +// Getting and Setting Information about the Manager's Links +// +- (BOOL)areLinkOutlinesVisible +{ + return NO; +} + +- (NSEnumerator *)destinationLinkEnumerator +{ + return nil; +} + +- (NSDataLink *)destinationLinkWithSelection:(NSSelection *)destSel +{ + return nil; +} + +- (void)setLinkOutlinesVisible:(BOOL)flag +{} + +- (NSEnumerator *)sourceLinkEnumerator +{ + return nil; +} + +// +// Methods Implemented by the Delegate +// +- (BOOL)copyToPasteboard:(NSPasteboard *)pasteboard + at:(NSSelection *)selection +cheapCopyAllowed:(BOOL)flag +{ + return NO; +} + +- (void)dataLinkManager:(NSDataLinkManager *)sender + didBreakLink:(NSDataLink *)link +{} + +- (BOOL)dataLinkManager:(NSDataLinkManager *)sender + isUpdateNeededForLink:(NSDataLink *)link +{ + return NO; +} + +- (void)dataLinkManager:(NSDataLinkManager *)sender + startTrackingLink:(NSDataLink *)link +{} + +- (void)dataLinkManager:(NSDataLinkManager *)sender + stopTrackingLink:(NSDataLink *)link +{} + +- (void)dataLinkManagerCloseDocument:(NSDataLinkManager *)sender +{} + +- (void)dataLinkManagerDidEditLinks:(NSDataLinkManager *)sender +{} + +- (void)dataLinkManagerRedrawLinkOutlines:(NSDataLinkManager *)sender +{} + +- (BOOL)dataLinkManagerTracksLinksIndividually:(NSDataLinkManager *)sender +{ + return NO; +} + +- (BOOL)importFile:(NSString *)filename + at:(NSSelection *)selection +{ + return NO; +} + +- (BOOL)pasteFromPasteboard:(NSPasteboard *)pasteboard + at:(NSSelection *)selection +{ + return NO; +} + +- (BOOL)showSelection:(NSSelection *)selection +{ + return NO; +} + +- (NSWindow *)windowForSelection:(NSSelection *)selection +{ + return nil; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSDataLinkPanel.m b/Source/NSDataLinkPanel.m new file mode 100644 index 000000000..f0f062da7 --- /dev/null +++ b/Source/NSDataLinkPanel.m @@ -0,0 +1,129 @@ +/* + NSDataLinkPanel.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSDataLinkPanel + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSDataLinkPanel class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Initializing +// ++ (NSDataLinkPanel *)sharedDataLinkPanel +{ + return nil; +} + +// +// Keeping the Panel Up to Date +// ++ (void)getLink:(NSDataLink **)link + manager:(NSDataLinkManager **)linkManager +isMultiple:(BOOL *)flag +{} + ++ (void)setLink:(NSDataLink *)link + manager:(NSDataLinkManager *)linkManager +isMultiple:(BOOL)flag +{} + +// +// Instance methods +// + +// +// Keeping the Panel Up to Date +// +- (void)getLink:(NSDataLink **)link + manager:(NSDataLinkManager **)linkManager +isMultiple:(BOOL *)flag +{} + +- (void)setLink:(NSDataLink *)link + manager:(NSDataLinkManager *)linkManager +isMultiple:(BOOL)flag +{} + +// +// Customizing the Panel +// +- (NSView *)accessoryView +{ + return nil; +} + +- (void)setAccessoryView:(NSView *)aView +{} + +// +// Responding to User Input +// +- (void)pickedBreakAllLinks:(id)sender +{} + +- (void)pickedBreakLink:(id)sender +{} + +- (void)pickedOpenSource:(id)sender +{} + +- (void)pickedUpdateDestination:(id)sender +{} + +- (void)pickedUpdateMode:(id)sender +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSEPSImageRep.m b/Source/NSEPSImageRep.m new file mode 100644 index 000000000..cb595f30e --- /dev/null +++ b/Source/NSEPSImageRep.m @@ -0,0 +1,100 @@ +/* + NSEPSImageRep.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSEPSImageRep + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSEPSImageRep class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Initializing a New Instance +// ++ (id)imageRepWithData:(NSData *)epsData +{ + return nil; +} + +// +// Instance methods +// +// +// Initializing a New Instance +// +- (id)initWithData:(NSData *)epsData +{ + return nil; +} + +// +// Getting Image Data +// +- (NSRect)boundingBox +{ + return NSZeroRect; +} + +- (NSData *)EPSRepresentation +{ + return nil; +} + +// +// Drawing the Image +// +- (void)prepareGState +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSEvent.m b/Source/NSEvent.m new file mode 100644 index 000000000..46236aaa8 --- /dev/null +++ b/Source/NSEvent.m @@ -0,0 +1,585 @@ +/* + NSEvent.m + + The event class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +@implementation NSEvent + +// +// Private methods +// +- (void)setType:(NSEventType)type +{ + event_type = type; +} + +- (void)setLocation:(NSPoint)location +{ + location_point = location; +} + +- (void)setFlags:(unsigned int)flags +{ + modifier_flags = flags; +} + +- (void)setTime:(NSTimeInterval)time +{ + event_time = time; +} + +- (void)setWindowNum:(int)windowNum +{ + window_num = windowNum; +} + +- (void)setContext:(NSDPSContext *)context +{ + event_context = context; +} + +- (void)setMouseEventNumber:(int)eventNum +{ + event_data.mouse.event_num = eventNum; +} + +- (void)setMouseClick:(int)clickNum +{ + event_data.mouse.click = clickNum; +} + +- (void)setPressure:(float)pressureValue +{ + event_data.mouse.pressure = pressureValue; +} + +- (void)setTrackingEventNumber:(int)eventNum +{ + event_data.tracking.event_num = eventNum; +} + +- (void)setTrackingNumber:(int)trackingNum +{ + event_data.tracking.tracking_num = trackingNum; +} + +- (void)setUserData:(void *)userData +{ + event_data.tracking.user_data = userData; +} + +- (void)setRepeat:(BOOL)repeat +{ + event_data.key.repeat = repeat; +} + +- (void)setCharacters:(NSString *)keys +{ + event_data.key.char_keys = keys; + [event_data.key.char_keys retain]; +} + +- (void)setUnmodifiedCharacters:(NSString *)ukeys +{ + event_data.key.unmodified_keys = ukeys; + [event_data.key.unmodified_keys retain]; +} + +- (void)setKeyCode:(unsigned short)code +{ + event_data.key.key_code = code; +} + +- (void)setSubType:(short)subType +{ + event_data.misc.sub_type = subType; +} + +- (void)setData1:(int)data1 +{ + event_data.misc.data1 = data1; +} + +- (void)setData2:(int)data2 +{ + event_data.misc.data2 = data2; +} + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSEvent class]) + { + NSLog(@"Initialize NSEvent class\n"); + + // Initial version + [self setVersion:1]; + } +} + +// +// Creating NSEvent objects +// ++ (NSEvent *)enterExitEventWithType:(NSEventType)type + location:(NSPoint)location + modifierFlags:(unsigned int)flags + timestamp:(NSTimeInterval)time + windowNumber:(int)windowNum + context:(NSDPSContext *)context + eventNumber:(int)eventNum + trackingNumber:(int)trackingNum + userData:(void *)userData +{ + NSEvent *e; + + e = [[[NSEvent alloc] init] autorelease]; + + // Make sure it is one of the right event types + if ((type != NSMouseEntered) && (type != NSMouseExited)) + return nil; + + // Set the event fields + [e setType:type]; + [e setLocation:location]; + [e setFlags:flags]; + [e setTime:time]; + [e setWindowNum:windowNum]; + [e setContext:context]; + [e setTrackingEventNumber:eventNum]; + [e setTrackingNumber:trackingNum]; + [e setUserData:userData]; + + return e; +} + ++ (NSEvent *)keyEventWithType:(NSEventType)type + location:(NSPoint)location + modifierFlags:(unsigned int)flags + timestamp:(NSTimeInterval)time + windowNumber:(int)windowNum + context:(NSDPSContext *)context + characters:(NSString *)keys + charactersIgnoringModifiers:(NSString *)ukeys + isARepeat:(BOOL)repeatKey + keyCode:(unsigned short)code +{ + NSEvent *e; + + e = [[[NSEvent alloc] init] autorelease]; + + // Make sure it is one of the right event types + if ((type != NSKeyDown) && (type != NSKeyUp)) + return nil; + + // Set the event fields + [e setType:type]; + [e setLocation:location]; + [e setFlags:flags]; + [e setTime:time]; + [e setWindowNum:windowNum]; + [e setContext:context]; + [e setCharacters:keys]; + [e setUnmodifiedCharacters:ukeys]; + [e setRepeat:repeatKey]; + [e setKeyCode:code]; + + return e; +} + ++ (NSEvent *)mouseEventWithType:(NSEventType)type + location:(NSPoint)location + modifierFlags:(unsigned int)flags + timestamp:(NSTimeInterval)time + windowNumber:(int)windowNum + context:(NSDPSContext *)context + eventNumber:(int)eventNum + clickCount:(int)clickNum + pressure:(float)pressureValue +{ + NSEvent *e; + + e = [[[NSEvent alloc] init] autorelease]; + + // Make sure it is one of the right event types + if ((type != NSLeftMouseDown) && (type != NSLeftMouseUp) && + (type != NSRightMouseDown) && (type != NSRightMouseUp) && + (type != NSLeftMouseDragged) && (type != NSRightMouseDragged) && + (type != NSMouseMoved)) + return nil; + + // Set the event fields + [e setType:type]; + [e setLocation:location]; + [e setFlags:flags]; + [e setTime:time]; + [e setWindowNum:windowNum]; + [e setContext:context]; + [e setMouseEventNumber:eventNum]; + [e setMouseClick:clickNum]; + [e setPressure:pressureValue]; + + return e; +} + ++ (NSEvent *)otherEventWithType:(NSEventType)type + location:(NSPoint)location + modifierFlags:(unsigned int)flags + timestamp:(NSTimeInterval)time + windowNumber:(int)windowNum + context:(NSDPSContext *)context + subtype:(short)subType + data1:(int)data1 + data2:(int)data2 +{ + NSEvent *e; + + e = [[[NSEvent alloc] init] autorelease]; + + // Make sure it is one of the right event types + if ((type != NSFlagsChanged) && (type != NSCursorUpdate) && + (type != NSPeriodic)) + return nil; + + // Set the event fields + [e setType:type]; + [e setLocation:location]; + [e setFlags:flags]; + [e setTime:time]; + [e setWindowNum:windowNum]; + [e setContext:context]; + [e setSubType:subType]; + [e setData1:data1]; + [e setData2:data2]; + + return e; +} + +// +// Requesting Periodic Events +// ++ (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySeconds + withPeriod:(NSTimeInterval)periodSeconds +{} + ++ (void)stopPeriodicEvents +{} + +// +// Instance methods +// +- (void)dealloc +{ + if ((event_type == NSKeyUp) || (event_type == NSKeyDown)) + { + [event_data.key.char_keys release]; + [event_data.key.unmodified_keys release]; + } + [super dealloc]; +} + +// +// Getting General Event Information +// +- (NSDPSContext *)context +{ + return event_context; +} + +- (NSPoint)locationInWindow +{ + return location_point; +} + +- (unsigned int)modifierFlags +{ + return modifier_flags; +} + +- (NSTimeInterval)timestamp +{ + return event_time; +} + +- (NSEventType)type +{ + return event_type; +} + +- (NSWindow *)window +{ + NSApplication *theApp = [NSApplication sharedApplication]; + + return [theApp windowWithWindowNumber:window_num]; +} + +- (int)windowNumber +{ + return window_num; +} + +// +// Getting Key Event Information +// +- (NSString *)characters +{ + if ((event_type != NSKeyUp) && (event_type != NSKeyDown)) + return nil; + + return event_data.key.char_keys; +} + +- (NSString *)charactersIgnoringModifiers +{ + if ((event_type != NSKeyUp) && (event_type != NSKeyDown)) + return nil; + + return event_data.key.unmodified_keys; +} + +- (BOOL)isARepeat +{ + if ((event_type != NSKeyUp) && (event_type != NSKeyDown)) + return NO; + + return event_data.key.repeat; +} + +- (unsigned short)keyCode +{ + if ((event_type != NSKeyUp) && (event_type != NSKeyDown)) + return 0; + + return event_data.key.key_code; +} + +// +// Getting Mouse Event Information +// +- (int)clickCount +{ + // Make sure it is one of the right event types + if ((event_type != NSLeftMouseDown) && (event_type != NSLeftMouseUp) && + (event_type != NSRightMouseDown) && (event_type != NSRightMouseUp) && + (event_type != NSLeftMouseDragged) && (event_type != NSRightMouseDragged) && + (event_type != NSMouseMoved)) + return 0; + + return event_data.mouse.click; +} + +- (int)eventNumber +{ + // Make sure it is one of the right event types + if ((event_type != NSLeftMouseDown) && (event_type != NSLeftMouseUp) && + (event_type != NSRightMouseDown) && (event_type != NSRightMouseUp) && + (event_type != NSLeftMouseDragged) && (event_type != NSRightMouseDragged) && + (event_type != NSMouseMoved) && + (event_type != NSMouseEntered) && (event_type != NSMouseExited)) + return 0; + + if ((event_type == NSMouseEntered) || (event_type == NSMouseExited)) + return event_data.tracking.event_num; + else + return event_data.mouse.event_num; +} + +- (float)pressure +{ + // Make sure it is one of the right event types + if ((event_type != NSLeftMouseDown) && (event_type != NSLeftMouseUp) && + (event_type != NSRightMouseDown) && (event_type != NSRightMouseUp) && + (event_type != NSLeftMouseDragged) && (event_type != NSRightMouseDragged) && + (event_type != NSMouseMoved)) + return 0; + + return event_data.mouse.pressure; +} + +// +// Getting Tracking Event Information +// +- (int)trackingNumber +{ + if ((event_type != NSMouseEntered) && (event_type != NSMouseExited)) + return 0; + + return event_data.tracking.tracking_num; +} + +- (void *)userData +{ + if ((event_type != NSMouseEntered) && (event_type != NSMouseExited)) + return NULL; + + return event_data.tracking.user_data; +} + +// +// Getting Information about Specially Defined Events +// +- (int)data1 +{ + // Make sure it is one of the right event types + if ((event_type != NSFlagsChanged) && (event_type != NSCursorUpdate) && + (event_type != NSPeriodic)) + return 0; + + return event_data.misc.data1; +} + +- (int)data2 +{ + // Make sure it is one of the right event types + if ((event_type != NSFlagsChanged) && (event_type != NSCursorUpdate) && + (event_type != NSPeriodic)) + return 0; + + return event_data.misc.data2; +} + +- (short)subtype +{ + // Make sure it is one of the right event types + if ((event_type != NSFlagsChanged) && (event_type != NSCursorUpdate) && + (event_type != NSPeriodic)) + return 0; + + return event_data.misc.sub_type;; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeValueOfObjCType: @encode(NSEventType) at: &event_type]; + [aCoder encodePoint: location_point]; + [aCoder encodeValueOfObjCType: "I" at: &modifier_flags]; + [aCoder encodeValueOfObjCType: @encode(NSTimeInterval) at: &event_time]; + [aCoder encodeValueOfObjCType: "i" at: &window_num]; + // We don't want to encode the context, right? + // DPSContext doesn't conform to NSCoding + //[aCoder encodeObjectReference: event_context withName: @"Context"]; + + // Encode the event date based upon the event type + switch (event_type) + { + case NSLeftMouseDown: + case NSLeftMouseUp: + case NSRightMouseDown: + case NSRightMouseUp: + case NSMouseMoved: + case NSLeftMouseDragged: + case NSRightMouseDragged: + [aCoder encodeValuesOfObjCTypes: "iif", &event_data.mouse.event_num, + &event_data.mouse.click, &event_data.mouse.pressure]; + break; + + case NSMouseEntered: + case NSMouseExited: + // Can't do anything with the user_data!? + [aCoder encodeValuesOfObjCTypes: "ii", &event_data.tracking.event_num, + &event_data.tracking.tracking_num]; + break; + + case NSKeyDown: + case NSKeyUp: + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &event_data.key.repeat]; + [aCoder encodeObject: event_data.key.char_keys]; + [aCoder encodeObject: event_data.key.unmodified_keys]; + [aCoder encodeValueOfObjCType: "S" at: &event_data.key.key_code]; + break; + + case NSFlagsChanged: + case NSPeriodic: + case NSCursorUpdate: + [aCoder encodeValuesOfObjCTypes: "sii", &event_data.misc.sub_type, + &event_data.misc.data1, &event_data.misc.data2]; + break; + } +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + [aDecoder decodeValueOfObjCType: @encode(NSEventType) at: &event_type]; + location_point = [aDecoder decodePoint]; + [aDecoder decodeValueOfObjCType: "I" at: &modifier_flags]; + [aDecoder decodeValueOfObjCType: @encode(NSTimeInterval) at: &event_time]; + [aDecoder decodeValueOfObjCType: "i" at: &window_num]; + + // Decode the event date based upon the event type + switch (event_type) + { + case NSLeftMouseDown: + case NSLeftMouseUp: + case NSRightMouseDown: + case NSRightMouseUp: + case NSMouseMoved: + case NSLeftMouseDragged: + case NSRightMouseDragged: + [aDecoder decodeValuesOfObjCTypes: "iif", &event_data.mouse.event_num, + &event_data.mouse.click, &event_data.mouse.pressure]; + break; + + case NSMouseEntered: + case NSMouseExited: + // Can't do anything with the user_data!? + [aDecoder decodeValuesOfObjCTypes: "ii", &event_data.tracking.event_num, + &event_data.tracking.tracking_num]; + break; + + case NSKeyDown: + case NSKeyUp: + [aDecoder decodeValueOfObjCType: @encode(BOOL) + at: &event_data.key.repeat]; + event_data.key.char_keys = [aDecoder decodeObject]; + event_data.key.unmodified_keys = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: "S" at: &event_data.key.key_code]; + break; + + case NSFlagsChanged: + case NSPeriodic: + case NSCursorUpdate: + [aDecoder decodeValuesOfObjCTypes: "sii", &event_data.misc.sub_type, + &event_data.misc.data1, &event_data.misc.data2]; + break; + } + + return self; +} + +@end diff --git a/Source/NSFont.m b/Source/NSFont.m new file mode 100644 index 000000000..e4fe0a169 --- /dev/null +++ b/Source/NSFont.m @@ -0,0 +1,294 @@ +/* + NSFont.m + + The font class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +NSFont *MB_USER_FIXED_FONT; +NSFont *MB_USER_FONT; + +// Global Strings +NSString *NSAFMAscender; +NSString *NSAFMCapHeight; +NSString *NSAFMCharacterSet; +NSString *NSAFMDescender; +NSString *NSAFMEncodingScheme; +NSString *NSAFMFamilyName; +NSString *NSAFMFontName; +NSString *NSAFMFormatVersion; +NSString *NSAFMFullName; +NSString *NSAFMItalicAngle; +NSString *NSAFMMappingScheme; +NSString *NSAFMNotice; +NSString *NSAFMUnderlinePosition; +NSString *NSAFMUnderlineThickness; +NSString *NSAFMVersion; +NSString *NSAFMWeight; +NSString *NSAFMXHeight; + +@implementation NSFont + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSFont class]) + { + NSLog(@"Initialize NSFont class\n"); + + // Initial version + [self setVersion:1]; + } +} + +// +// Creating a Font Object +// ++ (NSFont *)boldSystemFontOfSize:(float)fontSize +{ + NSFontManager *fm = [NSFontManager sharedFontManager]; + NSFont *f; + + f = [fm fontWithFamily:@"Times New Roman" traits:NSBoldFontMask + weight:0 size:fontSize]; + return f; +} + ++ (NSFont *)fontWithName:(NSString *)fontName + matrix:(const float *)fontMatrix +{ + return nil; +} + ++ (NSFont *)fontWithName:(NSString *)fontName + size:(float)fontSize +{ + NSFontManager *fm = [NSFontManager sharedFontManager]; + NSFont *f; + + f = [fm fontWithFamily:fontName traits:0 weight:0 size:fontSize]; + return f; +} + ++ (NSFont *)systemFontOfSize:(float)fontSize +{ + NSFontManager *fm = [NSFontManager sharedFontManager]; + NSFont *f; + + f = [fm fontWithFamily:@"Times New Roman" traits:0 weight:0 size:fontSize]; + return f; +} + ++ (NSFont *)userFixedPitchFontOfSize:(float)fontSize +{ + NSFontManager *fm = [NSFontManager sharedFontManager]; + return [fm convertFont:MB_USER_FIXED_FONT toSize:fontSize]; +} + ++ (NSFont *)userFontOfSize:(float)fontSize +{ + NSFontManager *fm = [NSFontManager sharedFontManager]; + return [fm convertFont:MB_USER_FONT toSize:fontSize]; +} + +// +// Setting the Font +// ++ (void)setUserFixedPitchFont:(NSFont *)aFont +{ + MB_USER_FIXED_FONT = aFont; +} + ++ (void)setUserFont:(NSFont *)aFont +{ + MB_USER_FONT = aFont; +} + ++ (void)useFont:(NSString *)fontName +{} + +// +// Instance methods +// +- (void)dealloc +{ + [super dealloc]; +} + +// +// Setting the Font +// +- (void)set +{ +} + +// +// Querying the Font +// +- (NSDictionary *)afmDictionary +{ + return nil; +} + +- (NSString *)afmFileContents +{ + return nil; +} + +- (NSRect)boundingRectForFont +{ + return NSZeroRect; +} + +- (NSString *)displayName +{ + return nil; +} + +- (NSString *)familyName +{ + return family_name; +} + +- (void)setFamilyName:(NSString *)familyName +{ + family_name = familyName; +} + +- (NSString *)fontName +{ + return font_name; +} + +- (BOOL)isBaseFont +{ + return NO; +} + +- (const float *)matrix +{ + return NULL; +} + +- (float)pointSize +{ + return point_size; +} + +- (void)setPointSize:(float)value +{ + point_size = value; +} + +- (NSFont *)printerFont +{ + return nil; +} + +- (NSFont *)screenFont +{ + return nil; +} + +- (float)widthOfString:(NSString *)string +{ + /* bogus estimate */ + if (string) + return (8.0 * (float)[string length]); + else + return 0; +} + +- (float *)widths +{ + return NULL; +} +- (NSFontTraitMask)traits +{ + return font_traits; +} + +- (void)setTraits:(NSFontTraitMask)traits +{ + font_traits = traits; +} + +// +// Manipulating Glyphs +// +- (NSSize)advancementForGlyph:(NSGlyph)aGlyph +{ + return NSZeroSize; +} + +- (NSRect)boundingRectForGlyph:(NSGlyph)aGlyph +{ + return NSZeroRect; +} + +- (BOOL)glyphIsEncoded:(NSGlyph)aGlyph +{ + return NO; +} + +- (NSPoint)positionOfGlyph:(NSGlyph)curGlyph + precededByGlyph:(NSGlyph)prevGlyph + isNominal:(BOOL *)nominal +{ + return NSZeroPoint; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: family_name]; + [aCoder encodeObject: font_name]; + [aCoder encodeValueOfObjCType: "f" at: &point_size]; + [aCoder encodeValueOfObjCType: @encode(NSFontTraitMask) at: &font_traits]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + family_name = [aDecoder decodeObject]; + font_name = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: "f" at: &point_size]; + [aDecoder decodeValueOfObjCType: @encode(NSFontTraitMask) at: &font_traits]; + + return self; +} + +@end diff --git a/Source/NSFontManager.m b/Source/NSFontManager.m new file mode 100644 index 000000000..21bdd47bd --- /dev/null +++ b/Source/NSFontManager.m @@ -0,0 +1,338 @@ +/* + NSFontManager.m + + Manages system and user fonts + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +// +// Class variables +// +NSFontManager *MB_THE_FONT_MANAGER; +NSFontPanel *MB_THE_FONT_PANEL; +id MB_THE_FONT_MANAGER_FACTORY; +id MB_THE_FONT_PANEL_FACTORY; + +@implementation NSFontManager + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSFontManager class]) + { + NSLog(@"Initialize NSFontManager class\n"); + + // Initial version + [self setVersion:1]; + + // Set the factories + [self setFontManagerFactory:[NSFontManager class]]; + [self setFontPanelFactory:[NSFontManager class]]; + } +} + +// +// Managing the FontManager +// ++ (void)setFontManagerFactory:(Class)classId +{ + MB_THE_FONT_MANAGER_FACTORY = classId; +} + ++ (void)setFontPanelFactory:(Class)classId +{ + MB_THE_FONT_PANEL_FACTORY = classId; +} + ++ (NSFontManager *)sharedFontManager +{ + if (!MB_THE_FONT_MANAGER) + MB_THE_FONT_MANAGER = [[NSFontManager alloc] init]; + [MB_THE_FONT_MANAGER enumerateFamilies]; + return MB_THE_FONT_MANAGER; +} + +// +// Instance methods +// +- init +{ + [super init]; + + // Allocate the font list + font_list = [NSMutableArray array]; + + return self; +} + +- (void)enumerateFamilies +{ + if (!family_list) + { + // Allocate the family list + family_list = [NSMutableArray array]; + family_metrics = [NSMutableArray array]; + + // Enumerate the available font families + } +} + +// +// Converting Fonts +// +- (NSFont *)convertFont:(NSFont *)fontObject +{ + return fontObject; +} + +- (NSFont *)convertFont:(NSFont *)fontObject + toFamily:(NSString *)family +{ + if ([family compare:[fontObject familyName]] == NSOrderedSame) + { + // If already of that family then just return it + return fontObject; + } + else + { + // Else convert it + NSFont *f = [fontObject mutableCopy]; + [f setFamilyName:family]; + return f; + } +} + +- (NSFont *)convertFont:(NSFont *)fontObject + toFace:(NSString *)typeface +{ + return fontObject; +} + +- (NSFont *)convertFont:(NSFont *)fontObject + toHaveTrait:(NSFontTraitMask)trait +{ + NSFontTraitMask t = [fontObject traits]; + + if (t & trait) + { + // If already have that trait then just return it + return fontObject; + } + else + { + // Else convert it + NSFont *f = [fontObject mutableCopy]; + t = t | trait; + [f setTraits:t]; + return f; + } +} + +- (NSFont *)convertFont:(NSFont *)fontObject + toNotHaveTrait:(NSFontTraitMask)trait +{ + NSFontTraitMask t = [fontObject traits]; + + if (!(t & trait)) + { + // If already do not have that trait then just return it + return fontObject; + } + else + { + // Else convert it + NSFont *f = [fontObject mutableCopy]; + t = t ^ trait; + [f setTraits:t]; + return f; + } +} + +- (NSFont *)convertFont:(NSFont *)fontObject + toSize:(float)size +{ + if ([fontObject pointSize] == size) + { + // If already that size then just return it + return fontObject; + } + else + { + // Else convert it + NSFont *f = [fontObject mutableCopy]; + [f setPointSize:size]; + return f; + } +} + +- (NSFont *)convertWeight:(BOOL)upFlag + ofFont:(NSFont *)fontObject +{ + return fontObject; +} + +- (NSFont *)fontWithFamily:(NSString *)family + traits:(NSFontTraitMask)traits +weight:(int)weight + size:(float)size +{ + int i, j; + BOOL found = NO; + NSString *name; + NSFont *f; + + j = [family_list count]; + for (i = 0;i < j; ++i) + { + name = [family_list objectAtIndex:i]; + if ([family compare:name] == NSOrderedSame) + { + found = YES; + break; + } + } + + if (found) + { + f = [[NSFont alloc] init]; + [f setFamilyName:family]; + [f setTraits:traits]; + [f setPointSize:size]; + return f; + } + else + return nil; +} + +// +// Setting and Getting Parameters +// +- (SEL)action +{ + return action; +} + +- (NSArray *)availableFonts +{ + return family_list; +} + +- (NSArray *)familyMetrics; +{ + return family_metrics; +} + +- (NSMenu *)fontMenu:(BOOL)create +{ + return font_menu; +} + +- (NSFontPanel *)fontPanel:(BOOL)create +{ + if ((!MB_THE_FONT_PANEL) && (create)) + MB_THE_FONT_PANEL = [[NSFontPanel alloc] init]; + return MB_THE_FONT_PANEL; +} + +- (BOOL)isEnabled +{ + return NO; +} + +- (BOOL)isMultiple +{ + return NO; +} + +- (NSFont *)selectedFont +{ + return nil; +} + +- (void)setAction:(SEL)aSelector +{ + action = aSelector; +} + +- (void)setEnabled:(BOOL)flag +{} + +- (void)setFontMenu:(NSMenu *)newMenu +{} + +- (void)setSelectedFont:(NSFont *)fontObject + isMultiple:(BOOL)flag +{ + selected_font = fontObject; +} + +- (NSFontTraitMask)traitsOfFont:(NSFont *)fontObject +{ + return 0; +} + +- (int)weightOfFont:(NSFont *)fontObject +{ +} + +// +// Target and Action Methods +// +- (BOOL)sendAction +{ + return NO; +} + +// +// Assigning a Delegate +// +- (id)delegate +{ + return delegate; +} + +- (void)setDelegate:(id)anObject +{ + delegate = anObject; +} + +// +// Methods Implemented by the Delegate +// +- (BOOL)fontManager:(id)sender willIncludeFont:(NSString *)fontName +{ + if ([delegate respondsToSelector:@selector(fontManager:willIncludeFont:)]) + return [delegate fontManager:self willIncludeFont:fontName]; + else + return YES; +} + +@end diff --git a/Source/NSFontPanel.m b/Source/NSFontPanel.m new file mode 100644 index 000000000..c33a75970 --- /dev/null +++ b/Source/NSFontPanel.m @@ -0,0 +1,135 @@ +/* + NSFontPanel.m + + System generic panel for selecting and previewing fonts + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include + +@implementation NSFontPanel + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSFontPanel class]) + { + NSLog(@"Initialize NSFontPanel class\n"); + + // Initial version + [self setVersion:1]; + } +} + +// +// Creating an NSFontPanel +// ++ (NSFontPanel *)sharedFontPanel +{ + NSFontManager *fm = [NSFontManager sharedFontManager]; + + return [fm fontPanel:YES]; +} + +// +// Instance methods +// +// +// Creating an NSFontPanel +// +- (NSFont *)panelConvertFont:(NSFont *)fontObject +{ + return panel_font; +} + +// +// Setting the Font +// +- (void)setPanelFont:(NSFont *)fontObject + isMultiple:(BOOL)flag +{ + panel_font = fontObject; +} + +// +// Configuring the NSFontPanel +// +- (NSView *)accessoryView +{ + return nil; +} + +- (BOOL)isEnabled +{ + return NO; +} + +- (void)setAccessoryView:(NSView *)aView +{} + +- (void)setEnabled:(BOOL)flag +{} + +- (BOOL)worksWhenModal +{ + return NO; +} + +// +// Displaying the NSFontPanel +// +- (void)orderWindow:(NSWindowOrderingMode)place + relativeTo:(int)otherWindows +{} + +- (void)display +{ +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: panel_font]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + panel_font = [aDecoder decodeObject]; + + return self; +} + +@end diff --git a/Source/NSForm.m b/Source/NSForm.m new file mode 100644 index 000000000..de380b3a3 --- /dev/null +++ b/Source/NSForm.m @@ -0,0 +1,141 @@ +/* + NSForm.m + + Form class, a text field with a label + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSForm + +// +// Laying Out the Form +// +- (NSFormCell *)addEntry:(NSString *)title +{ + return nil; +} + +- (NSFormCell *)insertEntry:(NSString *)title + atIndex:(int)index +{ + return nil; +} + +- (void)removeEntryAtIndex:(int)index +{} + +- (void)setInterlineSpacing:(float)spacing +{} + +// +// Finding Indices +// +- (int)indexOfCellWithTag:(int)aTag +{ + return 0; +} + +- (int)indexOfSelectedItem +{ + return 0; +} + +// +// Modifying Graphic Attributes +// +- (void)setBezeled:(BOOL)flag +{} + +- (void)setBordered:(BOOL)flag +{} + +- (void)setTextAlignment:(int)mode +{} + +- (void)setTextFont:(NSFont *)fontObject +{} + +- (void)setTitleAlignment:(NSTextAlignment)mode +{} + +- (void)setTitleFont:(NSFont *)fontObject +{} + +// +// Setting the Cell Class +// ++ (Class)cellClass +{ + return nil; +} + ++ (void)setCellClass:(Class)classId +{} + +// +// Getting a Cell +// +- (id)cellAtIndex:(int)index +{ + return nil; +} + +// +// Displaying a Cell +// +- (void)drawCellAtIndex:(int)index +{} + +// +// Editing Text +// +- (void)selectTextAtIndex:(int)index +{} + +// +// Resizing the Form +// +- (void)setEntryWidth:(float)width +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSFormCell.m b/Source/NSFormCell.m new file mode 100644 index 000000000..c87cbf0c7 --- /dev/null +++ b/Source/NSFormCell.m @@ -0,0 +1,121 @@ +/* + NSFormCell.m + + The cell class for the NSForm control + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSFormCell + +// +// Initializing an NSFormCell +// +- (id)initTextCell:(NSString *)aString +{ + return nil; +} + +// +// Determining an NSFormCell's Size +// +- (NSSize)cellSizeForBounds:(NSRect)aRect +{ + return NSZeroSize; +} + +// +// Determining Graphic Attributes +// +- (BOOL)isOpaque +{ + return NO; +} + +// +// Modifying the Title +// +- (void)setTitle:(NSString *)aString +{} + +- (void)setTitleAlignment:(NSTextAlignment)mode +{} + +- (void)setTitleFont:(NSFont *)fontObject +{} + +- (void)setTitleWidth:(float)width +{} + +- (NSString *)title +{ + return nil; +} + +- (NSTextAlignment)titleAlignment +{ + return 0; +} + +- (NSFont *)titleFont +{ + return nil; +} + +- (float)titleWidth +{ + return 0; +} + +- (float)titleWidth:(NSSize)aSize +{ + return 0; +} + +// +// Displaying +// +- (void)drawInteriorWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSHelpPanel.m b/Source/NSHelpPanel.m new file mode 100644 index 000000000..65dc0d9c4 --- /dev/null +++ b/Source/NSHelpPanel.m @@ -0,0 +1,130 @@ +/* + NSHelpPanel.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSHelpPanel + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSHelpPanel class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Accessing the Help Panel +// ++ (NSHelpPanel *)sharedHelpPanel +{ + return nil; +} + ++ (NSHelpPanel *)sharedHelpPanelWithDirectory:(NSString *)helpDirectory +{ + return nil; +} + +// +// Managing the Contents +// ++ (void)setHelpDirectory:(NSString *)helpDirectory +{} + +// +// Attaching Help to Objects +// ++ (void)attachHelpFile:(NSString *)filename + markerName:(NSString *)markerName +to:(id)anObject +{} + ++ (void)detachHelpFrom:(id)anObject +{} + +// +// Instance methods +// +// +// Managing the Contents +// +- (void)addSupplement:(NSString *)helpDirectory + inPath:(NSString *)supplementPath +{} + +- (NSString *)helpDirectory +{ + return nil; +} + +- (NSString *)helpFile +{ + return nil; +} + +// +// Showing Help +// +- (void)showFile:(NSString *)filename + atMarker:(NSString *)markerName +{} + +- (BOOL)showHelpAttachedTo:(id)anObject +{ + return NO; +} + +// +// Printing +// +- (void)print:(id)sender +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSImage.m b/Source/NSImage.m new file mode 100644 index 000000000..3ecc9b12f --- /dev/null +++ b/Source/NSImage.m @@ -0,0 +1,315 @@ +/* + NSImage.m + + Graphical images + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSImage + +// +// Initializing a New NSImage Instance +// +- (id)initByReferencingFile:(NSString *)filename +{ + return nil; +} + +- (id)initWithContentsOfFile:(NSString *)filename +{ + return nil; +} + +- (id)initWithData:(NSData *)data +{ + return nil; +} + +- (id)initWithPasteboard:(NSPasteboard *)pasteboard +{ + return nil; +} + +- (id)initWithSize:(NSSize)aSize +{ + return nil; +} + +// +// Setting the Size of the Image +// +- (void)setSize:(NSSize)aSize +{} + +- (NSSize)size +{ + return NSZeroSize; +} + +// +// Referring to Images by Name +// ++ (id)imageNamed:(NSString *)name +{ + return nil; +} + +- (BOOL)setName:(NSString *)name +{ + return NO; +} + +- (NSString *)name +{ + return nil; +} + +// +// Specifying the Image +// +- (void)addRepresentation:(NSImageRep *)imageRep +{} + +- (void)addRepresentations:(NSArray *)imageRepArray +{} + +- (void)lockFocus +{} + +- (void)lockFocusOnRepresentation:(NSImageRep *)imageRep +{} + +- (void)unlockFocus +{} + +// +// Using the Image +// +- (void)compositeToPoint:(NSPoint)aPoint + operation:(NSCompositingOperation)op +{} + +- (void)compositeToPoint:(NSPoint)aPoint + fromRect:(NSRect)aRect +operation:(NSCompositingOperation)op +{} + +- (void)dissolveToPoint:(NSPoint)aPoint + fraction:(float)aFloat +{} + +- (void)dissolveToPoint:(NSPoint)aPoint + fromRect:(NSRect)aRect +fraction:(float)aFloat +{} + +// +// Choosing Which Image Representation to Use +// +- (void)setPrefersColorMatch:(BOOL)flag +{} + +- (BOOL)prefersColorMatch +{ + return NO; +} + +- (void)setUsesEPSOnResolutionMismatch:(BOOL)flag +{} + +- (BOOL)usesEPSOnResolutionMismatch +{ + return NO; +} + +- (void)setMatchesOnMultipleResolution:(BOOL)flag +{} + +- (BOOL)matchesOnMultipleResolution +{ + return NO; +} + +// +// Getting the Representations +// +- (NSImageRep *)bestRepresentationForDevice:(NSDictionary *)deviceDescription +{ + return nil; +} + +- (NSArray *)representations +{ + return nil; +} + +- (void)removeRepresentation:(NSImageRep *)imageRep +{} + +// +// Determining How the Image is Stored +// +- (void)setCachedSeparately:(BOOL)flag +{} + +- (BOOL)isCachedSeparately +{ + return NO; +} + +- (void)setDataRetained:(BOOL)flag +{} + +- (BOOL)isDataRetained +{ + return NO; +} + +- (void)setCacheDepthMatchesImageDepth:(BOOL)flag +{} + +- (BOOL)cacheDepthMatchesImageDepth +{ + return NO; +} + +// +// Determining How the Image is Drawn +// +- (BOOL)isValid +{ + return NO; +} + +- (void)setScalesWhenResized:(BOOL)flag +{} + +- (BOOL)scalesWhenResized +{ + return NO; +} + +- (void)setBackgroundColor:(NSColor *)aColor +{} + +- (NSColor *)backgroundColor +{ + return nil; +} + +- (BOOL)drawRepresentation:(NSImageRep *)imageRep + inRect:(NSRect)aRect +{ + return NO; +} + +- (void)recache +{} + +// +// Assigning a Delegate +// +- (void)setDelegate:(id)anObject +{} + +- (id)delegate +{ + return nil; +} + +// +// Producing TIFF Data for the Image +// +- (NSData *)TIFFRepresentation +{ + return nil; +} + +- (NSData *)TIFFRepresentationUsingCompression:(NSTIFFCompression)comp + factor:(float)aFloat +{ + return nil; +} + +// +// Managing NSImageRep Subclasses +// ++ (NSArray *)imageUnfilteredFileTypes +{ + return nil; +} + ++ (NSArray *)imageUnfilteredPasteboardTypes +{ + return nil; +} + +// +// Testing Image Data Sources +// ++ (BOOL)canInitWithPasteboard:(NSPasteboard *)pasteboard +{ + return NO; +} + ++ (NSArray *)imageFileTypes +{ + return nil; +} + ++ (NSArray *)imagePasteboardTypes +{ + return nil; +} + +// +// Methods Implemented by the Delegate +// +- (NSImage *)imageDidNotDraw:(id)sender + inRect:(NSRect)aRect +{ + return nil; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end + diff --git a/Source/NSImageRep.m b/Source/NSImageRep.m new file mode 100644 index 000000000..b462e3a98 --- /dev/null +++ b/Source/NSImageRep.m @@ -0,0 +1,233 @@ +/* + NSImageRep.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +// NSImageRep notifications +NSString *NSImageRepRegistryChangedNotification; + +@implementation NSImageRep + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSImageRep class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Creating an NSImageRep +// ++ (id)imageRepWithContentsOfFile:(NSString *)filename +{ + return nil; +} + ++ (NSArray *)imageRepsWithContentsOfFile:(NSString *)filename +{ + return nil; +} + ++ (id)imageRepWithPasteboard:(NSPasteboard *)pasteboard +{ + return nil; +} + ++ (NSArray *)imageRepsWithPasteboard:(NSPasteboard *)pasteboard +{ + return nil; +} + +// +// Checking Data Types +// ++ (BOOL)canInitWithData:(NSData *)data +{ + return NO; +} + ++ (BOOL)canInitWithPasteboard:(NSPasteboard *)pasteboard +{ + return NO; +} + ++ (NSArray *)imageFileTypes +{ + return nil; +} + ++ (NSArray *)imagePasteboardTypes +{ + return nil; +} + ++ (NSArray *)imageUnfilteredFileTypes +{ + return nil; +} + ++ (NSArray *)imageUnfilteredPasteboardTypes +{ + return nil; +} + +// +// Managing NSImageRep Subclasses +// ++ (Class)imageRepClassForData:(NSData *)data +{ + return NULL; +} + ++ (Class)imageRepClassForFileType:(NSString *)type +{ + return NULL; +} + ++ (Class)imageRepClassForPasteboardType:(NSString *)type +{ + return NULL; +} + ++ (void)registerImageRepClass:(Class)imageRepClass +{} + ++ (NSArray *)registeredImageRepClasses +{ + return nil; +} + ++ (void)unregisterImageRepClass:(Class)imageRepClass +{} + +// +// Instance methods +// +// +// Setting the Size of the Image +// +- (void)setSize:(NSSize)aSize +{} + +- (NSSize)size +{ + return NSZeroSize; +} + +// +// Specifying Information about the Representation +// +- (int)bitsPerSample +{ + return 0; +} + +- (NSString *)colorSpaceName +{ + return nil; +} + +- (BOOL)hasAlpha +{ + return NO; +} + +- (BOOL)isOpaque +{ + return NO; +} + +- (int)pixelsHigh +{ + return 0; +} + +- (int)pixelsWide +{ + return 0; +} + +- (void)setAlpha:(BOOL)flag +{} + +- (void)setBitsPerSample:(int)anInt +{} + +- (void)setColorSpaceName:(NSString *)aString +{} + +- (void)setOpaque:(BOOL)flag +{} + +- (void)setPixelsHigh:(int)anInt +{} + +- (void)setPixelsWide:(int)anInt +{} + +// +// Drawing the Image +// +- (BOOL)draw +{ + return NO; +} + +- (BOOL)drawAtPoint:(NSPoint)aPoint +{ + return NO; +} + +- (BOOL)drawInRect:(NSRect)aRect +{ + return NO; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSMatrix.m b/Source/NSMatrix.m new file mode 100644 index 000000000..4c1742516 --- /dev/null +++ b/Source/NSMatrix.m @@ -0,0 +1,1465 @@ +/* + NSMatrix.m + + Matrix class for grouping controls + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Pascal Forget + Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include +#include +#include + +#define GNU_DEFAULT_CELL_HEIGHT 20 + +// +// Class variables +// +Class NSMATRIX_DEFAULT_CELL_CLASS; + +@implementation NSMatrix + ++ (void)initialize +{ + if (self == [NSMatrix class]) + { + NSDebugLog(@"Initialize NSMatrix class\n"); + + // Set initial version + [self setVersion: 1]; + } +} + +// +// Initializing the NSMatrix Class +// ++ (Class)cellClass +{ + return NSMATRIX_DEFAULT_CELL_CLASS; +} + ++ (void)setCellClass:(Class)classId +{ + NSMATRIX_DEFAULT_CELL_CLASS = classId; +} + +// +// Initializing an NSMatrix Object +// +- (void)createInitialMatrix +{ + NSSize cs; + int i, j; + id aRow, aFloat; + + // Determine cell width and height for uniform cell size + cs.width = (frame.size.width - (inter_cell.width * (num_cols - 1))) + / num_cols; + cs.height = (frame.size.height - (inter_cell.height * (num_rows - 1))) + / num_rows; + + // Save cell widths and heights in arrays + aFloat = [NSNumber numberWithFloat: cs.height]; + for (i = 0;i < num_rows; ++i) + [row_heights addObject:aFloat]; + aFloat = [NSNumber numberWithFloat: cs.width]; + for (i = 0;i < num_cols; ++i) + [col_widths addObject:aFloat]; + + for (i = 0;i < num_rows; ++i) + { + aRow = [NSMutableArray arrayWithCapacity: j]; + [rows addObject: aRow]; + for (j = 0;j < num_cols; ++j) + { + if (cell_prototype != nil) + { + [(NSMutableArray *)aRow addObject: + [cell_prototype copy]]; + } + else + { + [(NSMutableArray *)aRow addObject: + [[cell_class alloc] init]]; + } + } + } +} + +- (id)initWithFrame:(NSRect)frameRect +{ + return [self initWithFrame:frameRect + mode:NSTrackModeMatrix + cellClass:[NSCell class] + numberOfRows:0 + numberOfColumns:0]; +} + +- (id)initWithFrame:(NSRect)frameRect + mode:(int)aMode + cellClass:(Class)classId + numberOfRows:(int)rowsHigh + numberOfColumns:(int)colsWide +{ + NSDebugLog(@"NSMatrix start -initWithFrame: ..cellClass:\n"); + + [super initWithFrame:frameRect]; + + if (rowsHigh < 0) + { + NSLog(@"NSMatrix initWithFrame:mode: rows has to be >= 0.\n"); + NSLog(@"Will create matrix with 0 rows.\n"); + + num_rows = 0; + } + else + { + num_rows = rowsHigh; + } + + if (colsWide < 0) + { + NSLog(@"NSMatrix initWithFrame:mode: columns has to be >= 0.\n"); + NSLog(@"Will create matrix with 0 columns.\n"); + + num_cols = 0; + } + else + { + num_cols = colsWide; + } + + rows = [[NSMutableArray alloc] init]; + row_heights = [[NSMutableArray alloc] init]; + col_widths = [[NSMutableArray alloc] init]; + selected_cells = [[NSMutableArray alloc] init]; + inter_cell.width = inter_cell.height = 2; + + cell_prototype = nil; + cell_class = classId; + mode = aMode; + + [self createInitialMatrix]; + + NSDebugLog(@"NSMatrix end -initWithFrame: ..cellClass:\n"); + return self; +} + +- (id)initWithFrame:(NSRect)frameRect + mode:(int)aMode + prototype:(NSCell *)aCell + numberOfRows:(int)rowsHigh + numberOfColumns:(int)colsWide +{ + [super initWithFrame:frameRect]; + + if (aCell == nil) + { + NSLog(@"NSMatrix "); + NSLog(@"initWithFrame:mode:prototype:numberOfRows:numberOfColumns: "); + NSLog(@"prototype can't be nil. "); + NSLog(@"Using NSCell as the default class.\n"); + + cell_prototype = nil; + + cell_class = [NSCell class]; + } + else + { + cell_prototype = [aCell retain]; + } + + return self; +} + +// +// Setting the Selection Mode +// +- (NSMatrixMode)mode +{ + return mode; +} + +- (void)setMode:(NSMatrixMode)aMode +{ + mode = aMode; +} + +// +// Configuring the NSMatrix +// +- (BOOL)allowsEmptySelection +{ + return allows_empty_selection; +} + +- (BOOL)isSelectionByRect +{ + return selection_by_rect; +} + +- (void)setAllowsEmptySelection:(BOOL)flag +{ + allows_empty_selection = flag; +} + +- (void)setSelectionByRect:(BOOL)flag +{ + selection_by_rect = flag; +} + +// +// Setting the Cell Class +// +- (Class)cellClass +{ + return cell_class; +} + +- (id)prototype +{ + return cell_prototype; +} + +- (void)setCellClass:(Class)classId +{ + cell_class = classId; +} + +- (void)setPrototype:(NSCell *)aCell +{ + cell_prototype = [aCell retain]; +} + +// +// Laying Out the NSMatrix +// +- (void)addColumn +{ + int i; + NSNumber *anInt; + NSMutableArray *aRow; + + if (num_rows <= 0) + { + [rows addObject:[[NSMutableArray alloc] init]]; + num_rows = 1; + + [row_heights removeAllObjects]; + anInt = [NSNumber numberWithInt: GNU_DEFAULT_CELL_HEIGHT]; + [row_heights addObject:anInt]; + } + + for (i=0; i 0) + { + for (i=1; i= num_rows) || (row < 0)) + { + return r; + } + + if ((column >= num_cols) || (column < 0)) + { + return r; + } + + /* Compute the x origin */ + for (i=0; i 1) + { + for (i=0; icolumn; j--) + { + [currentRow replaceObjectAtIndex:j withObject: + [currentRow objectAtIndex:i-1]]; + } + [currentRow replaceObjectAtIndex:column withObject:newCell]; + } + } +} + +- (void)insertColumn:(int)column withCells:(NSArray *)cellArray +{ + NSCell *newCell; + int i, count; + + [self insertColumn:column]; + + if (cellArray != nil) + { + count = [cellArray count]; + } + else + { + count = 0; + } + + for (i=0; i 1) + { + aRow = [rows lastObject]; + + for (i=num_rows-1; i> row; i--) + { + [rows replaceObjectAtIndex:i withObject:[rows objectAtIndex:i-1]]; + } + [rows replaceObjectAtIndex:row withObject:aRow]; + } +} + +- (void)insertRow:(int)row withCells:(NSArray *)cellArray +{ + NSCell *newCell; + int i, count; + + [self insertRow:row]; + + if (cellArray != nil) + { + count = [cellArray count]; + } + else + { + count = 0; + } + + for (i=0; i -1) + && (column < num_cols) + && (column > -1)) + { + newCell = [[cell_class alloc] init]; + [[rows objectAtIndex:row] replaceObjectAtIndex:column + withObject:newCell]; + return newCell; + } + else + { + return nil; + } +} + +- (void)putCell:(NSCell *)newCell + atRow:(int)row + column:(int)column +{ + NSMutableArray *aRow; + + if ((row > -1) + && (row < num_rows) + && (column > -1) + && (column < num_cols)) + { + aRow = (NSMutableArray *)[rows objectAtIndex:row]; + [aRow replaceObjectAtIndex:column withObject:newCell]; + } +} + +- (void)removeColumn:(int)column +{ + int i; + NSMutableArray *aRow; + + if ((column > -1) && (column < num_cols)) + { + for (i=0; i -1) && (row < num_rows)) + { + [rows removeObjectAtIndex:row]; + + [row_heights removeObjectAtIndex:row]; + num_rows--; + } +} + +- empty +{ + [rows removeAllObjects]; + [selected_cells removeAllObjects]; + num_rows = 0; + num_cols = 0; + return self; +} + +- (void)renewRows:(int)newRows + columns:(int)newColumns +{} + +- (void)setCellSize:(NSSize)aSize +{ + NSNumber *aFloat; + id old; + int i; + + for (i=0; i -1) && (column < num_cols)) + { + aFloat = [NSNumber numberWithFloat: width]; + old = [col_widths objectAtIndex:column]; + [col_widths replaceObjectAtIndex:column withObject: aFloat]; + [old release]; + } +} + +- (void)setIntercellSpacing:(NSSize)aSize +{ + inter_cell = aSize; +} + +- (void)sortUsingFunction:(int (*)(id element1, id element2, + void *userData))comparator + context:(void *)context +{} + +- (void)sortUsingSelector:(SEL)comparator +{} + +- (int)numCols; +{ + return num_cols; +} + +- (int)numRows; +{ + return num_rows; +} + +// +// Finding Matrix Coordinates +// +/* + * The next function returns NO if the point is located inside + * the matrix but also in an intercell gap, which may or may + * not be the behavior God intended... + */ +- (BOOL)getRow:(int *)row + column:(int *)column + forPoint:(NSPoint)aPoint +{ + NSRect myFrame = [self bounds]; + NSRect cFrame; + int i, j; + + /* Trivial rejection if the point is not in the Matrix's frame rect */ + + if ((aPoint.x < myFrame.origin.x) + || (aPoint.x > (myFrame.origin.x + myFrame.size.width)) + || (aPoint.y < myFrame.origin.y) + || (aPoint.y > (myFrame.origin.y + myFrame.size.height))) + { + NSDebugLog(@"NSMatrix not in frame rect\n"); + return NO; + } + else + { + /* Here an optimized algo could be used at the expense of clarity */ + + for (i=0; i= cFrame.origin.x) + && (aPoint.x <= (cFrame.origin.x + cFrame.size.width)) + && (aPoint.y >= cFrame.origin.y) + && (aPoint.y <= (cFrame.origin.y + cFrame.size.height))) + { + *row = i; + *column = j; + return YES; + } + } + } + return NO; + } +} + +- (BOOL)getRow:(int *)row + column:(int *)column + ofCell:(NSCell *)aCell +{ + int i, j; + + for (i=0; i -1) + && (row < num_rows) + && (column > -1) + && (column < num_cols)) + { + aRow = (NSMutableArray *)[rows objectAtIndex:row]; + aCell = (NSCell *)[aRow objectAtIndex:column]; + [aCell setState:value]; + } +} + +// +// Selecting Cells +// +- (void)deselectAllCells +{ + [selected_cells removeAllObjects]; +} + +- (void)deselectSelectedCell +{ + [selected_cells removeLastObject]; +} + +- (void)selectAll:(id)sender +{ + [selected_cells removeAllObjects]; + [selected_cells addObjectsFromArray:[self cells]]; +} + +- (void)selectCellAtRow:(int)row + column:(int)column +{ + int index; + id aCell = [self cellAtRow:row column:column]; + + NSDebugLog(@"NSMatrix select cell at %d %d\n", row, column); + if (aCell != nil) + { + index = [selected_cells indexOfObject:aCell]; + + if ((index < 0) || (index > [selected_cells count])) + { + [selected_cells addObject:aCell]; + } + } +} + +- (BOOL)selectCellWithTag:(int)anInt +{ + id aCell = [self cellWithTag:anInt]; + int index; + + if (cell != nil) + { + index = [selected_cells indexOfObject:aCell]; + + if ((index < 0) || (index > [selected_cells count])) + { + [selected_cells addObject:aCell]; + } + return YES; + } else { + return NO; + } +} + +- (id)selectedCell +{ + return [selected_cells lastObject]; +} + +/* + * returns an array of the selected cells + */ +- (NSArray *)selectedCells +{ + return selected_cells; +} + +- (int)selectedColumn +{ + int row, col; + NSMutableArray *aRow, *aCol; + id aCell; + + if ([selected_cells count]) { + + aCell = [selected_cells lastObject]; + + for (row=0; row 0) + { + aCell = [selected_cells lastObject]; + + for (row=0; row= num_rows) || (row < 0)) + { + NSLog(@"NSMatrix cellAt:: invalid row (%d)\n", row); + return nil; + } + + if ((column >= num_cols) || (column < 0)) + { + NSLog(@"NSMatrix cellAt:: invalid column (%d)\n", column); + return nil; + } + + return [(NSArray *)[rows objectAtIndex:row] objectAtIndex:column]; +} + +- (id)cellWithTag:(int)anInt +{ + int i, j; + NSMutableArray *aRow; + NSCell *aCell; + + for (i=0; i 0) && (row < (num_rows-1) )) + { + newSize.height += inter_cell.height; + } + } + + for (col=0; col 0) && (col < (num_cols-1) )) + { + newSize.width += inter_cell.width; + } + } + +#if 1 + NSLog(@"NSMatrix size: %4.0f %4.0f\n",newSize.width,newSize.height); +#endif + + [(NSView *)self setFrameSize:newSize]; +} + +// +// Scrolling +// +- (BOOL)isAutoscroll +{ + return autoscroll; +} + +- (void)scrollCellToVisibleAtRow:(int)row + column:(int)column +{} + +- (void)setAutoscroll:(BOOL)flag +{ + autoscroll = flag; +} + +- (void)setScrollable:(BOOL)flag +{ + scrollable = flag; +} + +// +// Displaying +// +- (void)display; +{ + int row,col; + int rcnt, ccnt; + NSMutableArray *aRow; + + NSDebugLog(@"NSMatrix display\n"); + + rcnt = [rows count]; + if (rcnt != num_rows) + NSLog(@"NSMatrix internal error: num_rows != actual rows\n"); + + for (row=0; row + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include + +@implementation NSMenu + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSMenu class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Controlling Allocation Zones +// ++ (NSZone *)menuZone +{ + return NULL; +} + ++ (void)setMenuZone:(NSZone *)zone +{} + +// +// Instance methods +// +// +// Initializing a New NSMenu +// +- init +{ + return [self initWithTitle:@""]; +} + +- (id)initWithTitle:(NSString *)aTitle +{ + window_title = aTitle; + menu_items = [NSMutableArray array]; + return self; +} + +// +// Setting Up the Menu Commands +// +- (id)addItemWithTitle:(NSString *)aString + action:(SEL)aSelector +keyEquivalent:(NSString *)charCode +{ + NSMenuCell *m; + unsigned int mi; + + m = [[NSMenuCell alloc] initTextCell:aString]; + [m setAction:aSelector]; + [menu_items addObject:m]; + + return m; +} + +- (id)insertItemWithTitle:(NSString *)aString + action:(SEL)aSelector +keyEquivalent:(NSString *)charCode + atIndex:(unsigned int)index +{ + NSMenuCell *m; + unsigned int mi; + + m = [[NSMenuCell alloc] initTextCell:aString]; + [m setAction:aSelector]; + [menu_items insertObject:m atIndex:index]; + + return m; +} + +- (NSArray *)itemArray +{ + return menu_items; +} + +- (NSMatrix *)itemMatrix +{ + return nil; +} + +- (void)setItemMatrix:(NSMatrix *)aMatrix +{} + +// +// Finding Menu Items +// +- (id)cellWithTag:(int)aTag +{ + int i, j; + NSMenuCell *m, *found; + + found = nil; + j = [menu_items count]; + for (i = 0;i < j; ++i) + { + m = [menu_items objectAtIndex:i]; + if ([m tag] == aTag) return m; + if ([m hasSubmenu]) + found = [[m submenu] cellWithTag:aTag]; + if (found) return found; + } + return found; +} + +// +// Building Submenus +// +- (NSMenuCell *)setSubmenu:(NSMenu *)aMenu + forItem:(NSMenuCell *)aCell +{ + int i, j; + NSMenuCell *m; + + j = [menu_items count]; + for (i = 0;i < j; ++i) + { + m = [menu_items objectAtIndex:i]; + if (m == aCell) + { + // Set the menucell's submenu + [m setSubmenu:aMenu]; + + // Return the menucell + return m; + } + } + return nil; +} + +- (void)submenuAction:(id)sender +{} + +// +// Managing NSMenu Windows +// +- (NSMenu *)attachedMenu +{ + return nil; +} + +- (BOOL)isAttached +{ + return NO; +} + +- (BOOL)isTornOff +{ + return NO; +} + +- (NSPoint)locationForSubmenu:(NSMenu *)aSubmenu +{ + return NSZeroPoint; +} + +- (void)sizeToFit +{} + +- (NSMenu *)supermenu +{ + return nil; +} + +// +// Displaying the Menu +// +- (BOOL)autoenablesItems +{ + return NO; +} + +- (void)setAutoenablesItems:(BOOL)flag +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: menu_items]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + menu_items = [aDecoder decodeObject]; + + return self; +} + +@end diff --git a/Source/NSMenuCell.m b/Source/NSMenuCell.m new file mode 100644 index 000000000..796ce7138 --- /dev/null +++ b/Source/NSMenuCell.m @@ -0,0 +1,154 @@ +/* + NSMenuCell.m + + Cell class for menu items + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include + +// +// Class variables +// +BOOL MB_NSMENUCELL_USES_KEY; + +@implementation NSMenuCell + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSMenuCell class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Managing User Key Equivalents +// ++ (void)setUsesUserKeyEquivalents:(BOOL)flag +{ + MB_NSMENUCELL_USES_KEY = flag; +} + ++ (BOOL)usesUserKeyEquivalents +{ + return MB_NSMENUCELL_USES_KEY; +} + +// +// Instance methods +// +- (unsigned int)menuIdentifier +{ + return menu_identifier; +} + +- (void)setMenuIdentifier:(unsigned int)theID +{ + menu_identifier = theID; +} + +// +// Initialization +// +- init +{ + return [self initTextCell:@"Text"]; +} + +- initTextCell:(NSString *)aString +{ + [super initTextCell:aString]; + [self setEnabled:YES]; + sub_menu = nil; + return self; +} + +- (void)dealloc +{ + [sub_menu release]; + [super dealloc]; +} + +// +// Checking for a Submenu +// +- (BOOL)hasSubmenu +{ + if (sub_menu) + return YES; + else + return NO; +} + +- (NSMenu *)submenu +{ + return sub_menu; +} + +- (void)setSubmenu:(NSMenu *)aMenu +{ + [sub_menu release]; + sub_menu = aMenu; + [sub_menu retain]; +} + +- (NSString *)userKeyEquivalent +{ + return key_equivalent; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: key_equivalent]; + [aCoder encodeObject: sub_menu]; + [aCoder encodeValueOfObjCType: "I" at: &menu_identifier]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + key_equivalent = [aDecoder decodeObject]; + sub_menu = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: "I" at: &menu_identifier]; + + return self; +} + +@end + diff --git a/Source/NSOpenPanel.m b/Source/NSOpenPanel.m new file mode 100644 index 000000000..6bb3a5302 --- /dev/null +++ b/Source/NSOpenPanel.m @@ -0,0 +1,232 @@ +/* + NSOpenPanel.m + + Standard open panel for opening files + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +NSOpenPanel *MB_THE_OPEN_PANEL; + +@implementation NSOpenPanel + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSOpenPanel class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Accessing the NSOpenPanel +// ++ (NSOpenPanel *)openPanel +{ + if (!MB_THE_OPEN_PANEL) + MB_THE_OPEN_PANEL = [[NSOpenPanel alloc] init]; + return MB_THE_OPEN_PANEL; +} + +// +// Instance methods +// +// +// Initialization +// +- (void)setDefaults +{ + [super setDefaults]; + panel_title = @"Open File"; + multiple_select = NO; + choose_dir = NO; + choose_file = YES; +} + +- init +{ + [super init]; + [self setDefaults]; + return self; +} + +// +// Filtering Files +// +- (BOOL)allowsMultipleSelection +{ + return multiple_select; +} + +- (BOOL)canChooseDirectories +{ + return choose_dir; +} + +- (BOOL)canChooseFiles +{ + return choose_file; +} + +- (void)setAllowsMultipleSelection:(BOOL)flag +{ + multiple_select = flag; +} + +- (void)setCanChooseDirectories:(BOOL)flag +{ + choose_dir = flag; +} + +- (void)setCanChooseFiles:(BOOL)flag; +{ + choose_file = flag; +} + +// +// Querying the Chosen Files +// +- (NSArray *)filenames +{ + return the_filenames; +} + +- (NSString *)filename +{ + if ([the_filenames count] > 0) + return [the_filenames objectAtIndex:0]; + else + return nil; +} + +// +// Running the NSOpenPanel +// +- (int)runModalForTypes:(NSArray *)fileTypes +{ +} + +- (int)runModalForDirectory:(NSString *)path + file:(NSString *)filename +{ + NSArray *t = [NSArray arrayWithObject:@"*"]; + + if (path) directory = path; + if (filename) file_name = filename; + + return [self runModalForTypes:t]; +} + +- (int)runModalForDirectory:(NSString *)path + file:(NSString *)filename +types:(NSArray *)fileTypes +{ + if (path) directory = path; + if (filename) file_name = filename; + + return [self runModalForTypes:fileTypes]; +} + +// +// Target and Action Methods +// +- (void)ok:(id)sender +{ + char *sp, files[4096], *p; + NSMutableString *m; + + if (the_filenames) [the_filenames release]; + the_filenames = [NSMutableArray array]; + // Search for space + strcpy(files, [file_name cString]); + sp = strchr(files, ' '); + if (sp == NULL) + { + // No space then only one file selected + [the_filenames addObject:file_name]; + sp = strrchr(files, '\\'); + sp++; + *sp = '\0'; + directory = [NSString stringWithCString:files]; + } + else + { + // Multiple files selected + *sp = '\0'; + directory = [NSString stringWithCString:files]; + p = sp + 1; + sp = strchr(p, ' '); + while (sp != NULL) + { + *sp = '\0'; + m = [NSMutableString stringWithCString:files]; + [m appendString:@"\\"]; + [m appendString:[NSString stringWithCString:p]]; + [the_filenames addObject:m]; + p = sp + 1; + sp = strchr(p, ' '); + } + if (strchr(p, '\0')) + { + m = [NSMutableString stringWithCString:files]; + [m appendString:@"\\"]; + [m appendString:[NSString stringWithCString:p]]; + [the_filenames addObject:m]; + } + } +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: the_filenames]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &multiple_select]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &choose_dir]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &choose_file]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + the_filenames = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &multiple_select]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &choose_dir]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &choose_file]; + + return self; +} + +@end diff --git a/Source/NSPageLayout.m b/Source/NSPageLayout.m new file mode 100644 index 000000000..738a394cc --- /dev/null +++ b/Source/NSPageLayout.m @@ -0,0 +1,131 @@ +/* + NSPageLayout.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSPageLayout + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSPageLayout class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Creating an NSPageLayout Instance +// ++ (NSPageLayout *)pageLayout +{ + return nil; +} + +// +// Instance methods +// + +// +// Running the Panel +// +- (int)runModal +{ + return 0; +} + +- (int)runModalWithPrintInfo:(NSPrintInfo *)pInfo +{ + return 0; +} + +// +// Customizing the Panel +// +- (NSView *)accessoryView +{ + return nil; +} + +- (void)setAccessoryView:(NSView *)aView +{} + +// +// Updating the Panel's Display +// +- (void)convertOldFactor:(float *)old + newFactor:(float *)new +{} + +- (void)pickedButton:(id)sender +{} + +- (void)pickedOrientation:(id)sender +{} + +- (void)pickedPaperSize:(id)sender +{} + +- (void)pickedUnits:(id)sender +{} + +// +// Communicating with the NSPrintInfo Object +// +- (NSPrintInfo *)printInfo +{ + return nil; +} + +- (void)readPrintInfo +{} + +- (void)writePrintInfo +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSPanel.m b/Source/NSPanel.m new file mode 100644 index 000000000..85636e42c --- /dev/null +++ b/Source/NSPanel.m @@ -0,0 +1,101 @@ +/* + NSPanel.m + + Panel window class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSPanel + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSPanel class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// +// +- init +{ + int style; + + style = NSTitledWindowMask | NSClosableWindowMask; + return [self initWithContentRect:NSZeroRect styleMask:style + backing:NSBackingStoreBuffered defer:NO]; +} + +// +// Determining the Panel Behavior +// +- (BOOL)becomesKeyOnlyIfNeeded +{ + return NO; +} + +- (BOOL)isFloatingPanel +{ + return NO; +} + +- (void)setBecomesKeyOnlyIfNeeded:(BOOL)flag +{} + +- (void)setFloatingPanel:(BOOL)flag +{} + +- (void)setWorksWhenModal:(BOOL)flag +{} + +- (BOOL)worksWhenModal +{ + return NO; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSPasteboard.m b/Source/NSPasteboard.m new file mode 100644 index 000000000..05b7b56ce --- /dev/null +++ b/Source/NSPasteboard.m @@ -0,0 +1,218 @@ +/* + NSPasteboard.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +// Pasteboard Type Globals +NSString *NSStringPboardType; +NSString *NSColorPboardType; +NSString *NSFileContentsPboardType; +NSString *NSFilenamesPboardType; +NSString *NSFontPboardType; +NSString *NSRulerPboardType; +NSString *NSPostScriptPboardType; +NSString *NSTabularTextPboardType; +NSString *NSRTFPboardType; +NSString *NSTIFFPboardType; +NSString *NSDataLinkPboardType; +NSString *NSGeneralPboardType; + +// Pasteboard Name Globals +NSString *NSDragPboard; +NSString *NSFindPboard; +NSString *NSFontPboard; +NSString *NSGeneralPboard; +NSString *NSRulerPboard; + +@implementation NSPasteboard + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSPasteboard class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Creating and Releasing an NSPasteboard Object +// ++ (NSPasteboard *)generalPasteboard +{ + return nil; +} + ++ (NSPasteboard *)pasteboardWithName:(NSString *)name +{ + return nil; +} + ++ (NSPasteboard *)pasteboardWithUniqueName +{ + return nil; +} + +// +// Getting Data in Different Formats +// ++ (NSPasteboard *)pasteboardByFilteringData:(NSData *)data + ofType:(NSString *)type +{ + return nil; +} + ++ (NSPasteboard *)pasteboardByFilteringFile:(NSString *)filename +{ + return nil; +} + ++ (NSPasteboard *)pasteboardByFilteringTypesInPasteboard:(NSPasteboard *)pboard +{ + return nil; +} + ++ (NSArray *)typesFilterableTo:(NSString *)type +{ + return nil; +} + +// +// Instance methods +// + +// +// Creating and Releasing an NSPasteboard Object +// +- (void)releaseGlobally +{} + +// +// Referring to a Pasteboard by Name +// +- (NSString *)name +{ + return nil; +} + +// +// Writing Data +// +- (int)addTypes:(NSArray *)newTypes + owner:(id)newOwner +{ + return 0; +} + +- (int)declareTypes:(NSArray *)newTypes + owner:(id)newOwner +{ + return 0; +} + +- (BOOL)setData:(NSData *)data + forType:(NSString *)dataType +{ + return NO; +} + +- (BOOL)setPropertyList:(id)propertyList + forType:(NSString *)dataType +{ + return NO; +} + +- (BOOL)setString:(NSString *)string + forType:(NSString *)dataType +{ + return NO; +} + +- (BOOL)writeFileContents:(NSString *)filename +{ + return NO; +} + +// +// Determining Types +// +- (NSString *)availableTypeFromArray:(NSArray *)types +{ + return nil; +} + +- (NSArray *)types +{ + return nil; +} + +// +// Reading Data +// +- (int)changeCount +{ + return 0; +} + +- (NSData *)dataForType:(NSString *)dataType +{ + return nil; +} + +- (id)propertyListForType:(NSString *)dataType +{ + return nil; +} + +- (NSString *)readFileContentsType:(NSString *)type + toFile:(NSString *)filename +{ + return nil; +} + +- (NSString *)stringForType:(NSString *)dataType +{ + return nil; +} + +// +// Methods Implemented by the Owner +// +- (void)pasteboard:(NSPasteboard *)sender +provideDataForType:(NSString *)type +{} + +- (void)pasteboardChangedOwner:(NSPasteboard *)sender +{} + +@end diff --git a/Source/NSPopUpButton.m b/Source/NSPopUpButton.m new file mode 100644 index 000000000..3a57a73a6 --- /dev/null +++ b/Source/NSPopUpButton.m @@ -0,0 +1,327 @@ +/* + NSPopUpButton.m + + Popup list class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +// +// NSPopUpButton implementation +// +@implementation NSPopUpButton + +/////////////////////////////////////////////////////////////// +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSPopUpButton class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Initializing an NSPopUpButton +// +- init +{ + return [self initWithFrame:NSZeroRect pullsDown:NO]; +} + +- (id)initWithFrame:(NSRect)frameRect +{ + return [self initWithFrame:frameRect pullsDown:NO]; +} + +- (id)initWithFrame:(NSRect)frameRect + pullsDown:(BOOL)flag +{ + [super initWithFrame:frameRect]; + list_items = [NSMutableArray array]; + is_up = NO; + pulls_down = flag; + selected_item = 0; + + return self; +} + +- (void)dealloc +{ + int i, j; + + j = [list_items count]; + for (i = 0;i < j; ++i) + [[list_items objectAtIndex:i] release]; + [super dealloc]; +} + +// +// Target and Action +// +- (SEL)action +{ + return pub_action; +} + +- (void)setAction:(SEL)aSelector +{ + pub_action = aSelector; +} + +- (id)target +{ + return pub_target; +} + +- (void)setTarget:(id)anObject +{ + pub_target = anObject; +} + +// +// Adding Items +// +- (void)addItemWithTitle:(NSString *)title +{ + char out[80]; + + [list_items addObject:title]; + [self synchronizeTitleAndSelectedItem]; +} + +- (void)addItemsWithTitles:(NSArray *)itemTitles +{} + +- (void)insertItemWithTitle:(NSString *)title + atIndex:(unsigned int)index +{} + +// +// Removing Items +// +- (void)removeAllItems +{} + +- (void)removeItemWithTitle:(NSString *)title +{} + +- (void)removeItemAtIndex:(int)index +{} + +// +// Querying the NSPopUpButton about Its Items +// +- (int)indexOfItemWithTitle:(NSString *)title +{ + return 0; +} + +- (int)indexOfSelectedItem +{ + return selected_item; +} + +- (int)numberOfItems +{ + return [list_items count]; +} + +- (NSMenuCell *)itemAtIndex:(int)index +{ + return nil; +} + +- (NSMatrix *)itemMatrix +{ + return nil; +} + +- (NSString *)itemTitleAtIndex:(int)index +{ + return nil; +} + +- (NSArray *)itemTitles +{ + return list_items; +} + +- (NSMenuCell *)itemWithTitle:(NSString *)title +{ + return nil; +} + +- (NSMenuCell *)lastItem +{ + if ([list_items count] != 0) + return [list_items lastObject]; + else + return nil; +} + +- (NSMenuCell *)selectedItem +{ + return nil; +} + +- (NSString *)titleOfSelectedItem +{ + if ([list_items count] != 0) + return [list_items objectAtIndex:selected_item]; + else + return nil; +} + +// +// Manipulating the NSPopUpButton +// +- (NSFont *)font +{ + return nil; +} + +- (BOOL)pullsDown +{ + return pulls_down; +} + +- (void)selectItemAtIndex:(int)index +{ + char out[80]; + + if ((index >= 0) && (index <= [list_items count])) + { + selected_item = index; + [self synchronizeTitleAndSelectedItem]; + } +} + +- (void)selectItemWithTitle:(NSString *)title +{} + +- (void)setFont:(NSFont *)fontObject +{} + +- (void)setPullsDown:(BOOL)flag +{ + pulls_down = flag; +} + +- (void)setTitle:(NSString *)aString +{} + +- (NSString *)stringValue +{ + return nil; +} + +- (void)synchronizeTitleAndSelectedItem +{ +} + +// +// Displaying the NSPopUpButton's Items +// +- (BOOL)autoenablesItems +{ + return NO; +} + +- (void)setAutoenablesItems:(BOOL)flag +{} + +// +// Handle events +// +- (void)mouseDown:(NSEvent *)theEvent +{ +} + +- (void)mouseUp:(NSEvent *)theEvent +{ +} + +- (void)mouseMoved:(NSEvent *)theEvent +{ +} + +- (NSView *)hitTest:(NSPoint)aPoint +{ + NSPoint p; + char out[80]; + NSRect wr; + + // First check ourselves + if ([self mouse:aPoint inRect:bounds]) return self; + + return nil; +} + +// +// Displaying +// +- (void)drawRect:(NSRect)rect +{ +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: list_items]; + [aCoder encodeRect: list_rect]; + [aCoder encodeValueOfObjCType: "i" at: &selected_item]; + [aCoder encodeObjectReference: pub_target withName: @"Target"]; + [aCoder encodeValueOfObjCType: @encode(SEL) at: &pub_action]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_up]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &pulls_down]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + list_items = [aDecoder decodeObject]; + list_rect = [aDecoder decodeRect]; + [aDecoder decodeValueOfObjCType: "i" at: &selected_item]; + [aDecoder decodeObjectAt: &pub_target withName: NULL]; + [aDecoder decodeValueOfObjCType: @encode(SEL) at: &pub_action]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_up]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &pulls_down]; + + return self; +} + +@end diff --git a/Source/NSPrintInfo.m b/Source/NSPrintInfo.m new file mode 100644 index 000000000..bfea3b8eb --- /dev/null +++ b/Source/NSPrintInfo.m @@ -0,0 +1,233 @@ +/* + NSPrintInfo.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSPrintInfo + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSPrintInfo class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Managing the Shared NSPrintInfo Object +// ++ (void)setSharedPrintInfo:(NSPrintInfo *)printInfo +{} + ++ (NSPrintInfo *)sharedPrintInfo +{ + return nil; +} + +// +// Managing the Printing Rectangle +// ++ (NSSize)sizeForPaperName:(NSString *)name +{ + return NSZeroSize; +} + +// +// Specifying the Printer +// ++ (NSPrinter *)defaultPrinter +{ + return nil; +} + ++ (void)setDefaultPrinter:(NSPrinter *)printer +{} + +// +// Instance methods +// +// +// Creating and Initializing an NSPrintInfo Instance +// +- (id)initWithDictionary:(NSDictionary *)aDict +{ + return nil; +} + +// +// Managing the Printing Rectangle +// +- (float)bottomMargin +{ + return 0.0; +} + +- (float)leftMargin +{ + return 0.0; +} + +- (NSPrintingOrientation)orientation +{ + return 0; +} + +- (NSString *)paperName +{ + return nil; +} + +- (NSSize)paperSize +{ + return NSZeroSize; +} + +- (float)rightMargin +{ + return 0.0; +} + +- (void)setBottomMargin:(float)value +{} + +- (void)setLeftMargin:(float)value +{} + +- (void)setOrientation:(NSPrintingOrientation)mode +{} + +- (void)setPaperName:(NSString *)name +{} + +- (void)setPaperSize:(NSSize)size +{} + +- (void)setRightMargin:(float)value +{} + +- (void)setTopMargin:(float)value +{} + +- (float)topMargin +{ + return 0.0; +} + +// +// Pagination +// +- (NSPrintingPaginationMode)horizontalPagination +{ + return 0; +} + +- (void)setHorizontalPagination:(NSPrintingPaginationMode)mode +{} + +- (void)setVerticalPagination:(NSPrintingPaginationMode)mode +{} + +- (NSPrintingPaginationMode)verticalPagination +{ + return 0; +} + +// +// Positioning the Image on the Page +// +- (BOOL)isHorizontallyCentered +{ + return NO; +} + +- (BOOL)isVerticallyCentered +{ + return NO; +} + +- (void)setHorizontallyCentered:(BOOL)flag +{} + +- (void)setVerticallyCentered:(BOOL)flag +{} + +// +// Specifying the Printer +// +- (NSPrinter *)printer +{ + return nil; +} + +- (void)setPrinter:(NSPrinter *)aPrinter +{} + +// +// Controlling Printing +// +- (NSString *)jobDisposition +{ + return nil; +} + +- (void)setJobDisposition:(NSString *)disposition +{} + +- (void)setUpPrintOperationDefaultValues +{} + +// +// Accessing the NSPrintInfo Object's Dictionary +// +- (NSMutableDictionary *)dictionary +{ + return nil; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSPrintOperation.m b/Source/NSPrintOperation.m new file mode 100644 index 000000000..49f6083ba --- /dev/null +++ b/Source/NSPrintOperation.m @@ -0,0 +1,209 @@ +/* + NSPrintOperation.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSPrintOperation + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSPrintOperation class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Creating and Initializing an NSPrintOperation Object +// ++ (NSPrintOperation *)EPSOperationWithView:(NSView *)aView + insideRect:(NSRect)rect +toData:(NSMutableData *)data +{ + return nil; +} + ++ (NSPrintOperation *)EPSOperationWithView:(NSView *)aView + insideRect:(NSRect)rect +toData:(NSMutableData *)data + printInfo:(NSPrintInfo *)aPrintInfo +{ + return nil; +} + ++ (NSPrintOperation *)EPSOperationWithView:(NSView *)aView + insideRect:(NSRect)rect +toPath:(NSString *)path + printInfo:(NSPrintInfo *)aPrintInfo +{ + return nil; +} + ++ (NSPrintOperation *)printOperationWithView:(NSView *)aView +{ + return nil; +} + ++ (NSPrintOperation *)printOperationWithView:(NSView *)aView + printInfo:(NSPrintInfo *)aPrintInfo +{ + return nil; +} + +// +// Setting the Print Operation +// ++ (NSPrintOperation *)currentOperation +{ + return nil; +} + ++ (void)setCurrentOperation:(NSPrintOperation *)operation +{} + +// +// Instance methods +// +// +// Creating and Initializing an NSPrintOperation Object +// +- (id)initEPSOperationWithView:(NSView *)aView + insideRect:(NSRect)rect +toData:(NSMutableData *)data + printInfo:(NSPrintInfo *)aPrintInfo +{ + return nil; +} + +- (id)initWithView:(NSView *)aView + printInfo:(NSPrintInfo *)aPrintInfo +{ + return nil; +} + +// +// Determining the Type of Operation +// +- (BOOL)isEPSOperation +{ + return NO; +} + +// +// Controlling the User Interface +// +- (NSPrintPanel *)printPanel +{ + return nil; +} + +- (BOOL)showPanels +{ + return NO; +} + +- (void)setPrintPanel:(NSPrintPanel *)panel +{} + +- (void)setShowPanels:(BOOL)flag +{} + +// +// Managing the DPS Context +// +- (NSDPSContext *)createContext +{ + return nil; +} + +- (NSDPSContext *)context +{ + return nil; +} + +- (void)destroyContext +{} + +// +// Page Information +// +- (int)currentPage +{ + return 0; +} + +- (NSPrintingPageOrder)pageOrder +{ + return 0; +} + +- (void)setPageOrder:(NSPrintingPageOrder)order +{} + +// +// Running a Print Operation +// +- (void)cleanUpOperation +{} + +- (BOOL)deliverResult +{ + return NO; +} + +- (BOOL)runOperation +{ + return NO; +} + +// +// Getting the NSPrintInfo Object +// +- (NSPrintInfo *)printInfo +{ + return nil; +} + +- (void)setPrintInfo:(NSPrintInfo *)aPrintInfo +{} + +// +// Getting the NSView Object +// +- (NSView *)view +{ + return nil; +} + +@end diff --git a/Source/NSPrintPanel.m b/Source/NSPrintPanel.m new file mode 100644 index 000000000..3d0e70b24 --- /dev/null +++ b/Source/NSPrintPanel.m @@ -0,0 +1,114 @@ +/* + NSPrintPanel.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSPrintPanel + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSPrintPanel class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Creating an NSPrintPanel +// ++ (NSPrintPanel *)printPanel +{ + return nil; +} + +// +// Instance methods +// + +// +// Customizing the Panel +// +- (void)setAccessoryView:(NSView *)aView +{} + +- (NSView *)accessoryView +{ + return nil; +} + +// +// Running the Panel +// +- (int)runModal +{ + return 0; +} + +- (void)pickedButton:(id)sender +{} + +// +// Updating the Panel's Display +// +- (void)pickedAllPages:(id)sender +{} + +- (void)pickedLayoutList:(id)sender +{} + +// +// Communicating with the NSPrintInfo Object +// +- (void)updateFromPrintInfo +{} + +- (void)finalWritePrintInfo +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSPrinter.m b/Source/NSPrinter.m new file mode 100644 index 000000000..d6c9e2cd5 --- /dev/null +++ b/Source/NSPrinter.m @@ -0,0 +1,248 @@ +/* + NSPrinter.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +// Printing Information Dictionary Keys +NSString *NSPrintAllPages; +NSString *NSPrintBottomMargin; +NSString *NSPrintCopies; +NSString *NSPrintFaxCoverSheetName; +NSString *NSPrintFaxHighResolution; +NSString *NSPrintFaxModem; +NSString *NSPrintFaxReceiverNames; +NSString *NSPrintFaxReceiverNumbers; +NSString *NSPrintFaxReturnReceipt; +NSString *NSPrintFaxSendTime; +NSString *NSPrintFaxTrimPageEnds; +NSString *NSPrintFaxUseCoverSheet; +NSString *NSPrintFirstPage; +NSString *NSPrintHorizonalPagination; +NSString *NSPrintHorizontallyCentered; +NSString *NSPrintJobDisposition; +NSString *NSPrintJobFeatures; +NSString *NSPrintLastPage; +NSString *NSPrintLeftMargin; +NSString *NSPrintManualFeed; +NSString *NSPrintOrientation; +NSString *NSPrintPackageException; +NSString *NSPrintPagesPerSheet; +NSString *NSPrintPaperFeed; +NSString *NSPrintPaperName; +NSString *NSPrintPaperSize; +NSString *NSPrintPrinter; +NSString *NSPrintReversePageOrder; +NSString *NSPrintRightMargin; +NSString *NSPrintSavePath; +NSString *NSPrintScalingFactor; +NSString *NSPrintTopMargin; +NSString *NSPrintVerticalPagination; +NSString *NSPrintVerticallyCentered; + +// Print Job Disposition Values +NSString *NSPrintCancelJob; +NSString *NSPrintFaxJob; +NSString *NSPrintPreviewJob; +NSString *NSPrintSaveJob; +NSString *NSPrintSpoolJob; + +@implementation NSPrinter + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSPrinter class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Finding an NSPrinter +// ++ (NSPrinter *)printerWithName:(NSString *)name +{ + return nil; +} + ++ (NSPrinter *)printerWithType:(NSString *)type +{ + return nil; +} + ++ (NSArray *)printerTypes +{ + return nil; +} + +// +// Instance methods +// +// +// Printer Attributes +// +- (NSString *)host +{ + return nil; +} + +- (NSString *)name +{ + return nil; +} + +- (NSString *)note +{ + return nil; +} + +- (NSString *)type +{ + return nil; +} + +// +// Retrieving Specific Information +// +- (BOOL)acceptsBinary +{ + return NO; +} + +- (NSRect)imageRectForPaper:(NSString *)paperName +{ + return NSZeroRect; +} + +- (NSSize)pageSizeForPaper:(NSString *)paperName +{ + return NSZeroSize; +} + +- (BOOL)isColor +{ + return NO; +} + +- (BOOL)isFontAvailable:(NSString *)fontName +{ + return NO; +} + +- (int)languageLevel +{ + return 0; +} + +- (BOOL)isOutputStackInReverseOrder +{ + return NO; +} + +// +// Querying the NSPrinter Tables +// +- (BOOL)booleanForKey:(NSString *)key + inTable:(NSString *)table +{ + return NO; +} + +- (NSDictionary *)deviceDescription +{ + return nil; +} + +- (float)floatForKey:(NSString *)key + inTable:(NSString *)table +{ + return 0.0; +} + +- (int)intForKey:(NSString *)key + inTable:(NSString *)table +{ + return 0; +} + +- (NSRect)rectForKey:(NSString *)key + inTable:(NSString *)table +{ + return NSZeroRect; +} + +- (NSSize)sizeForKey:(NSString *)key + inTable:(NSString *)table +{ + return NSZeroSize; +} + +- (NSString *)stringForKey:(NSString *)key + inTable:(NSString *)table +{ + return nil; +} + +- (NSArray *)stringListForKey:(NSString *)key + inTable:(NSString *)table +{ + return nil; +} + +- (NSPrinterTableStatus)statusForTable:(NSString *)table +{ + return 0; +} + +- (BOOL)isKey:(NSString *)key + inTable:(NSString *)table +{ + return NO; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSResponder.m b/Source/NSResponder.m new file mode 100644 index 000000000..b0cda76bd --- /dev/null +++ b/Source/NSResponder.m @@ -0,0 +1,258 @@ +/* + NSResponder.m + + Abstract class which is basis of command and event processing + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +@implementation NSResponder + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSResponder class]) + { + NSLog(@"Initialize NSResponder class\n"); + + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// +// +// Managing the next responder +// +- nextResponder +{ + return next_responder; +} + +- (void)setNextResponder:aResponder +{ + next_responder = aResponder; +} + +// +// Determining the first responder +// +- (BOOL)acceptsFirstResponder +{ + return NO; +} + +- (BOOL)becomeFirstResponder +{ + return YES; +} + +- (BOOL)resignFirstResponder +{ + return YES; +} + +// +// Aid event processing +// +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent +{ + return NO; +} + +- (BOOL)tryToPerform:(SEL)anAction with:anObject +{ + // Can we perform the action -then do it + if ([self respondsToSelector:anAction]) + { + [self perform:anAction withObject:anObject]; + return YES; + } + else + { + // If we cannot perform then try the next responder + if (!next_responder) + return NO; + else + return [next_responder tryToPerform:anAction with:anObject]; + } +} + +// +// Forwarding event messages +// +- (void)flagsChanged:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder flagsChanged:theEvent]; + else + return [self noResponderFor:@selector(flagsChanged:)]; +} + +- (void)helpRequested:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder helpRequested:theEvent]; + else + return [self noResponderFor:@selector(helpRequested:)]; +} + +- (void)keyDown:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder keyDown:theEvent]; + else + return [self noResponderFor:@selector(keyDown:)]; +} + +- (void)keyUp:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder keyUp:theEvent]; + else + return [self noResponderFor:@selector(keyUp:)]; +} + +- (void)mouseDown:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder mouseDown:theEvent]; + else + return [self noResponderFor:@selector(mouseDown:)]; +} + +- (void)mouseDragged:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder mouseDragged:theEvent]; + else + return [self noResponderFor:@selector(mouseDragged:)]; +} + +- (void)mouseEntered:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder mouseEntered:theEvent]; + else + return [self noResponderFor:@selector(mouseEntered:)]; +} + +- (void)mouseExited:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder mouseExited:theEvent]; + else + return [self noResponderFor:@selector(mouseExited:)]; +} + +- (void)mouseMoved:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder mouseMoved:theEvent]; + else + return [self noResponderFor:@selector(mouseMoved:)]; +} + +- (void)mouseUp:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder mouseUp:theEvent]; + else + return [self noResponderFor:@selector(mouseUp:)]; +} + +- (void)noResponderFor:(SEL)eventSelector +{ + // Only beep for key down events + if (eventSelector != @selector(keyDown:)) + return; + + NSBeep(); +} + +- (void)rightMouseDown:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder rightMouseDown:theEvent]; + else + return [self noResponderFor:@selector(rightMouseDown:)]; +} + +- (void)rightMouseDragged:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder rightMouseDragged:theEvent]; + else + return [self noResponderFor:@selector(rightMouseDragged:)]; +} + +- (void)rightMouseUp:(NSEvent *)theEvent +{ + if (next_responder) + return [next_responder rightMouseUp:theEvent]; + else + return [self noResponderFor:@selector(rightMouseUp:)]; +} + +// +// Services menu support +// +- validRequestorForSendType:(NSString *)typeSent + returnType:(NSString *)typeReturned +{ + if (next_responder) + return [next_responder validRequestorForSendType:typeSent + returnType:typeReturned]; + else + return nil; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObjectReference: next_responder withName: @"Next responder"]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + [aDecoder decodeObjectAt: &next_responder withName: NULL]; + + return self; +} + +@end diff --git a/Source/NSSavePanel.m b/Source/NSSavePanel.m new file mode 100644 index 000000000..5bf144396 --- /dev/null +++ b/Source/NSSavePanel.m @@ -0,0 +1,277 @@ +/* + NSSavePanel.m + + Standard save panel for saving files + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +// +// Class variables +// +NSSavePanel *MB_THE_SAVE_PANEL; + +@implementation NSSavePanel + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSSavePanel class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Creating an NSSavePanel +// ++ (NSSavePanel *)savePanel +{ + if (!MB_THE_SAVE_PANEL) + MB_THE_SAVE_PANEL = [[NSSavePanel alloc] init]; + return MB_THE_SAVE_PANEL; +} + +// +// Instance methods +// +// +// Initialization +// +- (void)setDefaults +{ + directory = @"\\"; + file_name = @""; + accessory_view = nil; + panel_title = @"Save File"; + panel_prompt = @""; + required_type = nil; + file_package = YES; +} + +- init +{ + [super init]; + + [self setDefaults]; + return self; +} + +// +// Customizing the NSSavePanel +// +- (void)setAccessoryView:(NSView *)aView +{ + accessory_view = aView; +} + +- (NSView *)accessoryView +{ + return accessory_view; +} + +- (void)setTitle:(NSString *)title +{ + panel_title = title; +} + +- (NSString *)title +{ + return panel_title; +} + +- (void)setPrompt:(NSString *)prompt +{ + panel_prompt = prompt; +} + +- (NSString *)prompt +{ + return panel_prompt; +} + +// +// Setting Directory and File Type +// +- (NSString *)requiredFileType +{ + return required_type; +} + +- (void)setDirectory:(NSString *)path +{ + directory = path; +} + +- (void)setRequiredFileType:(NSString *)type +{ + required_type = type; +} + +- (void)setTreatsFilePackagesAsDirectories:(BOOL)flag +{ + file_package = flag; +} + +- (BOOL)treatsFilePackagesAsDirectories +{ + return file_package; +} + +// +// Running the NSSavePanel +// +- (int)runModalForDirectory:(NSString *)path + file:(NSString *)filename +{ + if (path) + directory = path; + + if (filename) + file_name = filename; + + return [self runModal]; +} + +- (int)runModal +{ +} + +// +// Reading Save Information +// +- (NSString *)directory +{ + return directory; +} + +- (NSString *)filename +{ + return file_name; +} + +// +// Target and Action Methods +// +- (void)ok:(id)sender +{ + char *sp, files[4096]; + + strcpy(files, [file_name cString]); + sp = strrchr(files, '\\'); + if (sp != NULL) + { + sp++; + *sp = '\0'; + directory = [NSString stringWithCString:files]; + } +} + +- (void)cancel:(id)sender +{ +} + +// +// Responding to User Input +// +- (void)selectText:(id)sender +{} + +// +// Setting the Delegate +// +- (void)setDelegate:(id)anObject +{ + delegate = anObject; +} + +// +// Methods Implemented by the Delegate +// +- (NSComparisonResult)panel:(id)sender + compareFilename:(NSString *)filename1 +with:(NSString *)filename2 + caseSensitive:(BOOL)caseSensitive +{ + if ([delegate respondsToSelector: + @selector(panel:compareFilename:with:caseSensitive:)]) + return [delegate panel:sender compareFilename:filename1 + with:filename2 caseSensitive:caseSensitive]; +} + +- (BOOL)panel:(id)sender +shouldShowFilename:(NSString *)filename +{ + if ([delegate respondsToSelector:@selector(panel:shouldShowFilename:)]) + return [delegate panel:sender shouldShowFilename:filename]; +} + +- (BOOL)panel:(id)sender +isValidFilename:(NSString*)filename +{ + if ([delegate respondsToSelector:@selector(panel:isValidFilename:)]) + return [delegate panel:sender isValidFilename:filename]; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: accessory_view]; + [aCoder encodeObject: panel_title]; + [aCoder encodeObject: panel_prompt]; + [aCoder encodeObject: directory]; + [aCoder encodeObject: file_name]; + [aCoder encodeObject: required_type]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at:&required_type]; + [aCoder encodeObjectReference: delegate withName: @"Delegate"]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + accessory_view = [aDecoder decodeObject]; + panel_title = [aDecoder decodeObject]; + panel_prompt = [aDecoder decodeObject]; + directory = [aDecoder decodeObject]; + file_name = [aDecoder decodeObject]; + required_type = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at:&required_type]; + [aDecoder decodeObjectAt: &delegate withName: NULL]; + + return self; +} + +@end diff --git a/Source/NSScreen.m b/Source/NSScreen.m new file mode 100644 index 000000000..43dacbe74 --- /dev/null +++ b/Source/NSScreen.m @@ -0,0 +1,94 @@ +/* + NSScreen.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +// Global device dictionary key strings +NSString *NSDeviceResolution = @"Resolution"; +NSString *NSDeviceColorSpaceName = @"ColorSpaceName"; +NSString *NSDeviceBitsPerSample = @"BitsPerSample"; +NSString *NSDeviceIsScreen = @"IsScreen"; +NSString *NSDeviceIsPrinter = @"IsPrinter"; +NSString *NSDeviceSize = @"Size"; + +@implementation NSScreen + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSScreen class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Creating NSScreen Instances +// ++ (NSScreen *)mainScreen +{ + return nil; +} + ++ (NSScreen *)deepestScreen +{ + return nil; +} + ++ (NSArray *)screens +{ + return nil; +} + +// +// Instance methods +// +// +// Reading Screen Information +// +- (NSWindowDepth)depth +{ + return 0; +} + +- (NSRect)frame +{ + return NSZeroRect; +} + +- (NSDictionary *)deviceDescription +{ + return nil; +} + +@end diff --git a/Source/NSScrollView.m b/Source/NSScrollView.m new file mode 100644 index 000000000..2a935ed7d --- /dev/null +++ b/Source/NSScrollView.m @@ -0,0 +1,209 @@ +/* + NSScrollView.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSScrollView + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSScrollView class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Laying Out the NSScrollView +// ++ (NSSize)contentSizeForFrameSize:(NSSize)size + hasHorizontalScroller:(BOOL)horizFlag +hasVerticalScroller:(BOOL)vertFlag + borderType:(NSBorderType)aType +{ + return NSZeroSize; +} + ++ (NSSize)frameSizeForContentSize:(NSSize)size + hasHorizontalScroller:(BOOL)horizFlag +hasVerticalScroller:(BOOL)vertFlag + borderType:(NSBorderType)aType +{ + return NSZeroSize; +} + +// +// Instance methods +// +// +// Determining Component Sizes +// +- (NSSize)contentSize +{ + return NSZeroSize; +} + +- (NSRect)documentVisibleRect +{ + return NSZeroRect; +} + +// +// Laying Out the NSScrollView +// +- (void)setHasHorizontalScroller:(BOOL)flag +{} + +- (BOOL)hasHorizontalScroller +{ + return NO; +} + +- (void)setHasVerticalScroller:(BOOL)flag +{} + +- (BOOL)hasVerticalScroller +{ + return NO; +} + +- (void)tile +{} + +- (void)toggleRuler:(id)sender +{} + +- (BOOL)isRulerVisible +{ + return NO; +} + +// +// Managing Component Views +// +- (void)setDocumentView:(NSView *)aView +{} + +- (id)documentView +{ + return nil; +} + +- (void)setHorizontalScroller:(NSScroller *)anObject +{} + +- (NSScroller *)horizontalScroller +{ + return nil; +} + +- (void)setVerticalScroller:(NSScroller *)anObject +{} + +- (NSScroller *)verticalScroller +{ + return nil; +} + +- (void)reflectScrolledClipView:(NSClipView *)cView +{} + +// +// Modifying Graphic Attributes +// +- (void)setBorderType:(NSBorderType)aType +{} + +- (NSBorderType)borderType +{ + return 0; +} + +- (void)setBackgroundColor:(NSColor *)color +{} + +- (NSColor *)backgroundColor +{ + return nil; +} + +// +// Setting Scrolling Behavior +// +- (float)lineScroll +{ + return 0.0; +} + +- (float)pageScroll +{ + return 0.0; +} + +- (void)setScrollsDynamically:(BOOL)flag +{} + +- (BOOL)scrollsDynamically +{ + return NO; +} + +- (void)setLineScroll:(float)value +{} + +- (void)setPageScroll:(float)value +{} + +// +// Managing the Cursor +// +- (void)setDocumentCursor:(NSCursor *)anObject +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSScroller.m b/Source/NSScroller.m new file mode 100644 index 000000000..6676ee336 --- /dev/null +++ b/Source/NSScroller.m @@ -0,0 +1,177 @@ +/* + NSScroller.m + + The scroller class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include + +@implementation NSScroller + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSScroller class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Laying out the NSScroller +// ++ (float)scrollerWidth +{ + return 0; +} + +// +// Instance methods +// +- init +{ + return [self initWithFrame:NSZeroRect]; +} + +- initWithFrame:(NSRect)frameRect +{ + [super initWithFrame:frameRect]; + if (frame.size.width > frame.size.height) + is_horizontal = YES; + else + is_horizontal = NO; + target = nil; + action = NULL; + return self; +} +// +// Laying out the NSScroller +// +- (NSScrollArrowPosition)arrowsPosition +{ + return 0; +} + +- (void)checkSpaceForParts +{} + +- (NSRect)rectForPart:(NSScrollerPart)partCode +{ + return NSZeroRect; +} + +- (void)setArrowsPosition:(NSScrollArrowPosition)where +{} + +- (NSUsableScrollerParts)usableParts +{ + return 0; +} + +// +// Setting the NSScroller's Values +// +- (float)knobProportion +{ + return 0; +} + +- (void)setFloatValue:(float)aFloat + knobProportion:(float)ratio +{} + +// +// Displaying +// +- (void)drawRect:(NSRect)rect +{ +} + +- (void)drawArrow:(NSScrollerArrow)whichButton + highlight:(BOOL)flag +{} + +- (void)drawKnob +{} + +- (void)drawParts +{} + +- (void)highlight:(BOOL)flag +{} + +// +// Handling Events +// +- (NSScrollerPart)hitPart +{ + return 0; +} + +- (NSScrollerPart)testPart:(NSPoint)thePoint +{ + return 0; +} + +- (void)trackKnob:(NSEvent *)theEvent +{} + +- (void)trackScrollButtons:(NSEvent *)theEvent +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_horizontal]; + [aCoder encodeValueOfObjCType: @encode(SEL) at: &action]; + [aCoder encodeObjectReference: target withName: @"Target"]; + [aCoder encodeValuesOfObjCTypes: "ff", &percent, &cur_value]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_horizontal]; + [aDecoder decodeValueOfObjCType: @encode(SEL) at: &action]; + [aDecoder decodeObjectAt: &target withName: NULL]; + [aDecoder decodeValuesOfObjCTypes: "ff", &percent, &cur_value]; + + return self; +} + +@end + diff --git a/Source/NSSelection.m b/Source/NSSelection.m new file mode 100644 index 000000000..3a348f2b6 --- /dev/null +++ b/Source/NSSelection.m @@ -0,0 +1,124 @@ +/* + NSSelection.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSSelection + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSSelection class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Returning Special Selection Shared Instances +// ++ (NSSelection *)allSelection +{ + return nil; +} + ++ (NSSelection *)currentSelection +{ + return nil; +} + ++ (NSSelection *)emptySelection +{ + return nil; +} + +// +// Creating and Initializing a Selection +// ++ (NSSelection *)selectionWithDescriptionData:(NSData *)data +{ + return nil; +} + +// +// Instance methods +// + +// +// Creating and Initializing a Selection +// +- (id)initWithDescriptionData:(NSData *)newData +{ + return nil; +} + +- (id)initWithPasteboard:(NSPasteboard *)pasteboard +{ + return nil; +} + +// +// Describing a Selection +// +- (NSData *)descriptionData +{ + return nil; +} + +- (BOOL)isWellKnownSelection +{ + return NO; +} + +// +// Writing a Selection to the Pasteboard +// +- (void)writeToPasteboard:(NSPasteboard *)pasteboard +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSSlider.m b/Source/NSSlider.m new file mode 100644 index 000000000..200fac973 --- /dev/null +++ b/Source/NSSlider.m @@ -0,0 +1,213 @@ +/* + NSSlider.m + + The slider control class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +// +// class variables +// +id MB_NSSLIDER_CLASS; + +// +// NSSlider implementation +// +@implementation NSSlider + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSSlider class]) + { + // Initial version + [self setVersion:1]; + + // Set our cell class to NSSliderCell + [self setCellClass:[NSSliderCell class]]; + } +} + +// +// Setting the Cell Class +// ++ (Class)cellClass +{ + return MB_NSSLIDER_CLASS; +} + ++ (void)setCellClass:(Class)classId +{ + MB_NSSLIDER_CLASS = classId; +} + +// +// Instance methods +// + +// +// Initialization +// +- initWithFrame:(NSRect)frameRect +{ + [super initWithFrame:frameRect]; + + // set our cell + [[self cell] release]; + [self setCell:[[MB_NSSLIDER_CLASS alloc] init]]; + if (frame.size.width > frame.size.height) + [cell setVertical:NO]; + else + [cell setVertical:YES]; + [cell setState:1]; + return self; +} + +// +// Modifying an NSSlider's Appearance +// +- (NSImage *)image +{ + return nil; +} + +- (int)isVertical +{ + return [cell isVertical]; +} + +- (float)knobThickness +{ + return [cell knobThickness]; +} + +- (void)setImage:(NSImage *)backgroundImage +{} + +- (void)setKnobThickness:(float)aFloat +{ + [cell setKnobThickness:aFloat]; +} + +- (void)setTitle:(NSString *)aString +{} + +- (void)setTitleCell:(NSCell *)aCell +{} + +- (void)setTitleColor:(NSColor *)aColor +{} + +- (void)setTitleFont:(NSFont *)fontObject +{} + +- (NSString *)title +{ + return nil; +} + +- (id)titleCell +{ + return nil; +} + +- (NSColor *)titleColor +{ + return nil; +} + +- (NSFont *)titleFont +{ + return nil; +} + +// +// Setting and Getting Value Limits +// +- (double)maxValue +{ + return [cell maxValue]; +} + +- (double)minValue +{ + return [cell minValue]; +} + +- (void)setMaxValue:(double)aDouble +{ + [cell setMaxValue:aDouble]; +} + +- (void)setMinValue:(double)aDouble +{ + [cell setMinValue:aDouble]; +} + +// +// Handling Events +// +- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent +{ + return NO; +} + +// +// Handling Events and Action Messages +// +- (void)mouseDown:(NSEvent *)theEvent +{ +} + +// +// Displaying +// +- (void)drawRect:(NSRect)rect +{ + [cell drawWithFrame:rect inView:self]; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} + +@end diff --git a/Source/NSSliderCell.m b/Source/NSSliderCell.m new file mode 100644 index 000000000..e7857f29a --- /dev/null +++ b/Source/NSSliderCell.m @@ -0,0 +1,297 @@ +/* + NSSliderCell.m + + Cell class for slider control + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include +#include + +// +// NSSliderCell implementation +// +@implementation NSSliderCell + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSSliderCell class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// +// +// Initialization +// +- init +{ + [self initTextCell:@""]; + return self; +} + +- initImageCell:(NSImage *)anImage +{ + return nil; +} + +- initTextCell:(NSString *)aString +{ + [super initTextCell:aString]; + [self setEnabled:YES]; + knob_thickness = 6; + page_value = 6; + [self setDoubleValue:0]; + return self; +} + +- (void)dealloc +{ + [super dealloc]; +} + +// +// Determining Component Sizes +// +- (NSSize)cellSizeForBounds:(NSRect)aRect +{ + return NSZeroSize; +} + +- (NSRect)knobRectFlipped:(BOOL)flipped +{ + return NSZeroRect; +} + +// +// Setting the NSCell's Value +// +- (void)setDoubleValue:(double)aDouble +{ + double value = aDouble; + + if (aDouble < min_value) value = min_value; + if (aDouble > max_value) value = max_value; + [super setDoubleValue:value]; +} + +- (void)setFloatValue:(float)aFloat +{ + [self setDoubleValue:(double)aFloat]; +} + +- (void)setIntValue:(int)anInt +{ + [self setDoubleValue:(double)anInt]; +} + +- (void)setStringValue:(NSString *)aString +{ +} + +// +// Setting Value Limits +// +- (double)maxValue +{ + return max_value; +} + +- (double)minValue +{ + return min_value; +} + +- (void)setMaxValue:(double)aDouble +{ + double val_range,value; + + max_value = aDouble; + val_range = max_value - min_value; + if (val_range != 0) + //Lowest position assumed to be 0 + scale_factor = scroll_size/val_range; +} + +- (void)setMinValue:(double)aDouble +{ + double val_range,value; + + min_value = aDouble; + val_range = max_value - min_value; + if (val_range != 0) + scale_factor = scroll_size/val_range; +} + +// +// Modifying Graphic Attributes +// +- (void)setVertical:(BOOL)value +{ + is_vertical = value; +} + +- (int)isVertical +{ + return is_vertical; +} + +- (float)knobThickness +{ + return knob_thickness; +} + +- (void)setKnobThickness:(float)aFloat +{ + knob_thickness = aFloat; +} + +- (void)setTitle:(NSString *)aString +{} + +- (void)setTitleCell:(NSCell *)aCell +{} + +- (void)setTitleColor:(NSColor *)aColor +{} + +- (void)setTitleFont:(NSFont *)fontObject +{} + +- (NSString *)title +{ + return nil; +} + +- (id)titleCell +{ + return nil; +} + +- (NSFont *)titleFont +{ + return nil; +} + +- (NSColor *)titleColor +{ + return nil; +} + +// +// Displaying the NSSliderCell +// +- (void)drawBarInside:(NSRect)aRect + flipped:(BOOL)flipped +{} + +- (void)drawKnob +{} + +- (void)drawKnob:(NSRect)knobRect +{} + +// +// Modifying Behavior +// +- (double)altIncrementValue +{ + return page_value; +} + +- (void)setAltIncrementValue:(double)incValue +{ + page_value = incValue; +} + +// +// Tracking the Mouse +// ++ (BOOL)prefersTrackingUntilMouseUp +{ + return NO; +} + +- (NSRect)trackRect +{ + return NSZeroRect; +} + +// +// Displaying +// +- (void)drawWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView +{ +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeValueOfObjCType: "d" at: &max_value]; + [aCoder encodeValueOfObjCType: "d" at: &min_value]; + [aCoder encodeValueOfObjCType: "d" at: &scale_factor]; + [aCoder encodeValueOfObjCType: "i" at: &scroll_size]; + [aCoder encodeValueOfObjCType: "i" at: &knob_thickness]; + [aCoder encodeValueOfObjCType: "d" at: &page_value]; +// [aCoder encodeValuesOfObjCTypes: "dddiid", &max_value, &min_value, +// &scale_factor, &scroll_size, &knob_thickness, &page_value]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_vertical]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + [aDecoder decodeValueOfObjCType: "d" at: &max_value]; + [aDecoder decodeValueOfObjCType: "d" at: &min_value]; + [aDecoder decodeValueOfObjCType: "d" at: &scale_factor]; + [aDecoder decodeValueOfObjCType: "i" at: &scroll_size]; + [aDecoder decodeValueOfObjCType: "i" at: &knob_thickness]; + [aDecoder decodeValueOfObjCType: "d" at: &page_value]; +// [aDecoder decodeValuesOfObjCTypes: "dddiid", &max_value, &min_value, +// &scale_factor, &scroll_size, &knob_thickness, &page_value]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_vertical]; + + return self; +} + +@end + diff --git a/Source/NSSpellChecker.m b/Source/NSSpellChecker.m new file mode 100644 index 000000000..5ad6deb3d --- /dev/null +++ b/Source/NSSpellChecker.m @@ -0,0 +1,154 @@ +/* + NSSpellChecker.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSSpellChecker + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSSpellChecker class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Making a Checker available +// ++ (NSSpellChecker *)sharedSpellChecker +{ + return nil; +} + ++ (BOOL)sharedSpellCheckerExists +{ + return NO; +} + +// +// Managing the Spelling Process +// ++ (int)uniqueSpellDocumentTag +{ + return 0; +} + +// +// Instance methods +// +// +// Managing the Spelling Panel +// +- (NSView *)accessoryView +{ + return nil; +} + +- (void)setAccessoryView:(NSView *)aView +{} + +- (NSPanel *)spellingPanel +{ + return nil; +} + +// +// Checking Spelling +// +- (int)countWordsInString:(NSString *)aString + language:(NSString *)language +{ + return 0; +} + +- (NSRange)checkSpellingOfString:(NSString *)stringToCheck + startingAt:(int)startingOffset +{ + NSRange r; + + return r; +} + +- (NSRange)checkSpellingOfString:(NSString *)stringToCheck + startingAt:(int)startingOffset +language:(NSString *)language + wrap:(BOOL)wrapFlag +inSpellDocumentWithTag:(int)tag + wordCount:(int *)wordCount +{ + NSRange r; + + return r; +} + +// +// Setting the Language +// +- (NSString *)language +{ + return nil; +} + +- (BOOL)setLanguage:(NSString *)aLanguage +{ + return NO; +} + +// +// Managing the Spelling Process +// +- (void)closeSpellDocumentWithTag:(int)tag +{} + +- (void)ignoreWord:(NSString *)wordToIgnore +inSpellDocumentWithTag:(int)tag +{} + +- (NSArray *)ignoredWordsInSpellDocumentWithTag:(int)tag +{ + return nil; +} + +- (void)setIgnoredWords:(NSArray *)someWords + inSpellDocumentWithTag:(int)tag +{} + +- (void)setWordFieldStringValue:(NSString *)aString +{} + +- (void)updateSpellingPanelWithMisspelledWord:(NSString *)word +{} + +@end diff --git a/Source/NSSpellServer.m b/Source/NSSpellServer.m new file mode 100644 index 000000000..94966ce3e --- /dev/null +++ b/Source/NSSpellServer.m @@ -0,0 +1,116 @@ +/* + NSSpellServer.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation NSSpellServer + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSSpellServer class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// +// +// Checking in Your Service +// +- (BOOL)registerLanguage:(NSString *)language + byVendor:(NSString *)vendor +{ + return NO; +} + +// +// Assigning a Delegate +// +- (id)delegate +{ + return nil; +} + +- (void)setDelegate:(id)anObject +{} + +// +// Running the Service +// +- (void)run +{} + +// +// Checking User Dictionaries +// +- (BOOL)isWordInUserDictionaries:(NSString *)word + caseSensitive:(BOOL)flag +{ + return NO; +} + +// +// Methods Implemented by the Delegate +// +- (NSRange)spellServer:(NSSpellServer *)sender +findMisspelledWordInString:(NSString *)stringToCheck +language:(NSString *)language +wordCount:(int *)wordCount +countOnly:(BOOL)countOnly +{ + NSRange r; + + return r; +} + +- (NSArray *)spellServer:(NSSpellServer *)sender + suggestGuessesForWord:(NSString *)word +inLanguage:(NSString *)language +{ + return nil; +} + +- (void)spellServer:(NSSpellServer *)sender + didLearnWord:(NSString *)word +inLanguage:(NSString *)language +{} + +- (void)spellServer:(NSSpellServer *)sender + didForgetWord:(NSString *)word +inLanguage:(NSString *)language +{} + +@end diff --git a/Source/NSSplitView.m b/Source/NSSplitView.m new file mode 100644 index 000000000..0f0179fd0 --- /dev/null +++ b/Source/NSSplitView.m @@ -0,0 +1,113 @@ +/* + NSSplitView.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +// NSSplitView notifications +NSString *NSSplitViewDidResizeSubviewsNotification; +NSString *NSSplitViewWillResizeSubviewsNotification; + +@implementation NSSplitView + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSSplitView class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// + +// +// Managing Component Views +// +- (void)adjustSubviews +{} + +- (float)dividerThickness +{ + return 0.0; +} + +- (void)drawDividerInRect:(NSRect)aRect +{} + +// +// Assigning a Delegate +// +- (id)delegate +{ + return nil; +} + +- (void)setDelegate:(id)anObject +{} + +// +// Implemented by the Delegate +// +- (void)splitView:(NSSplitView *)splitView +constrainMinCoordinate:(float *)min +maxCoordinate:(float *)max +ofSubviewAt:(int)offset +{} + +- (void)splitView:(NSSplitView *)sender +resizeSubviewsWithOldSize:(NSSize)oldSize +{} + +- (void)splitViewDidResizeSubviews:(NSNotification *)notification +{} + +- (void)splitViewWillResizeSubviews:(NSNotification *)notification +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + return self; +} +@end diff --git a/Source/NSText.m b/Source/NSText.m new file mode 100644 index 000000000..766ab40bf --- /dev/null +++ b/Source/NSText.m @@ -0,0 +1,578 @@ +/* + NSText.m + + The RTFD text class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include + +// NSText notifications +NSString *NSTextDidBeginEditingNotification; +NSString *NSTextDidEndEditingNotification; +NSString *NSTextDidChangeNotification; + +// +// NSText implementation +// +@implementation NSText + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSText class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// +// +// Initialization +// +- initWithFrame:(NSRect)frameRect +{ + [super initWithFrame:frameRect]; + + text_contents = @"Field"; + alignment = NSLeftTextAlignment; + is_editable = YES; + is_rich_text = NO; + is_selectable = YES; + imports_graphics = NO; + uses_font_panel = YES; + is_horizontally_resizable = YES; + is_vertically_resizable = YES; + is_ruler_visible = NO; + is_field_editor = NO; + background_color = [NSColor whiteColor]; + text_color = [NSColor blackColor]; + default_font = [NSFont userFontOfSize:12]; + return self; +} +// +// Getting and Setting Contents +// +- (void)replaceRange:(NSRange)range + withRTF:(NSData *)rtfData +{} + +- (void)replaceRange:(NSRange)range + withRTFD:(NSData *)rtfdData +{} + +- (NSData *)RTFDFromRange:(NSRange)range +{ + return nil; +} + +- (NSData *)RTFFromRange:(NSRange)range +{ + return nil; +} + +- (void)setText:(NSString *)string +{ + text_contents = string; +} + +- (void)setText:(NSString *)string + range:(NSRange)range +{ + [self setSelectedRange:range]; +} + +- (NSString *)text +{ + return text_contents; +} + +// +// Managing Global Characteristics +// +- (NSTextAlignment)alignment +{ + return alignment; +} + +- (BOOL)drawsBackground +{ + return YES; +} + +- (BOOL)importsGraphics +{ + return imports_graphics; +} + +- (BOOL)isEditable +{ + return is_editable; +} + +- (BOOL)isRichText +{ + return is_rich_text; +} + +- (BOOL)isSelectable +{ + return is_selectable; +} + +- (void)setAlignment:(NSTextAlignment)mode +{ + alignment = mode; +} + +- (void)setDrawsBackground:(BOOL)flag +{} + +- (void)setEditable:(BOOL)flag +{ + is_editable = flag; + // If we are editable then we are selectable + if (flag) + is_selectable = YES; +} + +- (void)setImportsGraphics:(BOOL)flag +{ + imports_graphics = flag; +} + +- (void)setRichText:(BOOL)flag +{ + is_rich_text = flag; +} + +- (void)setSelectable:(BOOL)flag +{ + is_selectable = flag; + // If we are not selectable then we must not be editable + if (!flag) + is_editable = NO; +} + +// +// Managing Font and Color +// +- (NSColor *)backgroundColor +{ + return background_color; +} + +- (void)changeFont:(id)sender +{ +} + +- (NSFont *)font +{ + return default_font; +} + +- (void)setBackgroundColor:(NSColor *)color +{ + background_color = color; +} + +- (void)setColor:(NSColor *)color + ofRange:(NSRange)range +{ +} + +- (void)setFont:(NSFont *)obj +{ +} + +- (void)setFont:(NSFont *)font + ofRange:(NSRange)range +{ +} + +- (void)setTextColor:(NSColor *)color +{ + text_color = color; +} + +- (void)setUsesFontPanel:(BOOL)flag +{ + uses_font_panel = YES; +} + +- (NSColor *)textColor +{ + return text_color; +} + +- (BOOL)usesFontPanel +{ + return uses_font_panel; +} + +// +// Managing the Selection +// +- (NSRange)selectedRange +{ + return selected_range; +} + +- (void)setSelectedRange:(NSRange)range +{ + selected_range = range; +} + +// +// Sizing the Frame Rectangle +// +- (void)setFrame:(NSRect)frameRect +{ + [super setFrame:frameRect]; +} + +- (BOOL)isHorizontallyResizable +{ + return is_horizontally_resizable; +} + +- (BOOL)isVerticallyResizable +{ + return is_vertically_resizable; +} + +- (NSSize)maxSize +{ + return NSZeroSize; +} + +- (NSSize)minSize +{ + return NSZeroSize; +} + +- (void)setHorizontallyResizable:(BOOL)flag +{ + is_horizontally_resizable = flag; +} + +- (void)setMaxSize:(NSSize)newMaxSize +{} + +- (void)setMinSize:(NSSize)newMinSize +{} + +- (void)setVerticallyResizable:(BOOL)flag +{ + is_vertically_resizable = flag; +} + +- (void)sizeToFit +{} + +// +// Responding to Editing Commands +// +- (void)alignCenter:(id)sender +{} + +- (void)alignLeft:(id)sender +{} + +- (void)alignRight:(id)sender +{} + +- (void)copy:(id)sender +{ +} + +- (void)copyFont:(id)sender +{} + +- (void)copyRuler:(id)sender +{} + +- (void)cut:(id)sender +{ +} + +- (void)delete:(id)sender +{} + +- (void)paste:(id)sender +{ +} + +- (void)pasteFont:(id)sender +{} + +- (void)pasteRuler:(id)sender +{} + +- (void)selectAll:(id)sender +{ +} + +- (void)subscript:(id)sender +{ +} + +- (void)superscript:(id)sender +{ +} + +- (void)underline:(id)sender +{ +} + +- (void)unscript:(id)sender +{ +} + +// +// Managing the Ruler +// +- (BOOL)isRulerVisible +{ + return NO; +} + +- (void)toggleRuler:(id)sender +{} + +// +// Spelling +// +- (void)checkSpelling:(id)sender +{} + +- (void)showGuessPanel:(id)sender +{} + +// +// Scrolling +// +- (void)scrollRangeToVisible:(NSRange)range +{} + +// +// Reading and Writing RTFD Files +// +- (BOOL)readRTFDFromFile:(NSString *)path +{ + return NO; +} + +- (BOOL)writeRTFDToFile:(NSString *)path + atomically:(BOOL)flag +{ + return NO; +} + +// +// Managing the Field Editor +// +- (BOOL)isFieldEditor +{ + return is_field_editor; +} + +- (void)setFieldEditor:(BOOL)flag +{ + is_field_editor = flag; +} + +// +// Handling Events +// +- (void)mouseDown:(NSEvent *)theEvent +{ + // If not selectable then don't recognize the mouse down + if (!is_selectable) return; + + [[self window] makeFirstResponder:self]; +} + +- (void)mouseUp:(NSEvent *)theEvent +{ + // If not selectable then don't recognize the mouse up + if (!is_selectable) return; +} + +- (void)mouseMoved:(NSEvent *)theEvent +{ + // If not selectable then don't recognize the mouse moved + if (!is_selectable) return; +} + +- (void)keyDown:(NSEvent *)theEvent +{ + // If not editable then don't recognize the key down + if (!is_editable) return; +} + +- (void)keyUp:(NSEvent *)theEvent +{ + // If not editable then don't recognize the key up + if (!is_editable) return; +} + +- (BOOL)acceptsFirstResponder +{ + if ([self isSelectable]) + return YES; + else + return NO; +} + +- (BOOL)becomeFirstResponder +{ + if ([self isEditable]) + { + return YES; + } + else + { + return NO; + } +} + +// +// Managing the Delegate +// +- (id)delegate +{ + return delegate; +} + +- (void)setDelegate:(id)anObject +{ + delegate = anObject; +} + +// +// Implemented by the Delegate +// +- (void)textDidBeginEditing:(NSNotification *)aNotification +{ + if ([delegate respondsToSelector:@selector(textDidBeginEditing:)]) + [delegate textDidBeginEditing:nil]; +} + +- (void)textDidChange:(NSNotification *)aNotification +{ + if ([delegate respondsToSelector:@selector(textDidChange:)]) + [delegate textDidChange:nil]; +} + +- (void)textDidEndEditing:(NSNotification *)aNotification +{ + if ([delegate respondsToSelector:@selector(textDidEndEditing:)]) + [delegate textDidEndEditing:nil]; +} + +- (BOOL)textShouldBeginEditing:(NSText *)textObject +{ + if ([delegate respondsToSelector:@selector(textShouldBeginEditing:)]) + return [delegate textShouldBeginEditing:nil]; + else + return YES; +} + +- (BOOL)textShouldEndEditing:(NSText *)textObject +{ + if ([delegate respondsToSelector:@selector(textShouldEndEditing:)]) + return [delegate textShouldEndEditing:nil]; + else + return YES; +} + +// +// Displaying +// +- (void)drawRect:(NSRect)rect +{ +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObjectReference: delegate withName: @"Delegate"]; + [aCoder encodeObject: text_contents]; + [aCoder encodeValueOfObjCType: "I" at: &alignment]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_editable]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_rich_text]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_selectable]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &imports_graphics]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &uses_font_panel]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_horizontally_resizable]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_vertically_resizable]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_ruler_visible]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_field_editor]; + [aCoder encodeObject: background_color]; + [aCoder encodeObject: text_color]; + [aCoder encodeObject: default_font]; + [aCoder encodeValueOfObjCType: @encode(NSRange) at: &selected_range]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + [aDecoder decodeObjectAt: &delegate withName: NULL]; + text_contents = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: "I" at: &alignment]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_editable]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_rich_text]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_selectable]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &imports_graphics]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &uses_font_panel]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) + at: &is_horizontally_resizable]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_vertically_resizable]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_ruler_visible]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_field_editor]; + background_color = [aDecoder decodeObject]; + text_color = [aDecoder decodeObject]; + default_font = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: @encode(NSRange) at: &selected_range]; + + return self; +} + +@end diff --git a/Source/NSTextField.m b/Source/NSTextField.m new file mode 100644 index 000000000..97a3f0d5e --- /dev/null +++ b/Source/NSTextField.m @@ -0,0 +1,426 @@ +/* + NSTextField.m + + Text field control class for text entry + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include + +// +// class variables +// +id MB_NSTEXTFIELDCELL_CLASS; + +@implementation NSTextField + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSTextField class]) + { + // Initial version + [self setVersion:1]; + + // Set our cell class to NSTextFieldCell + [self setCellClass:[NSTextFieldCell class]]; + } +} + +// +// Initializing the NSTextField Factory +// ++ (Class)cellClass +{ + return MB_NSTEXTFIELDCELL_CLASS; +} + ++ (void)setCellClass:(Class)classId +{ + MB_NSTEXTFIELDCELL_CLASS = classId; +} + +// +// Instance methods +// +- init +{ + return [self initWithFrame:NSZeroRect]; +} + +- initWithFrame:(NSRect)frameRect +{ + [super initWithFrame:frameRect]; + + // set our cell + [[self cell] release]; + [self setCell:[[MB_NSTEXTFIELDCELL_CLASS alloc] init]]; + [cell setState:1]; + + return self; +} + +// +// Setting User Access to Text +// +- (BOOL)isEditable +{ + return [cell isEditable]; +} + +- (BOOL)isSelectable +{ + return [cell isSelectable]; +} + +- (void)setEditable:(BOOL)flag +{ + [cell setEditable:flag]; +} + +- (void)setSelectable:(BOOL)flag +{ + [cell setSelectable:flag]; +} + +// +// Editing Text +// +- (void)selectText:(id)sender +{ + if ([[self window] makeFirstResponder:self]) + [cell selectText:sender]; +} + +// +// Setting Tab Key Behavior +// +- (id)nextText +{ + return next_text; +} + +- (id)previousText +{ + return previous_text; +} + +- (void)setNextText:(id)anObject +{ + id t; + + next_text = anObject; + + // Tell the object that we are the previous text + // Unless it already knows that + if ([anObject respondsToSelector:@selector(setPreviousText:)]) + { + t = [anObject previousText]; + if (t != self) + [anObject setPreviousText:self]; + } +} + +- (void)setPreviousText:(id)anObject +{ + id t; + + previous_text = anObject; + + // Tell the object that we are the next text + // Unless it already knows that + if ([anObject respondsToSelector:@selector(setNextText:)]) + { + t = [anObject nextText]; + if (t != self) + [anObject setNextText:self]; + } +} + +// +// Assigning a Delegate +// +- (void)setDelegate:(id)anObject +{ + text_delegate = anObject; +} + +- (id)delegate +{ + return text_delegate; +} + +// +// Drawing +// +- (void)drawRect:(NSRect)rect +{ + [cell drawWithFrame:rect inView:self]; +} + +// +// Modifying Graphic Attributes +// +- (NSColor *)backgroundColor +{ + return [cell backgroundColor]; +} + +- (BOOL)drawsBackground +{ + return [cell drawsBackground]; +} + +- (BOOL)isBezeled +{ + return [cell isBezeled]; +} + +- (BOOL)isBordered +{ + return [cell isBordered]; +} + +- (void)setBackgroundColor:(NSColor *)aColor +{ + [cell setBackgroundColor:aColor]; +} + +- (void)setBezeled:(BOOL)flag +{ + [cell setBezeled:flag]; +} + +- (void)setBordered:(BOOL)flag +{ + [cell setBordered:flag]; +} + +- (void)setDrawsBackground:(BOOL)flag +{ + [cell setDrawsBackground:flag]; +} + +- (void)setTextColor:(NSColor *)aColor +{ + [cell setTextColor:aColor]; +} + +- (NSColor *)textColor +{ + return [cell textColor]; +} + +// +// Target and Action +// +- (SEL)errorAction +{ + return error_action; +} + +- (void)setErrorAction:(SEL)aSelector +{ + error_action = aSelector; +} + +// +// Handling Events +// +- (void)mouseDown:(NSEvent *)theEvent +{ + // If not selectable then don't recognize the mouse down + if (![self isSelectable]) return; + + [[self window] makeFirstResponder:self]; +} + +- (void)mouseUp:(NSEvent *)theEvent +{ + // If not selectable then don't recognize the mouse up + if (![self isSelectable]) return; +} + +- (void)mouseMoved:(NSEvent *)theEvent +{ + // If not selectable then don't recognize the mouse moved + if (![self isSelectable]) return; +} + +- (void)keyDown:(NSEvent *)theEvent +{ + int result; + unsigned int flags = [theEvent modifierFlags]; + unsigned int key_code = [theEvent keyCode]; + char out[80]; + + // If SHIFT-TAB key then make the previous text the first responder + if ((key_code == 0x09) && (flags & NSShiftKeyMask)) + { + if ([previous_text respondsToSelector:@selector(selectText:)]) + // Either select the previous' text + [previous_text selectText:self]; + else + // Or select ourself + [self selectText:self]; + + // Have the target perform the action + [self sendAction:[self action] to:[self target]]; + + return; + } + + // If TAB key then make the next text the first responder + if (key_code == 0x09) + { + if ([next_text respondsToSelector:@selector(selectText:)]) + // Either select the next's text + [next_text selectText:self]; + else + // Or select ourself + [self selectText:self]; + + // Have the target perform the action + [self sendAction:[self action] to:[self target]]; + + return; + } + + // If RETURN key then make the next text the first responder + if (key_code == 0x0d) + { + if ([next_text respondsToSelector:@selector(selectText:)]) + // Either select the next's text + [next_text selectText:self]; + else + // Or select ourself + [self selectText:self]; + + // Have the target perform the action + [self sendAction:[self action] to:[self target]]; + + return; + } + + // If not editable then don't recognize the key down + if (![self isEditable]) return; +} + +- (void)keyUp:(NSEvent *)theEvent +{ + unsigned int key_code = [theEvent keyCode]; + + // Ignore TAB and RETURN key + if ((key_code == 0x09) || (key_code == 0x0d)) + { + return; + } + + // If not editable then don't recognize the key up + if (![self isEditable]) return; +} + +- (BOOL)acceptsFirstResponder +{ + if ([self isSelectable]) + return YES; + else + return NO; +} + +- (BOOL)becomeFirstResponder +{ + if ([self isSelectable]) + { + [cell selectText:self]; + return YES; + } + else + { + return NO; + } +} + +- (void)textDidBeginEditing:(NSNotification *)aNotification +{ + if ([text_delegate respondsTo:@selector(textDidBeginEditing:)]) + return [text_delegate textDidBeginEditing:aNotification]; +} + +- (void)textDidChange:(NSNotification *)aNotification +{ + if ([text_delegate respondsTo:@selector(textDidChange:)]) + return [text_delegate textDidChange:aNotification]; +} + +- (void)textDidEndEditing:(NSNotification *)aNotification +{ + if ([text_delegate respondsTo:@selector(textDidEndEditing:)]) + return [text_delegate textDidEndEditing:aNotification]; +} + +- (BOOL)textShouldBeginEditing:(NSText *)textObject +{ + return YES; +} + +- (BOOL)textShouldEndEditing:(NSText *)textObject +{ + return YES; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObjectReference: next_text withName: @"Next text"]; + [aCoder encodeObjectReference: previous_text withName: @"Previous text"]; + [aCoder encodeObjectReference: text_delegate withName: @"Text delegate"]; + [aCoder encodeValueOfObjCType: @encode(SEL) at: &error_action]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + [aDecoder decodeObjectAt: &next_text withName: NULL]; + [aDecoder decodeObjectAt: &previous_text withName: NULL]; + [aDecoder decodeObjectAt: &text_delegate withName: NULL]; + [aDecoder decodeValueOfObjCType: @encode(SEL) at: &error_action]; + + return self; +} + +@end + diff --git a/Source/NSTextFieldCell.m b/Source/NSTextFieldCell.m new file mode 100644 index 000000000..fa14789e4 --- /dev/null +++ b/Source/NSTextFieldCell.m @@ -0,0 +1,207 @@ +/* + NSTextFieldCell.m + + Cell class for the text field entry control + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include +#include + +// +// TextFieldCell implementation +// +@implementation NSTextFieldCell + +/////////////////////////////////////////////////////////////// +// +// Class methods +// + ++ (void)initialize +{ + if (self == [NSTextFieldCell class]) + { + // Initial version + [self setVersion:1]; + } +} + +/////////////////////////////////////////////////////////////// +// +// Instance methods +// +// +// Initialization +// +- init +{ + [self initTextCell:[NSString stringWithCString:"Field"]]; + return self; +} + +- initTextCell:(NSString *)aString +{ + [super initTextCell:aString]; + + [self setEnabled:YES]; + [self setBordered:YES]; + [self setScrollable:YES]; + [self setEditable:YES]; + [self setAlignment:NSLeftTextAlignment]; + + background_color = [NSColor grayColor]; + text_color = [NSColor blackColor]; + return self; +} + +// +// Modifying Graphic Attributes +// +- (NSColor *)backgroundColor +{ + return background_color; +} + +- (BOOL)drawsBackground +{ + return draw_background; +} + +- (void)setBackgroundColor:(NSColor *)aColor +{ + background_color = aColor; +} + +- (void)setDrawsBackground:(BOOL)flag +{ + draw_background = flag; +} + +- (void)setTextColor:(NSColor *)aColor +{ + text_color = aColor; +} + +- (id)setUpFieldEditorAttributes:(id)textObject +{ + return nil; +} + +- (NSColor *)textColor +{ + return text_color; +} + +- (void)setFont:(NSFont *)fontObject +{ + [super setFont:fontObject]; +} + +// +// Editing Text +// +- (void)selectText:(id)sender +{ +} + +- (double)doubleValue +{ + return [super doubleValue]; +} + +- (void)setDoubleValue:(double)aDouble +{ + [super setDoubleValue:aDouble]; +} + +- (float)floatValue +{ + return [super floatValue]; +} + +- (void)setFloatValue:(float)aFloat +{ + [super setFloatValue:aFloat]; +} + +- (int)intValue +{ + return [super intValue]; +} + +- (void)setIntValue:(int)anInt +{ + [super setIntValue:anInt]; +} + +- (NSString *)stringValue +{ + return [super stringValue]; +} + +- (void)setStringValue:(NSString *)aString +{ + [super setStringValue:aString]; +} + +// +// Displaying +// +- (void)drawWithFrame:(NSRect)cellFrame + inView:(NSView *)controlView +{ + // Save last view drawn to + control_view = controlView; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject: background_color]; + [aCoder encodeObject: text_color]; + [aCoder encodeValueOfObjCType: @encode(BOOL) at: &draw_background]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + background_color = [aDecoder decodeObject]; + text_color = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &draw_background]; + + return self; +} + +@end diff --git a/Source/NSView.m b/Source/NSView.m new file mode 100644 index 000000000..ef96ccdc8 --- /dev/null +++ b/Source/NSView.m @@ -0,0 +1,981 @@ +/* + NSView.m + + The view class which encapsulates all drawing functionality + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include + +// NSView notifications +NSString *NSViewFrameChangedNotification; +NSString *NSViewFocusChangedNotification; + +@implementation NSView + +// +// Class methods +// +// +// Initialization +// ++ (void)initialize +{ + if (self == [NSView class]) + { + NSLog(@"Initialize NSView class\n"); + + // Initial version + [self setVersion:1]; + } +} + +// +// Focusing +// ++ (NSView *)focusView +{ + return nil; +} + +// +// Instance methods +// +// +// Initializing NSView Objects +// +- init +{ + return [self initWithFrame:NSZeroRect]; +} + +// The default initializer +- (id)initWithFrame:(NSRect)frameRect +{ + // Our super is NSResponder + [super init]; + + // Set frame rectangle + frame = frameRect; + + // Set bounds rectangle + bounds.origin = NSZeroPoint; + bounds.size = frame.size; + + // Initialize subview list + sub_views = [NSMutableArray array]; + + // Initialize tracking rectangle list + tracking_rects = [NSMutableArray array]; + + super_view = nil; + window = nil; + is_flipped = NO; + is_rotated_from_base = NO; + is_rotated_or_scaled_from_base = NO; + opaque = NO; + disable_autodisplay = NO; + needs_display = YES; + post_frame_changes = NO; + autoresize_subviews = NO; + + return self; +} + +- (void)dealloc +{ + int i, j; + + //NSArray doesn't know -removeAllObjects yet + //[sub_views removeAllObjects]; + j = [sub_views count]; + for (i = 0;i < j; ++i) + [[sub_views objectAtIndex:i] release]; + + // no need -array is autoreleased + //[sub_views release]; + + // Free the tracking rectangles + j = [tracking_rects count]; + for (i = 0;i < j; ++i) + [[tracking_rects objectAtIndex:i] release]; + + [super dealloc]; +} + +// +// Managing the NSView Hierarchy +// +- (void)addSubview:(NSView *)aView +{ + // Not a NSView --then forget it + if (![aView isKindOfClass:[NSView class]]) + { + return; + } + + // retain the object + [aView retain]; + + // Add to our subview list + [sub_views addObject:(id)aView]; + [aView setSuperview:self]; + [aView setNextResponder:self]; + [aView viewWillMoveToWindow:window]; +} + +- (void)addSubview:(NSView *)aView + positioned:(NSWindowOrderingMode)place +relativeTo:(NSView *)otherView +{ + // Not a NSView --then forget it + if (![aView isKindOfClass:[NSView class]]) return; + + // retain the object + [aView retain]; + + // Add to our subview list + [sub_views addObject:(id)aView]; + [aView setSuperview:self]; + + // Make ourselves the next responder of the view + [aView setNextResponder:self]; + + // Tell the view what window it has moved to + [aView viewWillMoveToWindow:window]; +} + +- (NSView *)ancestorSharedWithView:(NSView *)aView +{ + NSView *v = nil; + BOOL found = NO; + + return v; +} + +- (BOOL)isDescendantOf:(NSView *)aView +{ + int i, j; + NSView *v; + BOOL found = NO; + + // Not a NSView --then forget it + if (![aView isKindOfClass:[NSView class]]) return NO; + + // Quick check + if (aView == self) return YES; + + // No superview then this is end of the line + if (!super_view) return NO; + + if (super_view == aView) return YES; + + return [super_view isDescendantOf:aView]; +} + +- (NSView *)opaqueAncestor +{ + return nil; +} + +- (void)removeFromSuperview +{ + int i, j; + NSMutableArray *v; + + // No superview then just return + if (!super_view) return; + + v = [super_view subviews]; + j = [v count]; + for (i = 0;i < j; ++i) + { + if ([v objectAtIndex:i] == self) + [v removeObjectAtIndex:i]; + } +} + +- (void)replaceSubview:(NSView *)oldView + with:(NSView *)newView +{ + int i, j; + NSView *v; + + // Not a NSView --then forget it + if (![newView isKindOfClass:[NSView class]]) return; + + j = [sub_views count]; + for (i = 0;i < j; ++i) + { + v = [sub_views objectAtIndex:i]; + if (v == oldView) + { + // Found it then replace + [sub_views replaceObjectAtIndex:i withObject:newView]; + // release it as well + [v release]; + // and retain the new view + [newView retain]; + } + else + // Didn't find then pass down view hierarchy + [v replaceSubview:oldView with:newView]; + } +} + +- (void)sortSubviewsUsingFunction:(int (*)(id ,id ,void *))compare + context:(void *)context +{} + +- (NSMutableArray *)subviews +{ + return sub_views; +} + +- (NSView *)superview +{ + return super_view; +} + +- (void)setSuperview:(NSView *)superview +{ + // Not a NSView --then forget it + if (![superview isKindOfClass:[NSView class]]) return; + + super_view = superview; +} + +- (NSWindow *)window +{ + // If we don't know our window then ask our super_view + if (!window) + window = [super_view window]; + + return window; +} + +- (void)viewWillMoveToWindow:(NSWindow *)newWindow +{ + int i, j; + + // not a window --then forget it + // if (![newWindow isKindOfClass:[NSWindow class]]) return; + + window = newWindow; + + // Pass new window down to subviews + j = [sub_views count]; + for (i = 0;i < j; ++i) + [[sub_views objectAtIndex:i] viewWillMoveToWindow:newWindow]; + +} + +// +// Modifying the Frame Rectangle +// +- (float)frameRotation +{ + return 0; +} + +- (NSRect)frame +{ + return frame; +} + +- (void)rotateByAngle:(float)angle +{} + +- (void)setFrame:(NSRect)frameRect +{ + frame = frameRect; + bounds.size = frame.size; +} + +- (void)setFrameOrigin:(NSPoint)newOrigin +{ + frame.origin = newOrigin; +} + +- (void)setFrameRotation:(float)angle +{} + +- (void)setFrameSize:(NSSize)newSize +{ + frame.size = newSize; + bounds.size = newSize; +} + +// +// Modifying the Coordinate System +// + +- (float)boundsRotation +{ + return 0; +} + +- (NSRect)bounds +{ + return bounds; +} + +- (BOOL)isFlipped +{ + return is_flipped; +} + +- (BOOL)isRotatedFromBase +{ + return is_rotated_from_base; +} + +- (BOOL)isRotatedOrScaledFromBase +{ + return is_rotated_or_scaled_from_base; +} + +- (void)scaleUnitSquareToSize:(NSSize)newSize +{} + +- (void)setBounds:(NSRect)aRect +{ + bounds = aRect; +} + +- (void)setBoundsOrigin:(NSPoint)newOrigin +{ + bounds.origin = newOrigin; +} + +- (void)setBoundsRotation:(float)angle +{} + +- (void)setBoundsSize:(NSSize)newSize +{ + bounds.size = newSize; +} + +- (void)translateOriginToPoint:(NSPoint)point +{} + +// +// Converting Coordinates +// +- (NSRect)centerScanRect:(NSRect)aRect +{ + return NSZeroRect; +} + +- (NSPoint)convertPoint:(NSPoint)aPoint + fromView:(NSView *)aView +{ + return NSZeroPoint; +} + +- (NSPoint)convertPoint:(NSPoint)aPoint + toView:(NSView *)aView +{ + NSPoint p; + + // Must belong to the same window + if (([self window] != [aView window]) && (aView)) + return NSZeroPoint; + + return p; +} + +- (NSRect)convertRect:(NSRect)aRect + fromView:(NSView *)aView +{ + NSRect r; + + // Must belong to the same window + if (([self window] != [aView window]) && (aView)) + return NSZeroRect; + + r = aRect; + r.origin = [self convertPoint:r.origin fromView:aView]; + r.size = [self convertSize:r.size fromView:aView]; + return r; +} + +- (NSRect)convertRect:(NSRect)aRect + toView:(NSView *)aView +{ + NSRect r; + + // Must belong to the same window + if (([self window] != [aView window]) && (aView)) + return NSZeroRect; + + r = aRect; + r.origin = [self convertPoint:r.origin toView:aView]; + r.size = [self convertSize:r.size toView:aView]; + return r; +} + +- (NSSize)convertSize:(NSSize)aSize + fromView:(NSView *)aView +{ + // Size would only change under scaling + return aSize; +} + +- (NSSize)convertSize:(NSSize)aSize + toView:(NSView *)aView +{ + // Size would only change under scaling + return aSize; +} + +// +// Notifying Ancestor Views +// +- (BOOL)postsFrameChangedNotifications +{ + return post_frame_changes; +} + +- (void)setPostsFrameChangedNotifications:(BOOL)flag +{ + post_frame_changes = flag; +} + + +// +// Resizing Subviews +// +- (void)resizeSubviewsWithOldSize:(NSSize)oldSize +{} + +- (void)setAutoresizesSubviews:(BOOL)flag +{ + autoresize_subviews = flag; +} + +- (BOOL)autoresizesSubviews +{ + return autoresize_subviews; +} + +- (void)setAutoresizingMask:(unsigned int)mask +{} + +- (unsigned int)autoresizingMask +{ + return 0; +} + +- (void)resizeWithOldSuperviewSize:(NSSize)oldSize +{} + +// +// Graphics State Objects +// +- (void)allocateGState +{} + +- (void)releaseGState +{} + +- (int)gState +{ + return 0; +} + +- (void)renewGState +{} + +- (void)setUpGState +{} + +// +// Focusing +// +- (void)lockFocus +{ +} + +- (void)unlockFocus +{ +} + +// +// Displaying +// +- (BOOL)canDraw +{ + return YES; +} + +- (void)display +{ + int i, j; + + [self lockFocus]; + [self drawRect:bounds]; + [self unlockFocus]; + + // Tell subviews to display + j = [sub_views count]; + for (i = 0;i < j; ++i) + [(NSView *)[sub_views objectAtIndex:i] display]; +} + +- (void)displayIfNeeded +{ + if ((needs_display) && (opaque)) + [self display]; +} + +- (void)displayIfNeededIgnoringOpacity +{ + if (needs_display) + [self display]; +} + +- (void)displayRect:(NSRect)aRect +{} + +- (void)displayRectIgnoringOpacity:(NSRect)aRect +{} + +- (void)drawRect:(NSRect)rect +{ + NSColor *col; + + col = [window backgroundColor]; + PSsetcolor(col); + NSRectFill(rect); +} + +- (NSRect)visibleRect +{ + return bounds; +} + +- (BOOL)isOpaque +{ + return opaque; +} + +- (BOOL)needsDisplay +{ + return needs_display; +} + +- (void)setNeedsDisplay:(BOOL)flag +{ + needs_display = flag; +} + +- (void)setNeedsDisplayInRect:(NSRect)invalidRect +{ + needs_display = YES; +} + +- (BOOL)shouldDrawColor +{ + return YES; +} + +// +// Scrolling +// +- (NSRect)adjustScroll:(NSRect)newVisible +{ + return NSZeroRect; +} + +- (BOOL)autoscroll:(NSEvent *)theEvent +{ + return NO; +} + +- (void)reflectScrolledClipView:(NSClipView *)aClipView +{} + +- (void)scrollClipView:(NSClipView *)aClipView + toPoint:(NSPoint)aPoint +{} + +- (void)scrollPoint:(NSPoint)aPoint +{} + +- (void)scrollRect:(NSRect)aRect + by:(NSSize)delta +{} + +- (BOOL)scrollRectToVisible:(NSRect)aRect +{ + return NO; +} + +// +// Managing the Cursor +// +- (void)addCursorRect:(NSRect)aRect + cursor:(NSCursor *)anObject +{} + +- (void)discardCursorRects +{} + +- (void)removeCursorRect:(NSRect)aRect + cursor:(NSCursor *)anObject +{} + +- (void)resetCursorRects +{} + +// +// Assigning a Tag +// +- (int)tag +{ + return -1; +} + +- (id)viewWithTag:(int)aTag +{ + int i, j; + + j = [sub_views count]; + for (i = 0;i < j; ++i) + { + if ([[sub_views objectAtIndex:i] tag] == aTag) + return [sub_views objectAtIndex:i]; + } + return nil; +} + +// +// Aiding Event Handling +// +- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent +{ + return NO; +} + +- (NSView *)hitTest:(NSPoint)aPoint +{ + NSPoint p; + int i, j; + NSView *v = nil, *w; + + // If not within our bounds then immediately return + if (![self mouse:aPoint inRect:bounds]) return nil; + + // Check our sub_views + j = [sub_views count]; + for (i = 0;i < j; ++i) + { + w = [sub_views objectAtIndex:i]; + p = [self convertPoint:aPoint toView:w]; + v = [w hitTest:p]; + if (v) break; + } + + // It is either the subview or ourself + if (v) + { + return v; + } + else + { + return self; + } +} + +- (BOOL)mouse:(NSPoint)aPoint + inRect:(NSRect)aRect +{ + if (aPoint.x < aRect.origin.x) + return NO; + if (aPoint.y < aRect.origin.y) + return NO; + if (aPoint.x > (aRect.origin.x + aRect.size.width)) + return NO; + if (aPoint.y > (aRect.origin.y + aRect.size.height)) + return NO; + + return YES; +} + +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent +{ + return NO; +} + +- (void)removeTrackingRect:(NSTrackingRectTag)tag +{ + int i, j; + TrackingRectangle *m; + + j = [tracking_rects count]; + for (i = 0;i < j; ++i) + { + m = (TrackingRectangle *)[tracking_rects objectAtIndex:i]; + if ([m tag] == tag) + { + [m release]; + [tracking_rects removeObjectAtIndex:i]; + return; + } + } +} + +- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)anEvent +{ + return NO; +} + +- (NSTrackingRectTag)addTrackingRect:(NSRect)aRect + owner:(id)anObject +userData:(void *)data + assumeInside:(BOOL)flag +{ + NSTrackingRectTag t; + int i, j; + TrackingRectangle *m; + + t = 0; + j = [tracking_rects count]; + for (i = 0;i < j; ++i) + { + m = (TrackingRectangle *)[tracking_rects objectAtIndex:i]; + if ([m tag] > t) + t = [m tag]; + } + ++t; + + m = [[TrackingRectangle alloc] initWithRect:aRect tag:t owner:anObject + userData:data inside:flag]; + [tracking_rects addObject:m]; + + return t; +} + +- (NSArray *)trackingRectangles +{ + return tracking_rects; +} + +// +// Dragging +// +- (BOOL)dragFile:(NSString *)filename + fromRect:(NSRect)rect +slideBack:(BOOL)slideFlag + event:(NSEvent *)event +{ + return NO; +} + +- (void)dragImage:(NSImage *)anImage + at:(NSPoint)viewLocation +offset:(NSSize)initialOffset + event:(NSEvent *)event +pasteboard:(NSPasteboard *)pboard + source:(id)sourceObject +slideBack:(BOOL)slideFlag +{} + +- (void)registerForDraggedTypes:(NSArray *)newTypes +{} + +- (void)unregisterDraggedTypes +{} + +// +// Printing +// +- (NSData *)dataWithEPSInsideRect:(NSRect)aRect +{ + return nil; +} + +- (void)fax:(id)sender +{} + +- (void)print:(id)sender +{} + +- (void)writeEPSInsideRect:(NSRect)rect + toPasteboard:(NSPasteboard *)pasteboard +{} + +// +// Pagination +// +- (void)adjustPageHeightNew:(float *)newBottom + top:(float)oldTop +bottom:(float)oldBottom + limit:(float)bottomLimit +{} + +- (void)adjustPageWidthNew:(float *)newRight + left:(float)oldLeft +right:(float)oldRight + limit:(float)rightLimit +{} + +- (float)heightAdjustLimit +{ + return 0; +} + +- (BOOL)knowsPagesFirst:(int *)firstPageNum + last:(int *)lastPageNum +{ + return NO; +} + +- (NSPoint)locationOfPrintRect:(NSRect)aRect +{ + return NSZeroPoint; +} + +- (NSRect)rectForPage:(int)page +{ + return NSZeroRect; +} + +- (float)widthAdjustLimit +{ + return 0; +} + +// +// Writing Conforming PostScript +// +- (void)addToPageSetup +{} + +- (void)beginPage:(int)ordinalNum + label:(NSString *)aString +bBox:(NSRect)pageRect + fonts:(NSString *)fontNames +{} + +- (void)beginPageSetupRect:(NSRect)aRect + placement:(NSPoint)location +{} + +- (void)beginPrologueBBox:(NSRect)boundingBox + creationDate:(NSString *)dateCreated +createdBy:(NSString *)anApplication + fonts:(NSString *)fontNames +forWhom:(NSString *)user + pages:(int)numPages +title:(NSString *)aTitle +{} + +- (void)beginSetup +{} + +- (void)beginTrailer +{} + +- (void)drawPageBorderWithSize:(NSSize)borderSize +{} + +- (void)drawSheetBorderWithSize:(NSSize)borderSize +{} + +- (void)endHeaderComments +{} + +- (void)endPrologue +{} + +- (void)endSetup +{} + +- (void)endPageSetup +{} + +- (void)endPage +{} + +- (void)endTrailer +{} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + + NSLog(@"NSView: start encoding\n"); + [aCoder encodeRect: frame]; + [aCoder encodeRect: bounds]; + [aCoder encodeObjectReference: super_view withName: @"Superview"]; + [aCoder encodeObject: sub_views]; + [aCoder encodeObjectReference: window withName: @"Window"]; + [aCoder encodeObject: tracking_rects]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &is_flipped]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &is_rotated_from_base]; + [aCoder encodeValueOfObjCType:@encode(BOOL) + at: &is_rotated_or_scaled_from_base]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &opaque]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &needs_display]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &disable_autodisplay]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &post_frame_changes]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &autoresize_subviews]; + NSLog(@"NSView: finish encoding\n"); +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + + NSLog(@"NSView: start decoding\n"); + frame = [aDecoder decodeRect]; + bounds = [aDecoder decodeRect]; + [aDecoder decodeObjectAt: &super_view withName: NULL]; + sub_views = [aDecoder decodeObject]; + [aDecoder decodeObjectAt: &window withName: NULL]; + tracking_rects = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &is_flipped]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &is_rotated_from_base]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) + at: &is_rotated_or_scaled_from_base]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &opaque]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &needs_display]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &disable_autodisplay]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &post_frame_changes]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &autoresize_subviews]; + NSLog(@"NSView: finish decoding\n"); + + return self; +} + +@end diff --git a/Source/NSWindow.m b/Source/NSWindow.m new file mode 100644 index 000000000..b40a1049f --- /dev/null +++ b/Source/NSWindow.m @@ -0,0 +1,1297 @@ +/* + NSWindow.m + + The window class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Venkat Ajjanagadde + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +// NSWindow notifications +NSString *NSWindowDidBecomeKeyNotification; +NSString *NSWindowDidBecomeMainNotification; +NSString *NSWindowDidChangeScreenNotification; +NSString *NSWindowDidDeminiaturizeNotification; +NSString *NSWindowDidExposeNotification; +NSString *NSWindowDidMiniaturizeNotification; +NSString *NSWindowDidMoveNotification; +NSString *NSWindowDidResignKeyNotification; +NSString *NSWindowDidResignMainNotification; +NSString *NSWindowDidResizeNotification; +NSString *NSWindowDidUpdateNotification; +NSString *NSWindowWillCloseNotification; +NSString *NSWindowWillMiniaturizeNotification; +NSString *NSWindowWillMoveNotification; + +// +// NSWindow implementation +// +@implementation NSWindow + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSWindow class]) + { + NSLog(@"Initialize NSWindow class\n"); + + // Initial version + [self setVersion:1]; + } +} + +// Saving and restoring the frame ++ (void)removeFrameUsingName:(NSString *)name +{ +} + +// Computing frame and content rectangles ++ (NSRect)contentRectForFrameRect:(NSRect)aRect + styleMask:(unsigned int)aStyle +{ + NSRect t; + return t; +} + ++ (NSRect)frameRectForContentRect:(NSRect)aRect + styleMask:(unsigned int)aStyle +{ + NSRect t; + return t; +} + ++ (NSRect)minFrameWidthWithTitle:(NSString *)aTitle + styleMask:(unsigned int)aStyle +{ + NSRect t; + return t; +} + +// Screens and window depths +//+ (NSWindowDepth)defaultDepthLimit + +// +// Instance methods +// +// +// Initialization +// +- init +{ + int style; + + NSLog(@"NSWindow -init\n"); + style = NSTitledWindowMask | NSClosableWindowMask + | NSMiniaturizableWindowMask | NSResizableWindowMask; + return [self initWithContentRect:NSZeroRect styleMask:style + backing:NSBackingStoreBuffered defer:NO]; +} + +- (void)dealloc +{ + NSApplication *theApp = [NSApplication sharedApplication]; + + NSDebugLog(@"Remove NSWindow from application\n"); + // Remove ourselves from the application window list + [theApp removeWindowsItem:self]; + + // Release the content view + NSDebugLog(@"Release content view\n"); + if (content_view) [content_view release]; + + NSDebugLog(@"NSWindow dealloc super\n"); + [super dealloc]; +} + +// +// Initializing and getting a new NSWindow object +// +- initWithContentRect:(NSRect)contentRect + styleMask:(unsigned int)aStyle + backing:(NSBackingStoreType)bufferingType + defer:(BOOL)flag +{ + NSLog(@"NSWindow -initWithContentRect:\n"); + return [self initWithContentRect:contentRect styleMask:aStyle + backing:bufferingType defer:flag screen:nil]; +} + +- initWithContentRect:(NSRect)contentRect + styleMask:(unsigned int)aStyle + backing:(NSBackingStoreType)bufferingType + defer:(BOOL)flag + screen:aScreen +{ + NSApplication *theApp = [NSApplication sharedApplication]; + + NSLog(@"NSWindow default initializer\n"); + if (!theApp) + NSLog(@"No application!\n"); + + [super init]; + + NSLog(@"NSWindow start of init\n"); + + frame = contentRect; + style_mask = aStyle; + + // Next responder is the application + [self setNextResponder:theApp]; + + // Initialize attributes and flags + frame_view = nil; + [self setContentView:[[NSView alloc] initWithFrame:frame]]; + first_responder = self; + delegate = nil; + window_num = 0; + background_color = [NSColor grayColor]; + represented_filename = @"Window"; + miniaturized_title = @"Window"; + window_title = @"Window"; + visible = NO; + is_key = NO; + is_main = NO; + is_edited = NO; + is_miniaturized = NO; + menu_exclude = NO; + backing_type = bufferingType; + disable_flush_window = NO; + + // Register ourselves with the Application object + [theApp addWindowsItem:self title:window_title filename:NO]; + + NSLog(@"NSWindow end of init\n"); + return self; +} + +// +// Accessing the content view +// +- contentView +{ + return content_view; +} + +- (void)setContentView:(NSView *)aView +{ + // Not an NSView -then forget it + if (![aView isKindOfClass:[NSView class]]) + return; + + // Release current content view + if (content_view) + { + // Tell view it is no longer in a window + [content_view viewWillMoveToWindow:nil]; + [content_view release]; + } + + content_view = aView; + [content_view retain]; + // Tell the view its changing windows + [content_view viewWillMoveToWindow:self]; + // Make us the view's next responder + [content_view setNextResponder:self]; +} + +// +// Window graphics +// +- (NSColor *)backgroundColor +{ + return background_color; +} + +- (NSString *)representedFilename +{ + return represented_filename; +} + +- (void)setBackgroundColor:(NSColor *)color +{ + background_color = color; +} + +- (void)setRepresentedFilename:(NSString *)aString +{ + represented_filename = aString; +} + +- (void)setTitle:(NSString *)aString +{ + window_title = aString; +} + +- (void)setTitleWithRepresentedFilename:(NSString *)aString +{ + [self setRepresentedFilename:aString]; + [self setTitle:aString]; +} + +- (unsigned int)styleMask +{ + return style_mask; +} + +- (NSString *)title +{ + return window_title; +} + +// +// Window device attributes +// +- (NSBackingStoreType)backingType +{ + return backing_type; +} + +- (NSDictionary *)deviceDescription +{ + return nil; +} + +- (int)gState +{ + return 0; +} + +- (BOOL)isOneShot +{ + return NO; +} + +- (void)setBackingType:(NSBackingStoreType)type +{ + backing_type = type; +} + +- (void)setOneShot:(BOOL)flag +{} + +- (int)windowNumber +{ + return window_num; +} + +- (void)setWindowNumber:(int)windowNum +{ + window_num = windowNum; +} + +// +// The miniwindow +// +- (NSImage *)miniwindowImage +{ + return nil; +} + +- (NSString *)miniwindowTitle +{ + return miniaturized_title; +} + +- (void)setMiniwindowImage:(NSImage *)image +{} + +- (void)setMiniwindowTitle:(NSString *)title; +{ + miniaturized_title = title; +} + +// +// The field editor +// +- (void)endEditingFor:anObject +{} + +- (NSText *)fieldEditor:(BOOL)createFlag + forObject:anObject +{ + return nil; +} + +// +// Window status and ordering +// +- (void)becomeKeyWindow +{ + // Can we become the key window + if (![self canBecomeKeyWindow]) return; + + // Yes well then do it + [self makeKeyWindow]; + [self windowDidBecomeKey:self]; +} + +- (void)becomeMainWindow +{ + // Can we become the main window + if (![self canBecomeMainWindow]) return; + + // Yes well then do it + [self makeMainWindow]; + [self windowDidBecomeMain:self]; +} + +- (BOOL)canBecomeKeyWindow +{ + return YES; +} + +- (BOOL)canBecomeMainWindow +{ + return YES; +} + +- (BOOL)hidesOnDeactivate +{ + return NO; +} + +- (BOOL)isKeyWindow +{ + return is_key; +} + +- (BOOL)isMainWindow +{ + return is_main; +} + +- (BOOL)isMiniaturized +{ + return is_miniaturized; +} + +- (BOOL)isVisible +{ + return visible; +} + +- (int)level +{ + return 0; +} + +- (void)makeKeyAndOrderFront:sender +{ + id w; + NSApplication *theApp = [NSApplication sharedApplication]; + + // Can we become the key window? + if ([self canBecomeKeyWindow]) + { + // Tell the current key window to resign + w = [theApp keyWindow]; + [w resignKeyWindow]; + + // Now we should become the key window + [self becomeKeyWindow]; + } + + // Now order to the front + [self orderFront:sender]; +} + +- (void)makeKeyWindow +{ + is_key = YES; +} + +- (void)makeMainWindow +{ + is_main = YES; +} + +- (void)orderBack:sender +{ + visible = YES; +} + +- (void)orderFront:sender +{ + visible = YES; +} + +- (void)orderFrontRegardless +{ + visible = YES; +} + +- (void)orderOut:sender +{ + visible = YES; +} + +- (void)orderWindow:(NSWindowOrderingMode)place + relativeTo:(int)otherWin +{} + +- (void)resignKeyWindow +{ + is_key = NO; +} + +- (void)resignMainWindow +{ + is_main = NO; +} + +- (void)setHidesOnDeactivate:(BOOL)flag +{} + +- (void)setLevel:(int)newLevel +{} + +// +// Moving and resizing the window +// +- (NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint +{ + return NSZeroPoint; +} + +- (void)center +{ + float w, h; + NSRect n; + + // Should use MBScreen + //w = MB_SCREEN_MAXWIDTH(); + //h = MB_SCREEN_MAXHEIGHT(); + n = frame; + n.origin.x = (w - frame.size.width) / 2; + n.origin.y = (h - frame.size.height) / 2; + [self setFrame:n display:YES]; +} + +- (NSRect)constrainFrameRect:(NSRect)frameRect + toScreen:screen +{ + return NSZeroRect; +} + +- (NSRect)frame +{ + return frame; +} + +- (NSSize)minSize +{ + return NSZeroSize; +} + +- (NSSize)maxSize +{ + return NSZeroSize; +} + +- (void)setContentSize:(NSSize)aSize +{ +} + +- (void)setFrame:(NSRect)frameRect + display:(BOOL)flag +{ + frame = frameRect; + + if (!flag) return; + [self display]; +} + +- (void)setFrameOrigin:(NSPoint)aPoint +{} + +- (void)setFrameTopLeftPoint:(NSPoint)aPoint +{} + +- (void)setMinSize:(NSSize)aSize +{} + +- (void)setMaxSize:(NSSize)aSize +{} + +// +// Converting coordinates +// +- (NSPoint)convertBaseToScreen:(NSPoint)aPoint +{ + return NSZeroPoint; +} + +- (NSPoint)convertScreenToBase:(NSPoint)aPoint +{ + return NSZeroPoint; +} + + +// +// Managing the display +// +- (void)display +{ + visible = YES; + + // Tell the first responder that it is the first responder + // So it can set the focus to itself + [first_responder becomeFirstResponder]; +} + +- (void)disableFlushWindow +{ + disable_flush_window = YES; +} + +- (void)displayIfNeeded +{} + +- (void)enableFlushWindow +{ + disable_flush_window = NO; +} + +- (void)flushWindow +{} + +- (void)flushWindowIfNeeded +{} + +- (BOOL)isAutodisplay +{ + return YES; +} + +- (BOOL)isFlushWindowDisabled +{ + return NO; +} + +- (void)setAutoDisplay:(BOOL)flag +{} + +- (void)setViewsNeedDisplay:(BOOL)flag +{} + +- (void)update +{} + +- (void)useOptimizedDrawing:(BOOL)flag +{} + +- (BOOL)viewsNeedDisplay +{ + return NO; +} + +// Screens and window depths +//- (BOOL)canStoreColor; +//- (NSScreen *)deepestScreen; +//- (NSWindowDepth)depthLimit; +//- (BOOL)hasDynamicDepthLimit; +//- (NSScreen *)screen; +//- (void)setDepthLimit:(NSWindowDepth)limit; +//- (void)setDynamicDepthLimit:(BOOL)flag; + +// +// Cursor management +// +- (BOOL)areCursorRectsEnabled +{ + return NO; +} + +- (void)disableCursorRects +{} + +- (void)discardCursorRects +{} + +- (void)enableCursorRects +{} + +- (void)invalidateCursorRectsForView:(NSView *)aView +{} + +- (void)resetCursorRects +{} + +// +// Handling user actions and events +// +- (void)close +{ + // Notify our delegate + [self windowWillClose:self]; + + [self performClose:self]; +} + +- (void)deminiaturize:sender +{ + // Set our flag to say we are not miniaturized + is_miniaturized = NO; + visible = YES; + + // Notify our delegate + [self windowDidDeminiaturize:self]; +} + +- (BOOL)isDocumentEdited +{ + return is_edited; +} + +- (BOOL)isReleasedWhenClosed +{ + return YES; +} + +- (void)miniaturize:sender +{ + // Notify our delegate + [self windowWillMiniaturize:self]; + + [self performMiniaturize:self]; + + // Notify our delegate + [self windowDidMiniaturize:self]; +} + +- (void)performClose:sender +{ + visible = NO; +} + +- (void)performMiniaturize:sender +{ + // Set our flag to say we are miniaturized + is_miniaturized = YES; +} + +- (int)resizeFlags +{ + return 0; +} + +- (void)setDocumentEdited:(BOOL)flag +{} + +- (void)setReleasedWhenClosed:(BOOL)flag +{} + +// +// Aiding event handling +// +- (BOOL)acceptsMouseMovedEvents +{ + return YES; +} + +- (NSEvent *)currentEvent +{ + NSApplication *theApp = [NSApplication sharedApplication]; + + return [theApp currentEvent]; +} + +- (void)discardEventsMatchingMask:(unsigned int)mask + beforeEvent:(NSEvent *)lastEvent +{} + +- (NSResponder *)firstResponder +{ + return first_responder; +} + +- (void)keyDown:(NSEvent *)theEvent +{ + // save the first responder so that the key up + // goes to it and not a possible new first responder + original_responder = first_responder; + + // Send the first responder the key down + [first_responder keyDown:theEvent]; +} + +- (BOOL)makeFirstResponder:(NSResponder *)aResponder +{ + // If already the first responder then return + if (first_responder == aResponder) + return YES; + + // If not a NSResponder then forget it + if (![aResponder isKindOfClass:[NSResponder class]]) + return NO; + + // Does it accept the first responder? + if (![aResponder acceptsFirstResponder]) + return NO; + + // Notify current first responder that it should resign + // If it says NO then no change + if (![first_responder resignFirstResponder]) + return NO; + + // Make it the first responder + first_responder = aResponder; + + // Notify it that it just became the first responder + [first_responder becomeFirstResponder]; + + return YES; +} + +- (NSPoint)mouseLocationOutsideOfEventStream +{ + return NSZeroPoint; +} + +- (NSEvent *)nextEventMatchingMask:(unsigned int)mask +{ + return nil; +} + +- (NSEvent *)nextEventMatchingMask:(unsigned int)mask + untilDate:(NSDate *)expiration +inMode:(NSString *)mode + dequeue:(BOOL)deqFlag +{ + return nil; +} + +- (void)postEvent:(NSEvent *)event + atStart:(BOOL)flag +{ + NSApplication *theApp = [NSApplication sharedApplication]; + + [theApp postEvent:event atStart:flag]; +} + +- (void)setAcceptsMouseMovedEvents:(BOOL)flag +{} + +- (void)checkTrackingRectangles:(NSView *)theView forEvent:(NSEvent *)theEvent +{ + NSArray *tr = [theView trackingRectangles]; + NSArray *sb = [theView subviews]; + TrackingRectangle *r; + int i, j; + BOOL last, now; + NSEvent *e; + + // Loop through tracking rectangles + j = [tr count]; + for (i = 0;i < j; ++i) + { + r = (TrackingRectangle *)[tr objectAtIndex:i]; + // Check mouse at last point + last = [theView mouse:last_point inRect:[r rectangle]]; + // Check mouse at current point + now = [theView mouse:[theEvent locationInWindow] inRect:[r rectangle]]; + + // Mouse entered event + if ((!last) && (now)) + { + e = [NSEvent enterExitEventWithType:NSMouseEntered + location:[theEvent locationInWindow] + modifierFlags:[theEvent modifierFlags] + timestamp:0 windowNumber:[theEvent windowNumber] + context:NULL eventNumber:0 + trackingNumber:[r tag] userData:[r userData]]; + // Send the event to the view + [theView mouseEntered:e]; + } + + // Mouse exited event + if ((last) && (!now)) + { + e = [NSEvent enterExitEventWithType:NSMouseExited + location:[theEvent locationInWindow] + modifierFlags:[theEvent modifierFlags] + timestamp:0 windowNumber:[theEvent windowNumber] + context:NULL eventNumber:0 + trackingNumber:[r tag] userData:[r userData]]; + // Send the event to the view + [theView mouseExited:e]; + } + } + + // Check the tracking rectangles for the subviews + j = [sb count]; + for (i = 0;i < j; ++i) + [self checkTrackingRectangles:[sb objectAtIndex:i] forEvent:theEvent]; +} + +- (void)sendEvent:(NSEvent *)theEvent +{ + + switch ([theEvent type]) + { + + // + // Mouse events + // + // + // Left mouse down + // + case NSLeftMouseDown: + { + NSView *v = [content_view hitTest:[theEvent locationInWindow]]; + [v mouseDown:theEvent]; + last_point = [theEvent locationInWindow]; + break; + } + // + // Left mouse up + // + case NSLeftMouseUp: + { + NSView *v = [content_view hitTest:[theEvent locationInWindow]]; + [v mouseUp:theEvent]; + last_point = [theEvent locationInWindow]; + break; + } + // + // Right mouse down + // + case NSRightMouseDown: + { + NSView *v = [content_view hitTest:[theEvent locationInWindow]]; + [v rightMouseDown:theEvent]; + last_point = [theEvent locationInWindow]; + break; + } + // + // Right mouse up + // + case NSRightMouseUp: + { + NSView *v = [content_view hitTest:[theEvent locationInWindow]]; + [v rightMouseUp:theEvent]; + last_point = [theEvent locationInWindow]; + break; + } + // + // Mouse moved + // + case NSMouseMoved: + { + NSView *v = [content_view hitTest:[theEvent locationInWindow]]; + + // First send the NSMouseMoved event + [v mouseMoved:theEvent]; + + // We need to go through all of the views, and any with + // a tracking rectangle then we need to determine if we + // should send a NSMouseEntered or NSMouseExited event + [self checkTrackingRectangles:content_view forEvent:theEvent]; + + last_point = [theEvent locationInWindow]; + break; + } + // + // Left mouse dragged + // + case NSLeftMouseDragged: + { + last_point = [theEvent locationInWindow]; + break; + } + // + // Right mouse dragged + // + case NSRightMouseDragged: + { + last_point = [theEvent locationInWindow]; + break; + } + // + // Mouse entered + // + case NSMouseEntered: + { + break; + } + // + // Mouse exited + // + case NSMouseExited: + { + break; + } + + // + // Keyboard events + // + // + // Key down + // + case NSKeyDown: + { + [self keyDown:theEvent]; + break; + } + // + // Key up + // + case NSKeyUp: + { + // send message to object that got the key down + if (original_responder) + [original_responder keyUp:theEvent]; + break; + } + + // + // Miscellaneous events + // + // + // Flags changed + // + case NSFlagsChanged: + { + break; + } + // + // Cursor update + // + case NSCursorUpdate: + { + break; + } + } +} + +- (BOOL)tryToPerform:(SEL)anAction with:anObject +{ + return ([super tryToPerform:anAction with:anObject]); +} + +- (BOOL)worksWhenModal +{ + return YES; +} + +// +// Dragging +// +- (void)dragImage:(NSImage *)anImage + at:(NSPoint)baseLocation +offset:(NSSize)initialOffset + event:(NSEvent *)event +pasteboard:(NSPasteboard *)pboard + source:sourceObject + slideBack:(BOOL)slideFlag +{} + +- (void)registerForDraggedTypes:(NSArray *)newTypes +{} + +- (void)unregisterDraggedTypes +{} + +// +// Services and windows menu support +// +- (BOOL)isExcludedFromWindowsMenu +{ + return menu_exclude; +} + +- (void)setExcludedFromWindowsMenu:(BOOL)flag +{ + menu_exclude = flag; +} + +- validRequestorForSendType:(NSString *)sendType + returnType:(NSString *)returnType +{ + return nil; +} + +// +// Saving and restoring the frame +// +- (NSString *)frameAutosaveName +{ + return nil; +} + +- (void)saveFrameUsingName:(NSString *)name +{} + +- (BOOL)setFrameAutosaveName:(NSString *)name +{ + return NO; +} + +- (void)setFrameFromString:(NSString *)string +{} + +- (BOOL)setFrameUsingName:(NSString *)name +{ + return NO; +} + +- (NSString *)stringWithSavedFrame +{ + return nil; +} + +// +// Printing and postscript +// +- (NSDate *)dataWithEPSInsideRect:(NSRect)rect +{ + return nil; +} + +- (void)fax:sender +{} + +- (void)print:sender +{} + +// +// Assigning a delegate +// +- delegate +{ + return delegate; +} + +- (void)setDelegate:anObject +{ + delegate = anObject; +} + +// +// Implemented by the delegate +// +- (BOOL)windowShouldClose:sender +{ + if ([delegate respondsTo:@selector(windowShouldClose:)]) + return [delegate windowShouldClose:sender]; + else + return YES; +} + +- (NSSize)windowWillResize:(NSWindow *)sender + toSize:(NSSize)frameSize +{ + if ([delegate respondsTo:@selector(windowWillResize:toSize:)]) + return [delegate windowWillResize:sender toSize:frameSize]; + else + return frameSize; +} + +- windowWillReturnFieldEditor:(NSWindow *)sender + toObject:client +{ + return nil; +} + +- (void)windowDidBecomeKey:sender +{ + if ([delegate respondsTo:@selector(windowDidBecomeKey:)]) + return [delegate windowDidBecomeKey:sender]; +} + +- (void)windowDidBecomeMain:sender +{ + if ([delegate respondsTo:@selector(windowDidBecomeMain:)]) + return [delegate windowDidBecomeMain:sender]; +} + +- (void)windowDidChangeScreen:sender +{ + if ([delegate respondsTo:@selector(windowDidChangeScreen:)]) + return [delegate windowDidChangeScreen:sender]; +} + +- (void)windowDidDeminiaturize:sender +{ + if ([delegate respondsTo:@selector(windowDidDeminiaturize:)]) + return [delegate windowDidDeminiaturize:sender]; +} + +- (void)windowDidExpose:sender +{ + if ([delegate respondsTo:@selector(windowDidExpose:)]) + return [delegate windowDidExpose:sender]; +} + +- (void)windowDidMiniaturize:sender +{ + if ([delegate respondsTo:@selector(windowDidMiniaturize:)]) + return [delegate windowDidMiniaturize:sender]; +} + +- (void)windowDidMove:sender +{ + if ([delegate respondsTo:@selector(windowDidMove:)]) + return [delegate windowDidMove:sender]; +} + +- (void)windowDidResignKey:sender +{ + if ([delegate respondsTo:@selector(windowDidResignKey:)]) + return [delegate windowDidResignKey:sender]; +} + +- (void)windowDidResignMain:sender +{ + if ([delegate respondsTo:@selector(windowDidResignMain:)]) + return [delegate windowDidResignMain:sender]; +} + +- (void)windowDidResize:sender +{ + if ([delegate respondsTo:@selector(windowDidResize:)]) + return [delegate windowDidResize:sender]; +} + +- (void)windowDidUpdate:sender +{ + if ([delegate respondsTo:@selector(windowDidUpdate:)]) + return [delegate windowDidUpdate:sender]; +} + +- (void)windowWillClose:sender +{ + if ([delegate respondsTo:@selector(windowWillClose:)]) + return [delegate windowWillClose:sender]; +} + +- (void)windowWillMiniaturize:sender +{ + if ([delegate respondsTo:@selector(windowWillMiniaturize:)]) + return [delegate windowWillMiniaturize:sender]; +} + +- (void)windowWillMove:sender +{ + if ([delegate respondsTo:@selector(windowWillMove:)]) + return [delegate windowWillMove:sender]; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + NSApplication *theApp = [NSApplication sharedApplication]; + + [self setNextResponder: nil]; + + [super encodeWithCoder:aCoder]; + + NSLog(@"NSWindow: start encoding\n"); + [aCoder encodeRect:frame]; + [aCoder encodeObject:content_view]; +// [aCoder encodeObjectReference: first_responder withName:NULL]; +// [aCoder encodeObjectReference: original_responder withName:NULL]; +// [aCoder encodeObjectReference: delegate withName:NULL]; + [aCoder encodeValueOfObjCType:"i" at:&window_num]; + [aCoder encodeObject:background_color]; + [aCoder encodeObject:represented_filename]; + [aCoder encodeObject:miniaturized_title]; + [aCoder encodeObject:window_title]; + [aCoder encodePoint:last_point]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &visible]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &is_key]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &is_main]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &is_edited]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &is_miniaturized]; + [aCoder encodeValueOfObjCType:"I" at: &style_mask]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at: &menu_exclude]; + NSLog(@"NSWindow: finish encoding\n"); +} + +- initWithCoder:aDecoder +{ + NSApplication *theApp; + + [super initWithCoder:aDecoder]; + + NSLog(@"NSWindow: start decoding\n"); + frame = [aDecoder decodeRect]; + content_view = [aDecoder decodeObject]; +// [aDecoder decodeObjectAt: &first_responder withName:NULL]; +// [aDecoder decodeObjectAt: &original_responder withName:NULL]; +// [aDecoder decodeObjectAt: &delegate withName:NULL]; + [aDecoder decodeValueOfObjCType:"i" at:&window_num]; + background_color = [aDecoder decodeObject]; + represented_filename = [aDecoder decodeObject]; + miniaturized_title = [aDecoder decodeObject]; + window_title = [aDecoder decodeObject]; + last_point = [aDecoder decodePoint]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &visible]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &is_key]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &is_main]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &is_edited]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &is_miniaturized]; + [aDecoder decodeValueOfObjCType:"I" at: &style_mask]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &menu_exclude]; + + // Register ourselves with the Application object + theApp = [NSApplication sharedApplication]; + [theApp addWindowsItem:self title:nil filename:NO]; + NSLog(@"NSWindow: finish decoding\n"); + + return self; +} + +// +// GNUstep additional methods +// + +// +// Mouse capture/release +// +- (void)captureMouse: sender +{ + // Do nothing, should be overridden by back-end +} + +- (void)releaseMouse: sender +{ + // Do nothing, should be overridden by back-end +} + +@end diff --git a/Source/NSWorkspace.m b/Source/NSWorkspace.m new file mode 100644 index 000000000..b25593208 --- /dev/null +++ b/Source/NSWorkspace.m @@ -0,0 +1,274 @@ +/* + NSWorkspace.m + + Description... + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +// Workspace File Type Globals +NSString *NSPlainFileType; +NSString *NSDirectoryFileType; +NSString *NSApplicationFileType; +NSString *NSFilesystemFileType; +NSString *NSShellCommandFileType; + +// Workspace File Operation Globals +NSString *NSWorkspaceCompressOperation; +NSString *NSWorkspaceCopyOperation; +NSString *NSWorkspaceDecompressOperation; +NSString *NSWorkspaceDecryptOperation; +NSString *NSWorkspaceDestroyOperation; +NSString *NSWorkspaceDuplicateOperation; +NSString *NSWorkspaceEncryptOperation; +NSString *NSWorkspaceLinkOperation; +NSString *NSWorkspaceMoveOperation; +NSString *NSWorkspaceRecycleOperation; + +// NSWorkspace notifications +NSString *NSWorkspaceDidLaunchApplicationNotification; +NSString *NSWorkspaceDidMountNotification; +NSString *NSWorkspaceDidPerformFileOperationNotification; +NSString *NSWorkspaceDidTerminateApplicationNotification; +NSString *NSWorkspaceDidUnmountNotification; +NSString *NSWorkspaceWillLaunchApplicationNotification; +NSString *NSWorkspaceWillPowerOffNotification; +NSString *NSWorkspaceWillUnmountNotification; + +@implementation NSWorkspace + +// +// Class methods +// ++ (void)initialize +{ + if (self == [NSWorkspace class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Creating a Workspace +// ++ (NSWorkspace *)sharedWorkspace +{ + return nil; +} + +// +// Instance methods +// + +// +// Opening Files +// +- (BOOL)openFile:(NSString *)fullPath +{ + return NO; +} + +- (BOOL)openFile:(NSString *)fullPath + fromImage:(NSImage *)anImage +at:(NSPoint)point + inView:(NSView *)aView +{ + return NO; +} + +- (BOOL)openFile:(NSString *)fullPath + withApplication:(NSString *)appName +{ + return NO; +} + +- (BOOL)openFile:(NSString *)fullPath + withApplication:(NSString *)appName +andDeactivate:(BOOL)flag +{ + return NO; +} + +- (BOOL)openTempFile:(NSString *)fullPath +{ + return NO; +} + +// +// Manipulating Files +// +- (BOOL)performFileOperation:(NSString *)operation + source:(NSString *)source +destination:(NSString *)destination + files:(NSArray *)files +tag:(int *)tag +{ + return NO; +} + +- (BOOL)selectFile:(NSString *)fullPath +inFileViewerRootedAtPath:(NSString *)rootFullpath +{ + return NO; +} + +// +// Requesting Information about Files +// +- (NSString *)fullPathForApplication:(NSString *)appName +{ + return nil; +} + +- (BOOL)getFileSystemInfoForPath:(NSString *)fullPath + isRemovable:(BOOL *)removableFlag +isWritable:(BOOL *)writableFlag + isUnmountable:(BOOL *)unmountableFlag +description:(NSString **)description + type:(NSString **)fileSystemType +{ + return NO; +} + +- (BOOL)getInfoForFile:(NSString *)fullPath + application:(NSString **)appName +type:(NSString **)type +{ + return NO; +} + +- (NSImage *)iconForFile:(NSString *)fullPath +{ + return nil; +} + +- (NSImage *)iconForFiles:(NSArray *)pathArray +{ + return nil; +} + +- (NSImage *)iconForFileType:(NSString *)fileType +{ + return nil; +} + +// +// Tracking Changes to the File System +// +- (BOOL)fileSystemChanged +{ + return NO; +} + +- (void)noteFileSystemChanged +{} + +// +// Updating Registered Services and File Types +// +- (void)findApplications +{} + +// +// Launching and Manipulating Applications +// +- (void)hideOtherApplications +{} + +- (BOOL)launchApplication:(NSString *)appName +{ + return NO; +} + +- (BOOL)launchApplication:(NSString *)appName + showIcon:(BOOL)showIcon +autolaunch:(BOOL)autolaunch +{ + return NO; +} + +// +// Unmounting a Device +// +- (BOOL)unmountAndEjectDeviceAtPath:(NSString *)path +{ + return NO; +} + +// +// Tracking Status Changes for Devices +// +- (void)checkForRemovableMedia +{} + +- (NSArray *)mountNewRemovableMedia +{ + return nil; +} + +- (NSArray *)mountedRemovableMedia +{ + return nil; +} + +// +// Notification Center +// +- (NSNotificationCenter *)notificationCenter +{ + return nil; +} + +// +// Tracking Changes to the User Defaults Database +// +- (void)noteUserDefaultsChanged +{} + +- (BOOL)userDefaultsChanged +{ + return NO; +} + +// +// Animating an Image +// +- (void)slideImage:(NSImage *)image + from:(NSPoint)fromPoint +to:(NSPoint)toPoint +{} + +// +// Requesting Additional Time before Power Off or Logout +// +- (int)extendPowerOffBy:(int)requested +{ + return 0; +} + +@end diff --git a/Source/TrackingRectangle.m b/Source/TrackingRectangle.m new file mode 100644 index 000000000..7c4b1c013 --- /dev/null +++ b/Source/TrackingRectangle.m @@ -0,0 +1,121 @@ +/* + TrackingRectangle.m + + Tracking rectangle class + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +@implementation TrackingRectangle + +// +// Class methods +// ++ (void)initialize +{ + if (self == [TrackingRectangle class]) + { + // Initial version + [self setVersion:1]; + } +} + +// +// Instance methods +// +// +// Initialization +// +- initWithRect:(NSRect)aRect + tag:(NSTrackingRectTag)aTag + owner:anObject + userData:(void *)theData + inside:(BOOL)flag +{ + rectangle = aRect; + tag = aTag; + owner = anObject; + [owner retain]; + user_data = theData; + inside = flag; + return self; +} + +- (void)dealloc +{ + [owner release]; + [super dealloc]; +} + +- (NSRect)rectangle +{ + return rectangle; +} + +- (NSTrackingRectTag)tag +{ + return tag; +} + +- owner +{ + return owner; +} + +- (void *)userData +{ + return user_data; +} + +- (BOOL)inside +{ + return inside; +} + +// +// NSCoding protocol +// +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + [aCoder encodeRect:rectangle]; + [aCoder encodeValueOfObjCType:@encode(NSTrackingRectTag) at:&tag]; + [aCoder encodeObject:owner]; + [aCoder encodeValueOfObjCType:@encode(BOOL) at:&inside]; +} + +- initWithCoder:aDecoder +{ + [super initWithCoder:aDecoder]; + rectangle = [aDecoder decodeRect]; + [aDecoder decodeValueOfObjCType:@encode(NSTrackingRectTag) at:&tag]; + [aDecoder decodeValueOfObjCType:@encode(BOOL) at:&inside]; + owner = [aDecoder decodeObject]; + return self; +} + +@end diff --git a/Source/libgnustep-gui.m b/Source/libgnustep-gui.m new file mode 100644 index 000000000..af52ad8a9 --- /dev/null +++ b/Source/libgnustep-gui.m @@ -0,0 +1,60 @@ +/* + libgnustep.m + + Main initialization routine for the GNUstep GUI Library + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +id NSApp; + +char **NSArgv; + +// +// The main entry point for X Windows +// +int +GNUstepMain(int argc, char **argv) +{ + NSFontManager *fm; + + // Create the global application object + NSApp = [[NSApplication alloc] init]; + + // Set the application default fonts + fm = [NSFontManager sharedFontManager]; + [NSFont setUserFixedPitchFont: [fm fontWithFamily:@"Arial" + traits:0 weight:0 size:10]]; + [NSFont setUserFont: [fm fontWithFamily:@"Times New Roman" + traits:0 weight:0 size:12]]; + + // Call the user's main + //user_main(0, NULL); + + // Release the application + [NSApp release]; +} diff --git a/Testing/Makefile.in b/Testing/Makefile.in new file mode 100644 index 000000000..bbdd19d70 --- /dev/null +++ b/Testing/Makefile.in @@ -0,0 +1,138 @@ +# +# Makefile for GNUstep GUI Library Test Examples +# Copyright (C) 1996 Free Software Foundation, Inc. +# +# Written by: Scott Christley +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +SHELL = /bin/sh + +#### Start of system configuration section. #### + +srcdir = @srcdir@ +VPATH = @srcdir@ + +CC = @CC@ + +CFLAGS = -Wall -Wno-implicit -g -O +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = + +DYNAMIC_BUNDLER_LINKER=@DYNAMIC_BUNDLER_LINKER@ +DYNAMIC_LDFLAGS=@DYNAMIC_LDFLAGS@ +DYNAMIC_CFLAGS=@DYNAMIC_CFLAGS@ +DEFS = @DEFS@ +LIBS = -L.. -lobj1 -lobj2 -lobjc -lAppKit @LIBS@ -lm -lieee +EXEEXT = +OEXT = .o +LIBEXT = .a + +#### End of system configuration section. #### + +ALL_CPPFLAGS = -I.. -I../Headers $(CPPFLAGS) +ALL_CFLAGS = $(CFLAGS) +ALL_OBJCFLAGS = $(CFLAGS) -Wno-protocol +ALL_LDFLAGS = $(LDFLAGS) $(LIBS) + +.SUFFIXES: .m +.m$(OEXT): + $(CC) -c $(ALL_CPPFLAGS) $(DEFS) $(ALL_OBJCFLAGS) $< -o $*$(OEXT) +.c$(OEXT): + $(CC) -c $(ALL_CPPFLAGS) $(DEFS) $(ALL_CFLAGS) $< -o $*$(OEXT) + +SRCS = \ +nsarchiver.m + +HDRS = + +EXCS = $(SRCS:.m=) +EXECS = $(SRCS:.m=$(EXEEXT)) + +BUNDLE_NAME=LoadMe +DYNAMIC_MFILES = \ +LoadMe.m \ +MyCategory.m \ +SecondClass.m + +DYNAMIC_HFILES = \ +LoadMe.h \ +MyCategory.h \ +SecondClass.h + +DYNAMIC_OFILES = $(DYNAMIC_MFILES:.m=$(OEXT)) + +RCS_FILES = $(SRCS) $(HDRS) $(DYNAMIC_MFILES) $(DYNAMIC_HFILES) \ + Makefile.in NXStringTable.example Makefile.sed.nt +DIST_FILES = $(RCS_FILES) + +# type 'make bundles' if you also want to check bundles. +all: $(EXCS) + +# This works for GNU make, but not others. +# %: %$(OEXT) $(srcdir)/../src/libobjects$(LIBEXT) +# $(CC) $(ALL_CFLAGS) $< -o $@ $(ALL_LDFLAGS) +# How can I do this in a better way than the ugliness below? +# (but also have it work on old-style /bin/make) + +LINK_CMD = $(CC) $(ALL_CFLAGS) $@$(OEXT) -o $@ $(ALL_LDFLAGS) + +nsarchiver: nsarchiver$(OEXT) ../libAppKit$(LIBEXT) + $(LINK_CMD) +diningPhilosophers: diningPhilosophers$(OEXT) ../libAppKit$(LIBEXT) + $(LINK_CMD) + +install: +uninstall: + +echo-excs: + @echo $(EXCS) + +remote: server client + +# These next few lines give an example of how to compile, link and store +# a bundle. +bundles: $(BUNDLE_NAME).bundle/$(BUNDLE_NAME) + +$(DYNAMIC_OFILES): $(DYNAMIC_MFILES) $(DYNAMIC_HFILES) + $(CC) -c $(ALL_CPPFLAGS) $(DEFS) $(DYNAMIC_CFLAGS) $(ALL_OBJCFLAGS) \ + $(srcdir)/$*.m -o $*$(OEXT) + +$(BUNDLE_NAME).bundle/$(BUNDLE_NAME): $(DYNAMIC_OFILES) + -mkdir $(BUNDLE_NAME).bundle + -mkdir $(BUNDLE_NAME).bundle/English.lproj + $(DYNAMIC_BUNDLER_LINKER) -o $(BUNDLE_NAME).bundle/$(BUNDLE_NAME) \ + $(DYNAMIC_OFILES) + cp $(srcdir)/NXStringTable.example $(BUNDLE_NAME).bundle/English.lproj + +mostlyclean: + rm -f core *~ test08.data textcoder.txt + +clean: mostlyclean + rm -f *$(OEXT) $(EXECS) + rm -rf $(BUNDLE_NAME).bundle + +distclean: clean + rm -f Makefile config.status + +realclean: distclean + rm -f TAGS + +copy-dist: $(DIST_FILES) + mkdir ../snap/checks + ln $(DIST_FILES) ../snap/checks + +Makefile: $(srcdir)/Makefile.in + cd ..; $(SHELL) config.status diff --git a/Testing/Makefile.sed.nt b/Testing/Makefile.sed.nt new file mode 100644 index 000000000..d3222d42b --- /dev/null +++ b/Testing/Makefile.sed.nt @@ -0,0 +1,13 @@ +s/@srcdir@/./ +s/@CC@/gcc -fgnu-runtime/ +s/@DYNAMIC_BUNDLER_LINKER@// +s/@DYNAMIC_LDFLAGS@// +s/@DYNAMIC_CFLAGS@// +s/LIBS = -L..\/src -lobjects @LIBOBJC@ @LIBS@ -lm/LIBS = ..\/src\/libobjects.lib libobjc.lib libgcc.lib libc.lib oldnames.lib user32.lib wsock32.lib/ +s/@NEXT_INCLUDES@// +s/CFLAGS = -Wall -Wno-implicit -g -O/CFLAGS = -Wall -Wno-implicit -O/ +s/EXEEXT =/EXEEXT = .exe/ +s/OEXT = .o/OEXT = .obj/ +s/LIBEXT = .a/LIBEXT = .lib/ +s/@DEFS@/-DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_TIMES=1 -DHAVE_VSPRINTF=1 -Dvm_page_size=4096/ +s/LINK_CMD = $(CC) $(ALL_CFLAGS) $@$(OEXT) -o $@ $(ALL_LDFLAGS)/LINK_CMD = nm $@$(OEXT) | grep " __GLOBAL_" > tmpinit.c \& collect tmpinit.c init_$@ \& $(CC) -c init_$@.c \& rm tmpinit.c \& ld $@$(OEXT) init_$@$(OEXT) -o $@$(EXEEXT) $(ALL_LDFLAGS)/ diff --git a/Testing/nsarchiver.dat b/Testing/nsarchiver.dat new file mode 100644 index 0000000000000000000000000000000000000000..40e98b47588d38775af09f3a7dbbc7ac20399f10 GIT binary patch literal 188 zcmZ?w3svw>%1TWx$t+7%a8_{6Nh~f_@X1UnN-U~WaLUXBQqI98MX8Co3T3H9#hLke z3I<&6cy;*&yE_&oX8;W>Lek^R$mGn(=*hys`eB1JBRi16vY +#include +#include + +@interface TestClass : NSObject +{ + id next_responder; +} + +- (void)setNextResponder: anObject; +- nextResponder; +@end + +@implementation TestClass + +- (void)setNextResponder: anObject +{ + next_responder = anObject; +} + +- nextResponder +{ + return next_responder; +} + +// NSCoding protocol +- (void)encodeWithCoder:aCoder +{ + [super encodeWithCoder:aCoder]; + [aCoder encodeObjectReference:next_responder withName:@"Next Responder"]; +} + +- initWithCoder:aDecoder +{ + id d; + [super initWithCoder:aDecoder]; + [aDecoder decodeObjectAt:&next_responder withName:&d]; + return self; +} +@end + +//////////////////////////////////////// + +int main() +{ + id arp; + id r1, r2; + + arp = [[NSAutoreleasePool alloc] init]; + + // Create a simple loop + r1 = [[TestClass alloc] init]; + r2 = [[TestClass alloc] init]; + [r1 setNextResponder: r2]; + [r2 setNextResponder: r1]; + + printf("Writing\n"); + printf("%d\n", [r1 hash]); + printf("%d\n", [r2 hash]); + printf("%d\n", [[r1 nextResponder] hash]); + printf("%d\n", [[r2 nextResponder] hash]); + + //[Coder setDefaultCStreamClass: [TextCStream class]]; + + /* Write it to a file */ + { + id d = [[NSMutableData alloc] init]; + id a = [[NSArchiver alloc] initForWritingWithMutableData: d]; + + [a startEncodingInterconnectedObjects]; + [a encodeRootObject: r1 withName:@"one"]; + [a encodeObject: r2 withName:@"another"]; + [a finishEncodingInterconnectedObjects]; + + [d writeToFile: @"./nsarchiver.dat" atomically:NO]; + + [d release]; + [a release]; + } + + /* Release the object that was coded */ + [r1 release]; + [r2 release]; + + /* Read it back in from the file */ + printf("\nReading:\n"); + { + id d = [[NSData alloc] initWithContentsOfFile: @"./nsarchiver.dat"]; + id a = [[NSUnarchiver alloc] initForReadingWithData: d]; + + [a startDecodingInterconnectedObjects]; + [a decodeObjectAt: &r1 withName:&d]; + [a decodeObjectAt: &r2 withName:&d]; + [a finishDecodingInterconnectedObjects]; + } + + /* Display what we read, to make sure it matches what we wrote */ + { + printf("%d\n", [r1 hash]); + printf("%d\n", [r2 hash]); + printf("%d\n", [[r1 nextResponder] hash]); + printf("%d\n", [[r2 nextResponder] hash]); + } + + /* Do the autorelease. */ + [arp release]; + + exit(0); +} diff --git a/Version b/Version new file mode 100644 index 000000000..26de48e3e --- /dev/null +++ b/Version @@ -0,0 +1,15 @@ +# This file is included in various Makefile's to get version information. + +# The gcc version required to compile the library. +APPKIT_GCC_VERSION = 2.7.0 + +# The version number of this release. +APPKIT_MAJOR_VERSION = 0 +APPKIT_MINOR_VERSION = 1 +APPKIT_SUBMINOR_VERSION = 0 +APPKIT_VERSION = \ +$(APPKIT_MAJOR_VERSION).$(APPKIT_MINOR_VERSION).$(APPKIT_SUBMINOR_VERSION) + +APPKIT_FTP_MACHINE = alpha.gnu.ai.mit.edu +APPKIT_FTP_DIRECTORY = gnu + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 000000000..f0b98985d --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,146 @@ +# aclocal.m4 - configure macros for libobjects and projects that depend on it. +# +# Copyright (C) 1995, 1996 Free Software Foundation, Inc. +# +# Written by: Adam Fedor +# +# This file is part of the GNU Objective-C library. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +AC_DEFUN(OBJC_SYS_AUTOLOAD, +[dnl +#-------------------------------------------------------------------- +# Guess if we are using a object file format that supports automatic +# loading of constructor functions, et. al. (e.g. ELF format). +# +# Currently only looks for ELF format. NOTE: Checking for __ELF__ being +# defined doesnt work, since gcc on Solaris does not define this. I'm +# assuming that machines that have elf.h use the ELF library format, what +# is really needed is to check if this is true directly. +# +# Makes the following substitutions: +# Defines SYS_AUTOLOAD (whether initializer functions are autoloaded) +# Defines CON_AUTOLOAD (whether constructor functions are autoloaded) +#-------------------------------------------------------------------- +AC_CACHE_VAL(objc_cv_sys_autoload, +[AC_CHECK_HEADER(elf.h, [objc_cv_sys_autoload=yes], [objc_cv_sys_autoload=no]) +]) +if test $objc_cv_sys_autoload = yes; then + AC_DEFINE(CON_AUTOLOAD) +fi +AC_CACHE_VAL(objc_subinit_worked, +[AC_MSG_CHECKING(loading of initializer functions) +AC_TRY_RUN([ +static char *argv0 = 0; +static char *env0 = 0; +static void args_test (int argc, char *argv[], char *env[]) +{ + argv0 = argv[0]; + env0 = env[0]; +} +static void * __libobjects_subinit_args__ +__attribute__ ((section ("__libc_subinit"))) = &(args_test); +int main(int argc, char *argv[]) +{ + if (argv[0] == argv0 && env[0] == env0) + exit (0); + exit (1); +} +], objc_subinit_worked=yes, objc_subinit_worked=no, objc_subinit_worked=no)]) +if test $objc_subinit_worked = yes; then + AC_DEFINE(SYS_AUTOLOAD) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +]) + +AC_DEFUN(OBJC_SYS_DYNAMIC_LINKER, +[dnl +#-------------------------------------------------------------------- +# Guess the type of dynamic linker for the system +# +# Makes the following substitutions: +# DYNAMIC_LINKER - cooresponds to the interface that is included +# in objc-load.c (i.e. #include "${DYNAMIC_LINKER}-load.h") +# LIBS - Updated to include the system library that +# performs dynamic linking. +#-------------------------------------------------------------------- +DYNAMIC_LINKER=null +AC_CHECK_LIB(dl, dlopen, [DYNAMIC_LINKER=simple LIBS="${LIBS} -ldl"]) + +if test $DYNAMIC_LINKER = null; then + AC_CHECK_LIB(dld, main, [DYNAMIC_LINKER=dld LIBS="${LIBS} -ldld"]) + AC_CHECK_HEADER(dld/defs.h, objc_found_dld_defs=yes, objc_found_dld_defs=no) + # Try to distinguish between GNU dld and HPUX dld + AC_CHECK_HEADER(dl.h, [DYNAMIC_LINKER=hpux]) + if test $ac_cv_lib_dld = yes && test $objc_found_dld_defs = no && test $ac_cv_header_dl_h = no; then + AC_MSG_WARN(Could not find dld/defs.h header) + echo + echo "Currently, the dld/defs.h header is needed to get information" + echo "about how to use GNU dld. Some files may not compile without" + echo "this header." + echo + fi +fi +AC_SUBST(DYNAMIC_LINKER)dnl +AC_SUBST(DLD_INCLUDE)dnl +]) + +AC_DEFUN(OBJC_SYS_DYNAMIC_FLAGS, +[AC_REQUIRE([OBJC_SYS_DYNAMIC_LINKER])dnl +AC_REQUIRE([OBJC_SYS_AUTOLOAD])dnl +#-------------------------------------------------------------------- +# Set the flags for compiling dynamically loadable objects +# +# Makes the following substitutions: +# DYNAMIC_BUNDLER_LINKER - The command to link the object files into +# a dynamically loadable module. +# DYNAMIC_LDFLAGS - Flags required when compiling the main program +# that will do the dynamic linking +# DYNAMIC_CFLAGS - Flags required when compiling the object files that +# will be included in the loaded module. +#-------------------------------------------------------------------- +if test $DYNAMIC_LINKER = dld; then + DYNAMIC_BUNDLER_LINKER="ld -r" + DYNAMIC_LDFLAGS="-static" + DYNAMIC_CFLAGS="" +elif test $DYNAMIC_LINKER = simple; then + if test $objc_cv_sys_autoload = yes; then + DYNAMIC_BUNDLER_LINKER='$(CC) -Xlinker -r' + else + DYNAMIC_BUNDLER_LINKER='$(CC) -nostdlib' + fi + DYNAMIC_LDFLAGS="" + DYNAMIC_CFLAGS="-fPIC" +elif test $DYNAMIC_LINKER = hpux; then + DYNAMIC_BUNDLER_LINKER='$(CC) -nostdlib -Xlinker -b' + DYNAMIC_LDFLAGS="-Xlinker -E" + DYNAMIC_CFLAGS="-fPIC" +elif test $DYNAMIC_LINKER = null; then + DYNAMIC_BUNDLER_LINKER='$(CC) -nostdlib -Xlinker -r' + DYNAMIC_LDFLAGS="" + DYNAMIC_CFLAGS="" +else + DYNAMIC_BUNDLER_LINKER='$(CC) -nostdlib -Xlinker -r' + DYNAMIC_LDFLAGS="" + DYNAMIC_CFLAGS="" +fi +AC_SUBST(DYNAMIC_BUNDLER_LINKER)dnl +AC_SUBST(DYNAMIC_LDFLAGS)dnl +AC_SUBST(DYNAMIC_CFLAGS)dnl +]) diff --git a/config.guess b/config.guess new file mode 100755 index 000000000..529e53fed --- /dev/null +++ b/config.guess @@ -0,0 +1,348 @@ +#!/bin/sh +# This script attempts to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/-.*//'` + exit 0 ;; + alpha:OSF1:1.*:*) + # 1.2 uses "1.2" for uname -r. + echo alpha-dec-osf${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:V1.*:* | alpha:OSF1:V[2-9].*:*) + # 1.3 and later use "V1.3", etc. for uname -r. + echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'` + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + sun4*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + echo sparc-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + mips:*:5*:RISCos) + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX:*:*) + echo mips-sgi-irix${UNAME_RELEASE} + exit 0 ;; + i[34]86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[3478]??:HP-UX:*:* | 9000/8?7:HP-UX:*:* ) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/7?? | 9000/8?7 ) HP_ARCH=hppa1.1 ;; + 9000/8?? ) HP_ARCH=hppa1.0 ;; + esac + case ${UNAME_RELEASE} in + *.B7.* ) HPUX_REV=7 ;; + *.B8.* | *.08.* ) HPUX_REV=8 ;; + *.09.* ) HPUX_REV=9 ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2:*) + echo c2-convex-bsd + exit 0 ;; + CRAY*X-MP:UNICOS:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:UNICOS:*:*) + echo ymp-cray-unicos + exit 0 ;; + CRAY-2:UNICOS:*:*) + echo cray2-cray-unicos + exit 0 ;; + i[34]86:BSD/386:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + i[34]86:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd + exit 0 ;; + i[34]86:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + i[34]86:UNIX_SV:4.*:* | i[34]86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i[34]86:*:3.2:*) + if /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL + elif test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M680[234]0:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,3[34]??:*:4.0:*) + uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m680[234]0:LynxOS:2.2*:*) + echo m68k-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i[34]86:LynxOS:2.2*:*) + echo i386-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.2*:*) + echo sparc-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c </dev/null`; + if (version==2) + { + printf("%s-next-ns2\n", __ARCHITECTURE__); + exit(0); + } + else + { + printf("%s-next-ns3\n", __ARCHITECTURE__); + exit(0); + } +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf("ns32k-encore-sysv\n"); exit(0); +#else +#if defined (CMU) + printf("ns32k-encore-mach\n"); exit(0); +#else + printf("ns32k-encore-bsd\n"); exit(0); +#endif +#endif +#endif + +#if defined(__386BSD__) || (defined(__bsdi__) && defined(__i386__)) + printf("i386-unknown-bsd\n"); exit(0); +#endif + +#if defined(sequent) +#if defined(i386) + printf("i386-sequent-dynix\n"); exit(0); +#endif +#if defined (ns32000) + printf("ns32k-sequent-dynix\n"); exit(0); +#endif +#endif + +#if defined(_SEQUENT_) + printf("i386-sequent-ptx\n"); exit(0); +#endif + +#if defined(vax) +#if !defined(ultrix) + printf("vax-dec-bsd\n"); exit(0); +#else + printf("vax-dec-ultrix\n"); exit(0); +#endif +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/configure b/configure new file mode 100755 index 000000000..96dc55543 --- /dev/null +++ b/configure @@ -0,0 +1,1004 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.4 +# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE + +# Initialize some other variables. +subdirs= + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -build | --build | --buil | --bui | --bu | --b) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=PREFIX install architecture-dependent files in PREFIX + [same as prefix] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +--enable and --with options recognized:$ac_help +EOF + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.4" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=Source/NSApplication.m + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +# configure.in for GNUstep GUI Library +# Process this file with autoconf to produce a configure script. +# +# Copyright (C) 1996 Free Software Foundation, Inc. +# +# Written by: Scott Christley +# +# This file is part of the GNUstep GUI Library. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +#-------------------------------------------------------------------- +# Find the compiler +#-------------------------------------------------------------------- +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5 | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + + +#-------------------------------------------------------------------- +# Find some programs +#-------------------------------------------------------------------- +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_ifs" + # As a last resort, use the slow shell script. + test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh" +fi + INSTALL="$ac_cv_path_install" +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +#-------------------------------------------------------------------- +# Standard ANSI headers +#-------------------------------------------------------------------- +# If we cannot run a trivial program, we must be cross compiling. +echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_cross=yes +else +cat > conftest.$ac_ext </dev/null; then + ac_cv_c_cross=no +else + ac_cv_c_cross=yes +fi +fi +rm -fr conftest* +fi +cross_compiling=$ac_cv_c_cross +echo "$ac_t""$ac_cv_c_cross" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + ac_cv_header_stdc=no +else +cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +eval $ac_link +if test -s conftest && (./conftest; exit) 2>/dev/null; then + : +else + ac_cv_header_stdc=no +fi +fi +rm -fr conftest* +fi +fi +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + + +#-------------------------------------------------------------------- +# Operating system configuration +#-------------------------------------------------------------------- +config_include='' + + +#-------------------------------------------------------------------- +# Write the Makefiles and configuration files +#-------------------------------------------------------------------- +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.4" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile Source/Makefile Testing/Makefile Headers/gnustep/gui/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@RANLIB@%$RANLIB%g +s%@LN_S@%$LN_S%g +s%@config_include@%$config_include%g + +CEOF +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + + + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + diff --git a/configure.bat b/configure.bat new file mode 100644 index 000000000..a50c1f83f --- /dev/null +++ b/configure.bat @@ -0,0 +1,34 @@ +@echo off +rem +rem Configure.bat +rem +rem Configuration program for GNUstep GUI Library +rem +rem 2/27/95 Initially created +rem + +rem +rem Top level makefile +rem +echo "Top level makefile" +sed -f Makefile.sed.nt Makefile.in >Makefile + +rem +rem Source makefile +rem +cd Source +echo "Source makefile" +sed -f Makefile.sed.nt Makefile.in >Makefile +cd .. + +rem +rem Configuration files +rem +echo "Creating header configuration files" +cd Headers +cd AppKit +rm -f config.h +sed -f config.sed.nt config.h.in >>config.h +cd .. +cd .. + diff --git a/configure.in b/configure.in new file mode 100644 index 000000000..2f066dcd7 --- /dev/null +++ b/configure.in @@ -0,0 +1,55 @@ +AC_INIT(Source/NSApplication.m) + +# configure.in for GNUstep GUI Library +# Process this file with autoconf to produce a configure script. +# +# Copyright (C) 1996 Free Software Foundation, Inc. +# +# Written by: Scott Christley +# +# This file is part of the GNUstep GUI Library. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +#-------------------------------------------------------------------- +# Find the compiler +#-------------------------------------------------------------------- +AC_PROG_CC +AC_PROG_CPP + +#-------------------------------------------------------------------- +# Find some programs +#-------------------------------------------------------------------- +AC_PROG_INSTALL +AC_PROG_RANLIB +AC_LN_S + +#-------------------------------------------------------------------- +# Standard ANSI headers +#-------------------------------------------------------------------- +AC_HEADER_STDC + +#-------------------------------------------------------------------- +# Operating system configuration +#-------------------------------------------------------------------- +config_include='' +AC_SUBST(config_include) + +#-------------------------------------------------------------------- +# Write the Makefiles and configuration files +#-------------------------------------------------------------------- +AC_OUTPUT(Makefile Source/Makefile Testing/Makefile Headers/gnustep/gui/config.h) + diff --git a/install-sh b/install-sh new file mode 100755 index 000000000..240d8f46a --- /dev/null +++ b/install-sh @@ -0,0 +1,119 @@ +#!/bin/sh + +# +# install - install a program, script, or datafile +# This comes from X11R5; it is not part of GNU. +# +# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" + +instcmd="$cpprog" +chmodcmd="" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +fi + +if [ x"$dst" = x ] +then + echo "install: no destination specified" + exit 1 +fi + + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + +if [ -d $dst ] +then + dst="$dst"/`basename $src` +fi + +# Make a temp file name in the proper directory. + +dstdir=`dirname $dst` +dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + +$doit $instcmd $src $dsttmp + +# and set any options; do chmod last to preserve setuid bits + +if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi +if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi +if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi +if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi + +# Now rename the file to the real destination. + +$doit $rmcmd $dst +$doit $mvcmd $dsttmp $dst + + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 000000000..0e2937731 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,35 @@ +#!/bin/sh +# Make directory hierarchy. +# Written by Noah Friedman +# Public domain. + +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +errstatus=0 + +for file in ${1+"$@"} ; do + oIFS="${IFS}" + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'` + IFS="${oIFS}" + + pathcomp='' + + for d in ${1+"$@"} ; do + pathcomp="${pathcomp}${d}" + + if test ! -d "${pathcomp}"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "${pathcomp}" || errstatus=$? + fi + + pathcomp="${pathcomp}/" + done +done + +exit $errstatus + +# eof