![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * T o p - L e v e l W i n d o w W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2002 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXTopWindow.h,v 1.36 2002/01/18 22:42:55 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXTOPWINDOW_H 00025 #define FXTOPWINDOW_H 00026 00027 #ifndef FXSHELL_H 00028 #include "FXShell.h" 00029 #endif 00030 00031 00032 00033 /// Title and border decorations 00034 enum { 00035 DECOR_NONE = 0, /// Borderless window 00036 DECOR_TITLE = 0x00020000, /// Window title 00037 DECOR_MINIMIZE = 0x00040000, /// Minimize button 00038 DECOR_MAXIMIZE = 0x00080000, /// Maximize button 00039 DECOR_CLOSE = 0x00100000, /// Close button 00040 DECOR_BORDER = 0x00200000, /// Border 00041 DECOR_RESIZE = 0x00400000, /// Resize handles 00042 DECOR_MENU = 0x00800000, /// Window menu 00043 DECOR_ALL = (DECOR_TITLE|DECOR_MINIMIZE|DECOR_MAXIMIZE|DECOR_CLOSE|DECOR_BORDER|DECOR_RESIZE|DECOR_MENU) 00044 }; 00045 00046 00047 /// Initial window placement 00048 enum { 00049 PLACEMENT_DEFAULT, /// Place it at the default size and location 00050 PLACEMENT_VISIBLE, /// Place window to be fully visible 00051 PLACEMENT_CURSOR, /// Place it under the cursor position 00052 PLACEMENT_OWNER, /// Place it centered on its owner 00053 PLACEMENT_SCREEN, /// Place it centered on the screen 00054 PLACEMENT_MAXIMIZED /// Place it maximized to the screen size 00055 }; 00056 00057 00058 class FXToolbar; 00059 00060 00061 00062 /// Abstract base class for all top-level windows 00063 class FXAPI FXTopWindow : public FXShell { 00064 FXDECLARE_ABSTRACT(FXTopWindow) 00065 protected: 00066 FXString title; // Window title 00067 FXIcon *icon; // Window icon (big) 00068 FXIcon *miniIcon; // Window icon (small) 00069 FXint padtop; // Top margin 00070 FXint padbottom; // Bottom margin 00071 FXint padleft; // Left margin 00072 FXint padright; // Right margin 00073 FXint hspacing; // Horizontal child spacing 00074 FXint vspacing; // Vertical child spacing 00075 FXint offx; 00076 FXint offy; 00077 protected: 00078 FXTopWindow(){} 00079 void settitle(); 00080 void seticons(); 00081 void setdecorations(); 00082 virtual void layout(); 00083 FXTopWindow(FXApp* a,const FXString& name,FXIcon *ic,FXIcon *mi,FXuint opts,FXint x,FXint y,FXint w,FXint h,FXint pl,FXint pr,FXint pt,FXint pb,FXint hs,FXint vs); 00084 FXTopWindow(FXWindow* owner,const FXString& name,FXIcon *ic,FXIcon *mi,FXuint opts,FXint x,FXint y,FXint w,FXint h,FXint pl,FXint pr,FXint pt,FXint pb,FXint hs,FXint vs); 00085 private: 00086 FXTopWindow(const FXTopWindow&); 00087 FXTopWindow& operator=(const FXTopWindow&); 00088 #ifdef WIN32 00089 virtual const char* GetClass() const; 00090 static void* makeicon(FXIcon* icon); 00091 #endif 00092 public: 00093 long onClose(FXObject*,FXSelector,void*); 00094 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00095 long onCmdIconify(FXObject*,FXSelector,void*); 00096 long onCmdDeiconify(FXObject*,FXSelector,void*); 00097 long onFocusUp(FXObject*,FXSelector,void*); 00098 long onFocusDown(FXObject*,FXSelector,void*); 00099 long onFocusLeft(FXObject*,FXSelector,void*); 00100 long onFocusRight(FXObject*,FXSelector,void*); 00101 public: 00102 enum { 00103 ID_ICONIFY=FXShell::ID_LAST, /// Iconify the window 00104 ID_DEICONIFY, /// Deiconify the window 00105 ID_QUERY_DOCK, /// Toolbar asks to dock 00106 ID_LAST 00107 }; 00108 public: 00109 00110 /// Create server-side resources 00111 virtual void create(); 00112 00113 /// Detach the server-side resources for this window 00114 virtual void detach(); 00115 00116 /// Move the focus to this window 00117 virtual void setFocus(); 00118 00119 /// Remove the focus from this window 00120 virtual void killFocus(); 00121 00122 /// Show this window 00123 virtual void show(); 00124 00125 /// Hide this window 00126 virtual void hide(); 00127 00128 /// Show this window with given placement 00129 virtual void show(FXuint placement); 00130 00131 /// Position the window based on placement 00132 void place(FXuint placement); 00133 00134 /// Return the default width of this window 00135 virtual FXint getDefaultWidth(); 00136 00137 /// Return the default height of this window 00138 virtual FXint getDefaultHeight(); 00139 00140 /// Move this window to the specified position in the parent's coordinates 00141 virtual void move(FXint x,FXint y); 00142 00143 /// Resize this window to the specified width and height 00144 virtual void resize(FXint w,FXint h); 00145 00146 /// Move and resize this window in the parent's coordinates 00147 virtual void position(FXint x,FXint y,FXint w,FXint h); 00148 00149 /// Iconify window 00150 virtual void iconify(); 00151 00152 /// Deiconify window 00153 virtual void deiconify(); 00154 00155 /// Return TRUE if window has been iconified 00156 FXbool isIconified() const; 00157 00158 /// Change window title 00159 void setTitle(const FXString& name); 00160 00161 /// Return window title 00162 FXString getTitle() const { return title; } 00163 00164 /// Change top padding 00165 void setPadTop(FXint pt); 00166 00167 /// Get top interior padding 00168 FXint getPadTop() const { return padtop; } 00169 00170 /// Change bottom padding 00171 void setPadBottom(FXint pb); 00172 00173 /// Get bottom interior padding 00174 FXint getPadBottom() const { return padbottom; } 00175 00176 /// Change left padding 00177 void setPadLeft(FXint pl); 00178 00179 /// Get left interior padding 00180 FXint getPadLeft() const { return padleft; } 00181 00182 /// Change right padding 00183 void setPadRight(FXint pr); 00184 00185 /// Get right interior padding 00186 FXint getPadRight() const { return padright; } 00187 00188 /// Return horizontal spacing between children 00189 FXint getHSpacing() const { return hspacing; } 00190 00191 /// Return vertical spacing between children 00192 FXint getVSpacing() const { return vspacing; } 00193 00194 /// Change horizontal spacing between children 00195 void setHSpacing(FXint hs); 00196 00197 /// Change vertical spacing between children 00198 void setVSpacing(FXint vs); 00199 00200 /// Change packing hints for children 00201 void setPackingHints(FXuint ph); 00202 00203 /// Return packing hints for children 00204 FXuint getPackingHints() const; 00205 00206 /// Change title and border decorations 00207 void setDecorations(FXuint decorations); 00208 00209 /// Return current title and border decorations 00210 FXuint getDecorations() const; 00211 00212 /// Return window icon 00213 FXIcon* getIcon() const { return icon; } 00214 00215 /// Change window icon 00216 void setIcon(FXIcon* ic); 00217 00218 /// Return window mini (title) icon 00219 FXIcon* getMiniIcon() const { return miniIcon; } 00220 00221 /// Change window mini (title) icon 00222 void setMiniIcon(FXIcon *ic); 00223 00224 /// Save to stream 00225 virtual void save(FXStream& store) const; 00226 00227 /// Load from stream 00228 virtual void load(FXStream& store); 00229 00230 /// Destructor 00231 virtual ~FXTopWindow(); 00232 }; 00233 00234 00235 #endif