nux-0.9.46
|
00001 /* 00002 * Copyright 2010 Inalogic® Inc. 00003 * 00004 * This program is free software: you can redistribute it and/or modify it 00005 * under the terms of the GNU Lesser General Public License, as 00006 * published by the Free Software Foundation; either version 2.1 or 3.0 00007 * of the License. 00008 * 00009 * This program is distributed in the hope that it will be useful, but 00010 * WITHOUT ANY WARRANTY; without even the implied warranties of 00011 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 00012 * PURPOSE. See the applicable version of the GNU Lesser General Public 00013 * License for more details. 00014 * 00015 * You should have received a copy of both the GNU Lesser General Public 00016 * License along with this program. If not, see <http://www.gnu.org/licenses/> 00017 * 00018 * Authored by: Jay Taoko <jaytaoko@inalogic.com> 00019 * 00020 */ 00021 00022 00023 #ifndef UTILS_H 00024 #define UTILS_H 00025 00026 // check if a value lies within a closed interval 00027 #ifndef IN_BOUNDS 00028 #define IN_BOUNDS( x, lo, hi ) ( (x) >= (lo) && (x) <= (hi) ) 00029 #endif 00030 00031 //check if a 2D point lies within a 2D box 00032 #ifndef PT_IN_BOX 00033 #define PT_IN_BOX( x, y, lo_x, hi_x, lo_y, hi_y ) ( IN_BOUNDS(x,lo_x,hi_x) && IN_BOUNDS(y,lo_y,hi_y) ) 00034 #endif 00035 00036 namespace nux 00037 { 00038 typedef enum 00039 { 00040 eSolveNone = (0L), 00041 eMouseEventSolved = (1L), 00042 eKeyEventSolved = (1L) << 1, 00043 eDoNotProcess = (1L) << 2, 00044 EVENT_CYCLE_EXCLUSIVE = (1L) << 3, 00045 EVENT_CYCLE_EXCLUSIVE_CONTINUE = (1L) << 4, 00046 EVENT_CYCLE_SOLVED = (1L) << 5, 00047 EVENT_CYCLE_DO_NOT_PROCESS = (1L) << 6, 00048 EVENT_CYCLE_RESET_AREA_STATE = (1L) << 7, 00049 } EventCycleStatus; 00050 00051 enum PositionPolicy 00052 { 00053 ePositionLeft, 00054 ePositionRight, 00055 ePositionCenter, 00056 ePositionFull, 00057 ePositionProportional, 00058 }; 00059 00060 enum SizePolicy 00061 { 00062 eSizeFixed, 00063 eSizeResizeable, 00064 }; 00065 00066 typedef enum /*RectangleShapeCorners*/ 00067 { 00068 eCornerNone = 0, 00069 eCornerTopLeft = (1L), 00070 eCornerTopRight = (1L << 1), 00071 eCornerBottomLeft = (1L << 2), 00072 eCornerBottomRight = (1L << 3), 00073 eAllCorners = eCornerTopLeft | eCornerTopRight | eCornerBottomLeft | eCornerBottomRight, 00074 } ShapeCornerType; 00075 00076 enum TextureAlignment 00077 { 00078 eTACenter, 00079 eTALeft, 00080 eTARight, 00081 eTATop, 00082 eTABottom 00083 }; 00084 00085 enum VerticalAlignment 00086 { 00087 eVACenter, 00088 eVATop, 00089 eVABottom 00090 }; 00091 00092 enum HorizontalAlignment 00093 { 00094 eHACenter, 00095 eHALeft, 00096 eHARight, 00097 }; 00098 00099 typedef Rect Geometry; 00100 00101 typedef struct 00102 { 00103 int x; 00104 int y; 00105 int width; 00106 int height; 00107 00108 int x_clipregion; 00109 int y_clipregion; 00110 int width_clipregion; 00111 int height_clipregion; 00112 00113 } DrawAreaContext; 00114 00115 00116 bool IsMouseOwned(); 00117 00118 } 00119 00120 #endif // UTILS_H