blob: 1cb6cf740fa3484e6a083efc2810dc20378e7623 [file] [log] [blame]
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/"); require_once($_SERVER['DOCUMENT_ROOT'] . "/"); require_once($_SERVER['DOCUMENT_ROOT'] . "/"); $App = new App(); $Nav = new Nav(); $Menu = new Menu(); include($App->getProjectCommon()); # All on the same line to unclutter the user's desktop'
# author_tips.php
# Author: Chris Gross
# Date: 2006-05-07
# Description:
# Begin: page-specific settings. Change these.
$pageTitle = "Tips, Tricks and Guidelines for Widget Authors";
$pageKeywords = "Nebula, SWT, Widgets, Controls";
$pageAuthor = "Chris Gross";
# Add page-specific Nav bars here
# Format is Link text, link URL (can be, target (_self, _blank), level (1, 2 or 3)
# $Nav->addNavSeparator("My Page Links", "downloads.php");
# $Nav->addCustomNav("My Link", "mypage.php", "_self", 3);
# $Nav->addCustomNav("Google", "", "_blank", 3);
# End: page-specific settings
# Paste your HTML content between the EOHTML markers!
$html = <<<EOHTML
<div id="midcolumn">
<h2>External Links</h2>
<li><a href="">Creating Your Own Widgets using SWT</a></li>
<li><a href="">SWT Custom Widgets</a></li>
<li><a href="">Developing custom widgets with SWT - Tutorial</a></li>
<p>The following is a list of various tips, tricks, guidelines and other general information
for developers writing custom widgets for Nebula. This is an unorganized list which will
hopefully become larger and more organized over time. Many of the items below will also help your code
and your widget more closely match SWT.
<li><b>Don't paint outside the paint event.</b> When you want draw something new on your
widget simply invalidate it (redraw) and allow it repainted by the OS.
<li><b>Be wary of ScrolledComposite.</b> ScrolledComposite can allow you to quickly and
easily add scrolling to your widget but there are limitations. Windows has a limitation on
the maximum size of a control (32k pixels). Therefore your widget will have a maximum size to its
<li><b>Fail fast - use checkWidget.</b> Each public method should be prefaced with a call
to checkWidget.
<li><b>Use the SWT error methods.</b> Stay consistent with SWT by using the SWT exception
methods in the main SWT class.
<li><b>Don't override dispose.</b> The dispose method is not called when an item is disposed
as its parent is disposed. If you need to perform some dispose logic, listen for the dispose
<li><b>Dispose of items.</b> If your widget contains items, you will need to dispose of the items
when the main widget is disposed.
<li><b>checkStyle.</b> SWT widgets are driven by style bits. As a general guideline, include
a simple static method that filters those styles utilized by your widget (and call it checkStyle).
This method should return the filtered style which can then be passed down to the super constructor.
This will allow the getStyle method to answer correctly.
<li><b>Don't forget SWT.RIGHT_TO_LEFT and SWT.LEFT_TO_RIGHT.</b> In the aforementioned checkStyle method,
don't forget to accept the two BiDi styles.
<li><b>isXXX vs getXXX.</b> Follow the proper conventions for boolean getters. Preface methods which
simply return a property value with 'get'. Preface methods which return the status of a property
based on more complex logic with 'is' (ex getVisible/setVisible/isVisible).
<li><b>Don't forget to redraw.</b> When a method changes a value that affects the visual appearance of
your widget it will need to be redrawn. Redraws can occur automatically for a variety of reasons and during
testing it may not be obvious that a redraw was missing. All methods that affect the visual appearance need
to end in redraw().
<li><b>Be transparent friendly.</b> TODO
<li><b>Popups.</b> TODO
<hr class="clearer"/>
# Generate the web page
$App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html);