GNUstep Renaissance solves the problems which have been troubling previous GNUstep technologies for automating the build of user interfaces; it provides total portability between GNUstep and Apple OSX and can automatically adjust user interfaces for translations or changes in the underlying platform or theme; all this while retaining and expanding all the best ideas such as connections and outlets from the NeXTstep tradition of Interface Builders and NIB files. It is a hot technology, mixing the best ideas from different worlds, which will hopefully provide the basis for the ultimate user interface building tool for the GNUstep programmer. This tutorial helps you learn step by step some of the basics of how to use this exciting software. It is recommended that you read all the tutorials about non-graphical programming in the base series before reading this one. Parallel building allows you to take advantage of modern multicore hardware to reduce the time required to build large and small projects, but unfortunately can introduce a number of frustrating complexities and problems if done by hand. GNUstep make takes care of all the complications for you; its support for parallel building is very sophisticated and effective while still safe and easy to understand and use.

Author:Akimi Zurg
Language:English (Spanish)
Published (Last):9 January 2018
PDF File Size:17.46 Mb
ePub File Size:3.59 Mb
Price:Free* [*Free Regsitration Required]

It looks like this: Figure Just to show how to use "outlet" and "action" in Gorm, and the relation between "controller" and "view". Figure So does the title of window. Now, I need an "controller" to receive the action from the "view", and display the time on the "view".

I need to create a object for this "controller". First, I need to design the class of this "controller". Click the "classes" in the main window of Gorm. I want the class of this "controller" to inherit from NSObject. It will create a new class under the NSObject. I call it "Controller" here.

Choose the "Controller" class and click "Outlets" tab in the inspector. Press "Add" button, and change the name to "label" by double-clicking the "newOutlet". You will notice that "Controller" class now has one outlet. Click on the small round button will list the outlets it has. You should notice that the action is ended with colon : , which will be explained later. Look at the objects of Gorm main window.

You should find a new instance, called "Controller". Hold on "Ctrl", select the "Controller" instance, drag to the label in the window. Look at the inspector, which will show all the outlet the "Controller" instance has. Select the only one "label", click the "connect" button. Hold on "Ctrl", select the button in the window, drag to the "Controller" instance. Look at the inspector, which will show all the outlet the button has. Select the "target" in the outlet column, then select the only one action the target has, "showCurrentTime".

Click the "connect" button. Otherwise, this class has not function at all. Select the class "Controller" not the instance! A "Save" panel will show up and ask the filename. The default is "Controller. Click "O. Save this Gorm file as "TimeMachine. Now, I have a directory, "TimeMachine. The method -showCurrentTime: has the message "sender".

In the "Controller. Therefore, whatever you do on the outlet "label" will reflect to the "label" in the interface, and when the button "Get Current Time" is pressed, the action -showCurrentTime: will be called.

Now, I can put some source code in this class. After setting the format, put the description of current time into the outlet "label". When users click the "Get Current Time" button, it will show the current time.

Add the main. Sometimes, the owner and the controller could be the same. Gorm can work on the custom view, which is designed by the programmer, not the built-in GUI component. Here, I continue my "time machine" application to demonstrate how to do that.

The new interface looks like this: Figure So I will inherit from NSControl. Double-click to change the name. Once the class "TimeView" is created, I can use it as custom view. Build the interface as below: Figure Choose the class "TimeView". Add one outlet for this "TimeView", and one action for the button.

I name the outlet "timeView". Add outlet Figure Connect the button to the action "showCurrentTime", and the outlet "timeView" to the custom view "TimeView". Save this application as "TimeMachine. Now, I need to design the interface for the class "TimeView". The reason that I made them in one class is because I can reuse it later on. Here are the files: TimeView. In TimeView. I also declare two accessory methods to set and get the date.

Other parts of this application should be very easy. Here are the files: Controller. I only need to specify the class the custom view should be. I want a graphic clock, which looks like this: Figure I call this new class "ClockView". The most important method it should override is -drawRect:.

When this view need to update, -drawRect: will be called. Therefore, I put all the drawing in this method. I assign the path, set the color, then draw. A few codes are needed to include ClockView in TimeView. Another is to update ClockView when TimeView is update. This modification is easy to do. You can play around it. Panel Panel is a special kind of window. Read the Cocoa document for more details: Windows and Panels. Since I have a clock already, I want to know the time in different time zones.

My idea is that when I click the title of the NSBox, a panel will show up and ask the time zone. Once the time zone is inputted, it will display the time in that area.

Again, I need a "controller" to control the "view", which is NSPanel in this case. There are many built-in panel in GNUstep. I also use one in this example. Firstly, I need to build the interface for the panel.

Look at the palettes. There is one for panel. Build the interface as below. Here is the attributes of this panel I use. Then where is the "controller"? Generally, I can write a new class as the controller of this view, but this is a small program.

It is not necessary to write a new class only as the controller. So I decide to use the class "TimeView" as the controller for this panel. So class "TimeView" acts as the custom view for that main window interface, and the controller for the panel.

Since "TimeView" is the controller of this panel, I need to connect the outlets and actions. Therefore, I need to create the class "TimeView" again in this gorm file, even though there is already one in TimeMachine. You already know how to create the class "TimeView". I add two outlets, "zonePanel" and "zoneField", and two actions, "okAction:" and "cancelAction:".

The advantage is that I can reduce the number of instances to use. Pay attention to how the NSOwner connects to the panel. Now, I need to add the new outlets and actions into the files of "TimeView". Here is the header. Here, I calculate whether the mouse is clicked in the area of the title of NSBox. Now, I just need to finish the actions part in TimeView.



Creating an App Launch ProjectCenter. In the "New Project Select the location of your application , give it a name here we chose "Converter" and press OK. Editing the interface file Select Interfaces in the main window browser. The project interface files will appear. Depending on the version of ProjectCenter you might find several versions of the interface renaissance markup, for example. Select Convertor.


Developer Documentation


Related Articles