Permalink
Browse files

add hotcocoa stuff

git-svn-id: https://svn.macosforge.org/repository/ruby/MacRubyWebsite/trunk@897 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
rich@infoether.com
rich@infoether.com committed Mar 13, 2009
1 parent fa5100e commit 0f2c2bed5f9e1e19e10e20fd73837503582f86d4
View
@@ -6,7 +6,7 @@ filter: erb
<li><a href="/blog/index.html" title="Blog"><img src="/images/nav_blog.png" alt="Blog" /></a></li>
<li><a href="/source.html" title="Source"><img src="/images/nav_source.png" alt="Source" /></a></li>
<li><a href="/documentation.html" title="Documentation"><img src="/images/nav_documentation.png" alt="Home" /></a></li>
- <li><a href="/contact-us.html" title="Contact"><img src="/images/nav_tickets.png" alt="Contact Us" /></a></li>
+ <li><a href="/contact-us.html" title="Contact"><img src="/images/nav_contact.png" alt="Contact Us" /></a></li>
<li class="last"><img src="/images/three_easy_steps.png" alt="" id="3steps" /></li>
</ul><!-- // end nav -->
View
@@ -62,6 +62,10 @@ strong {
font-weight: bold;
}
+p code {
+ font-family: Monaco, Courier;
+}
+
div#step1 {
background-image: url(../images/step1.png);
width: 265px;
@@ -244,6 +248,16 @@ div.article .date {
margin-bottom: 5px;
}
+.new_page {
+ color: #900;
+ padding-right: 10px;
+}
+
+.updated_page {
+ color: #900;
+ padding-right: 10px;
+}
+
div.article .header {
border-bottom: 1px dotted #aaa;
margin-bottom: 4px;
@@ -20,11 +20,11 @@ h2. Tutorials
<ul class="tutorial_list">
<%
tutorials = @pages.find(:all, :in_directory => @page.dir, :recursive => true,
- :sort_by => "created_at", :reverse => true, :tutorial => true)
+ :sort_by => "updated_at", :reverse => true, :tutorial => true)
tutorials.delete(@page)
tutorials.each do |page|
-%>
-<li><span class="date"><%= page.created_at.strftime('%Y-%m-%d') %></span><span class="name"><%= link_to_page(page) %></span><span class="author">By <%= member_name(page.author) %></span>
+<li><span class="date"><%= page.updated_at.strftime('%Y-%m-%d') %></span><span class="name"><%= link_to_page(page) %></span><%= new_or_updated_indicator(page) %><span class="author">By <%= member_name(page.author) %></span>
<% end -%>
</ul>
@@ -1,6 +1,7 @@
---
title: Introductory Tutorial
-created_at: 2009-03-11 08:25:23.244103 -04:00
+created_at: 2008-06-16 08:25:23.244103 -04:00
+updated_at: 2009-03-11 08:25:23.244103 -04:00
tutorial: true
author: lrz
filter:
View
@@ -0,0 +1,50 @@
+---
+title: HotCocoa
+created_at: 2009-03-12 21:06:50.998294 -04:00
+filter:
+ - erb
+ - textile
+---
+h1(title). <%= h(@page.title) %>
+
+HotCocoa is a thin, idiomatic Ruby layer that sits above Cocoa and other frameworks. HotCocoa will be included with MacRuby when it ships in future versions of OS X and is currently included in the MacRuby distributions.
+
+Cocoa classes have extremely large method and constant names. A substantial amount of code is written to just instantiate and configure instances of these classes. Interface Builder is used by most developers because it hides the complexity of manually configuring controls, but at the expense have having to use a GUI builder and the obscuring those configuration options inside the IB user interface. One of HotCocoa's chief goals is to allow Interface Builder simplicity, but in Ruby code.
+
+Buttons, Sliders, Windows, WebViews...the whole works...HotCocoa simplifies this process by creating a mapping layer over the top of Objective C classes. HotCocoa adds Ruby-friendly methods, constants and delegate techniques that look refreshingly simple, but do not prevent full use of the Cocoa APIs. If you've done any amount of programming on OS X, you know that the API can be quite verbose.
+
+Even with MacRuby's wonderful keyword arguments, it can be daunting to enter this...
+
+<code><pre class="commands">
+win = NSWindow.alloc.initWithContentRect [10,20,300,300],
+ :styleMask => (NSTitledWindowMask |
+ NSClosableWindowMask |
+ NSMiniaturizableWindowMask |
+ NSResizableWindowMask)
+</pre></code>
+
+...every time you want to create and configure a new NSWindow instance!
+
+This is the reason most developers use Interface Builder to configure interface components. The purpose of HotCocoa is to allow you to use the flexible syntax of Ruby and its dynamic nature to simplify programmatically constructing user interfaces on OS X without an Interface Builder.
+
+With HotCocoa, creating the NSWindow instance above is as simple as:
+
+<code><pre class="commands">
+win = window :frame => [10,20,300,300]
+</pre></code>
+
+HotCocoa achieves this feat by creating Mappings over the most common Classes and Constants used on OS X. Those mappings create constructor methods on the HotCocoa module (like the "window" method above). Each constructor method accepts an optional block which yields the created instance (more on that in the HotCocoaTutorial). Mappings also decorate the standard Objective-C API with nice Ruby APIs for common operations. The important thing to realize is the constructor methods return real instances of these common classes, not high-level abstractions. So, you can call any Objective-C method available on those objects.
+
+h3. In HotCocoa, Mappings provide the following:
+
+* <strong>Defaults:</strong> Smart default constructor parameters (like the styles in window) to minimize the parameters you have to pass in.
+* <strong>Constants:</strong> Mapping of constants to Ruby symbols to minimize the text and readability of HotCocoa applications.
+* <strong>Constructors:</strong> Building the instances of the mapped classes using the correct class-specific APIs.
+* <strong>Custom Methods:</strong> Ruby-friendly API for commonly used methods (like << for addSubview on NSView subclasses).
+* <strong>Delegate Methods:</strong> Simplified Ruby-friendly methods for delegating instances that use Ruby blocks
+
+<div style="margin-top:8px;"></div>
+
+h3. Want to learn more about HotCocoa?
+
+Now that you understand the basics of what HotCocoa is and why we are building it, please look at the "HotCocoa Tutorial":/hotcocoa/tutorial.html for examples of how to build OS X applications with it. For a more detailed understanding of how to read, create, edit or contribute mapping files, see "HotCocoa Mappings":/hotcocoa/mappings.html. For the current status of the project, see "HotCocoa Mapping Status":/hotcocoa/status.html.
Oops, something went wrong.

0 comments on commit 0f2c2be

Please sign in to comment.