没有合适的资源?快使用搜索试试~ 我知道了~
首页《使用GNUstep AppKit指南》 - GNUstep的使用指南,简单标注,可能已过时。
《使用GNUstep AppKit指南》 - GNUstep的使用指南,简单标注,可能已过时。
需积分: 0 1 下载量 25 浏览量
更新于2023-11-23
收藏 1.57MB PDF 举报
本文是关于GNUstep AppKit使用的指南,Christopher Armstrong在2005-2006年编写的,可以在GNU Free Documentation License的许可下复制、分发和修改。GNUstep AppKit是一个用于应用程序开发的库。 然而,这份文档表明GNUstep似乎不再维护和支持。资源的名称本身就指出了GNUstep的被弃用。尽管GNUstep AppKit可能仍然可用,但它的使用与简单的标注几乎没有多大意义了。由于GNUstep似乎已经被遗弃,这份文档的质量和实用性也存在风险。 总之,虽然GNUstep AppKit可能仍然存在和可用,但根据文档的表述,可以推断出GNUstep已经寄了。因此,在进行应用程序开发时,可能需要考虑其他替代方案。
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/87733538/bgb.jpg)
Chapter 3: GNUstep Applications 6
You will most likely ever need only two resources: your interface file, and your application’s
property list (Info-gnustep.plist).
3.2 Constructing an application
Below, we have listed the main steps required in the building of an application from scratch.
These steps are listed in a general, but you will generally need to come back to them again
e.g. if you add new source or interface files to your application, you will need to come back
and modify the makefile. See the chapters on Makefile creation, Interface files and Application
property lists for more details on the construction of these various files.
1. GNUmakefile
You will need to create a GNUmakefile to build your application. A generic template is
shown in the chapter entitled see
[Application Makefiles], page 10.
2. Interface Files
You will need at least one interface file (‘.gorm’) for your application, however, you can
create your interface programatically if necessary (although this is rarely recommended).
3. Application Property List
This is generally necessary, especially if you want to define your main interface file, however
it is possible to let the make application generate it for you.
4. Other Resource Files
These may include icons, images, other property lists, application-specific data files. You
can add whatever resource files you like, including directories (which should be added re-
cursively).
3.3 Building a First Application
This section attempts to run you through the steps that you would usually go through to
assemble an application from scratch. We expect that you have some experience programming
with Objective-C, especially with GNUstep, and that you at least have it installed and running
with some applications installed.
Apart from helping you setup the infrastructure for a basic application, we’ve provided instruc-
tions for a basic control and event handler as an example. You may wish to ignore these steps,
but they’re useful reminders if you use these instructions in the future.
A checklist includes:
1. GNUstep Make sure that you have gnustep-make, gnustep-base, gnustep-gui and gnustep-
back installed and running on your system. There system-specific instructions for installing
GNUstep on different systems at the website, http://www.gnustep.org. We also expect
that you have some experience using it, such as sourcing the GNUstep startup shell file and
starting applications. There are various tutorials and instructions available on the internet
for getting GNUstep up and running.
2. Gorm.app Gorm, as mentioned above, is the GNUstep interface builder. It’s available as an
application from the GNUstep web site, and is the recommended means to build interfaces
for applications. Make sure that it will startup and operate correctly on your system. We
will use it to build the interface for our application.
3. A text editor Depending on what platform your working on and whether or not you’re using
a GUI, an editor could be anything simple from vim to a good quality free editor like gedit
or kate. You will need it to edit the source code files and makefiles we will use to build the
application.
4. A shell GNUstep’s makefile system depends heavily on the shell environment that make
commands are invoked in. On Unix, this could be ‘sh’, ‘bash’, ‘ksh’, ‘csh’ or whatever
![](https://csdnimg.cn/release/download_crawler_static/87733538/bgc.jpg)
Chapter 3: GNUstep Applications 7
you prefer to work with. On Windows, you will want to use MSYS which comes with a
minimal Unix-like shell (a port of bash) which is sufficient for use with GNUstep. If you use
the installable binary version of GNUstep for Windows, you should have a copy of MSYS
installed.
We will assume somewhat that you know your way around your filesystem using it, and
that you know most basic commands for creating files, starting programmes, manipulating
directory structures, etc.
3.3.1 Setup
Startup your shell and source GNUstep.sh from your GNUstep installation (if it’s not sourced
by default). Create a directory for your application sources to be created in. For example:
> cd ~
> mkdir firstapp
> cd firstapp
> . /usr/lib/GNUstep/System/Library/Makefiles/GNUstep.sh
>
In the above, we simply created a new directory under our home directory called ‘firstapp’,
changed into it and sourced our GNUstep installation (which in this case is under ‘/usr/lib’
1
).
Next we will create our makefile. Using your favourite editor, create a file called ‘GNUmakefile’
(the case is important). In this case we’re using vim:
touch GNUmakefile
vim GNUmakefile
And in the makefile, add the following:
include $(GNUSTEP_MAKEFILES)/common.make
APP_NAME = FirstApp
FirstApp_OBJC FILES = main.m \
MyController.m
FirstApp_MAIN_MODEL_FILE = FirstApp.gorm
FirstApp_RESOURCE_FILES = FirstApp.gorm
include $(GNUSTEP_MAKEFILES)/application.make
The first line of the makefile includes some declarations common to all makefiles (tools, bundles,
etc).
APP
NAME contains a space-separated list of the applications to build. In this case we’re
only building one (FirstApp). The application wrapper that is outputted will be called
‘FirstApp.app’. This name also is used to prefix each of the following variables. If you were to
change this value, you would have to change the value of OBJC FILES, MAIN MODEL FILE,
etc. accordingly.
FirstApp OBJC FILES contains a list of each of the Objective-C files that will be compiled
into this programme. Note that like normal makefiles, you can split a variable declaration like
this over a number of lines by using the "\" delimeter.
FirstApp MAIN MODEL FILE is the main interface file wrapper.
FirstApp RESOURCE FILES contains a list of all the resources, including interface files, icons,
property lists etc.
The final line lets the makefile system know we want to build an application.
1
Replace ‘/usr/lib’ with the path to your GNUstep installation
![](https://csdnimg.cn/release/download_crawler_static/87733538/bgd.jpg)
Chapter 3: GNUstep Applications 8
3.3.2 Interface File
Make sure you are familiar with Gorm before using this. Refer to the Gorm Manual, a link to
which should be at http://www.gnustep.org/experience/Gorm.html.
Load up Gorm.app and create a "New Application". A window should appear with the title and
a project called "UNTITLED".
openapp Gorm.app
From the menu, select Document->New Application
Save your project as "FirstApp.gorm" by going to Document->Save, navigating to the project
directory, typing in "FirstApp" as the filename and clicking "OK".
Select your window in the project pane. Switch to the Inspector and give it a new name such
as "My First Application".
Switch back to the project pane. Select "Classes" from the toolbar. From the class view, select
"NSObject", goto the main menu and select Classes->Create Subclass.
Double-click the new class in the class view, and double-click to rename it to "MyController"
(case is important). Click "OK" if prompted. We’re going to use this class as our applica-
tion’s main controller, but you can create as many "controller" classes as you like with whatever
names you choose. It just so happens that we’ve decided to create a file with the name "My-
Controller.m" that will contain the implementation of this class. Note that GNUstep doesn’t
enforce a strict MVC pattern on your classes; it merely separates the view part into it’s own
classes which you configure in Gorm.app, and lets you handle data and behaviour (Model and
Controller) in your code as you like.
Select the button in the "Action" column for "MyController" then goto Classes->Add Out-
let/Action. Rename the action to "myAction:". Select the class again, and goto Classes-
>Instantiate. Again, we could call this action whatever we like, just make sure that it’s not
something generic like "click:", which are used by the NSResponder class. The name of the
button in method name form is often a good choice.
For the MyController class, goto the main menu and select Classes->Create Class Files. Save
them as "MyController.h" and "MyController.m". Gorm.app fills out the basic details for this
class (including the action). If you modify the actions and/or outlets on the class in Gorm.app
in the future, you will want to add them to your class interface and implementation manually.
Gorm.app will override your modifications to files if you tell it to create the class files at some
time in the future.
2
Goto the palette, click the third toolbar button and then click and drag a new button object
onto the window. Double-click the button to rename it and call it "My Action".
We now want to connect the button to the action on MyController. First switch to the "Objects"
pane in the project view. Note that our MyController class is listed as an object instance, as
we instantiated it before. Select it, switch to the Inspector and then select "Connections" from
the drop-down box.
Now, make sure that the application window with the button on it and the project window are
both visible at the same time. Hold down your first control key (usually left-Ctrl), click the
button on the window, and drag the icon to the MyController object in the Objects pane and
release. While you are dragging the mouse, you will note that the icon looks like a small circle
with a "T" in it. The source object (the button) will continue to contain the "S" circle while
the target object (the MyController instance) contains the "T" circle.
Goto File->Save to save your interface file and then quit Gorm.app.
2
If you really don’t want to add the outlets/actions to your class by hand if you modify the interface in the future,
you could just save the classes to differently named files and then merge the changes back into the original files.
剩余61页未读,继续阅读
![application/pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![exe](https://img-home.csdnimg.cn/images/20210720083343.png)
![exe](https://img-home.csdnimg.cn/images/20210720083343.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![exe](https://img-home.csdnimg.cn/images/20210720083343.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://profile-avatar.csdnimg.cn/1148bd2a2f5841adb8f667360d9f8c9b_m0_69086552.jpg!1)
etcix
- 粉丝: 62
- 资源: 2
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
会员权益专享
最新资源
- 京瓷TASKalfa系列维修手册:安全与操作指南
- 小波变换在视频压缩中的应用
- Microsoft OfficeXP详解:WordXP、ExcelXP和PowerPointXP
- 雀巢在线媒介投放策划:门户网站与广告效果分析
- 用友NC-V56供应链功能升级详解(84页)
- 计算机病毒与防御策略探索
- 企业网NAT技术实践:2022年部署互联网出口策略
- 软件测试面试必备:概念、原则与常见问题解析
- 2022年Windows IIS服务器内外网配置详解与Serv-U FTP服务器安装
- 中国联通:企业级ICT转型与创新实践
- C#图形图像编程深入解析:GDI+与多媒体应用
- Xilinx AXI Interconnect v2.1用户指南
- DIY编程电缆全攻略:接口类型与自制指南
- 电脑维护与硬盘数据恢复指南
- 计算机网络技术专业剖析:人才培养与改革
- 量化多因子指数增强策略:微观视角的实证分析
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)