1/* 2 * Copyright 2010 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Alex Wilson, yourpalal2@gmail.com 7 */ 8 9 10/*! 11 \page interface_intro Introduction to the Interface Kit 12 \ingroup interface 13 14 \section Overview 15 16 The Interface Kit holds all the classes you'll need to develop a GUI. 17 Building on the messaging facilities provided by the Application Kit, 18 the Interface Kit can be used to create a responsive and attractive 19 graphical user interface. 20 21 The most important class in the Interface Kit is the BView class, which 22 handles drawing and user interaction. Pointer and keyboard events are 23 processed in this class. 24 25 Another important class is the BWindow class, which holds BViews and makes 26 them visible to the user. The BWindow class also handles BView focusing 27 and BMessage dispatching, among other things. 28 29 A new addition Haiku has added over the BeOS API is the Layout API, which 30 is based around the BLayoutItem and BLayout classes. These classes will 31 take care of making sure all your GUI widgets end up where you want them, 32 with enough space to be useful. You can start learning the Layout API 33 by reading the \link layout_intro introduction \endlink. 34 35 \section Coordinate spaces 36 37 All APIs using coordinates (such as \link BRect or \link BPoint ) refer to 38 a specific space where these coordinates are interpreted. \link BView and 39 \link BWindow provide various conversion function to translate coordinates 40 between different spaces, as needed, or provide separate methods such as 41 BView Bounds() and Frame(), returning results in different spaces as needed. 42 43 The initial coordinate space, from which all others are derived, is the 44 screen space. Its origin is at the center of the screen's top-left pixel. 45 Coordinates can be converted between this and a specific window or view 46 space is done using the ConvertToScreen and ConvertFromScreen methods of 47 the corresponding object. 48 49 Each BWindow has its own coordinate space. Its origin is at the center of 50 the top-left pixel of the window client area (just inside the window border). 51 Root level views added to the window have their frame rectangle defined in 52 this space. 53 54 Each BView also gets its own coordinate space. The origin is initially at the 55 top left of the view, but this can be changed by scrolling the view 56 (programatically using ScrollBy or ScrollTo, or by the user acting on a scrollbar). 57 58 Additionally, each BView also has a drawing space. This is further transformed 59 from the BView coordinate space by calls to SetOrigin, SetScale, SetTransform, 60 ScaleBy, RotateBy, and TranslateBy. The effects of the first two of these 61 methods are independant from the other four, and it's not recommended to mix 62 the two types of transformations in the same BView. Note that this is the only space 63 that can be scaled and rotated, and translated by non-integer units. All other 64 coordinate spaces are only translations of the screen one and remain aligned on pixels. 65 66 All drawing operations in a BView use coordinates specified in the drawing space. 67 However, the update rect passed to the Draw method (or passed to the Invalidate 68 method) is in the BView base coordinate space. Conversion between the two can 69 be done using the affine transform returned by BView::Transform, or in case the 70 legacy transformation functions are used, by applying the scale and origin returned 71 by the Scale() and Origin() functions. 72*/ 73