![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * M u l t i p l e D o c u m e n t C l i e n t W i n d o w * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2009 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published by * 00010 * the Free Software Foundation; either version 3 of the License, or * 00011 * (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 * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with this program. If not, see <http://www.gnu.org/licenses/> * 00020 ********************************************************************************* 00021 * $Id: FXMDIClient.h,v 1.41 2009/01/06 13:07:25 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FXMDICLIENT_H 00024 #define FXMDICLIENT_H 00025 00026 #ifndef FXCOMPOSITE_H 00027 #include "FXComposite.h" 00028 #endif 00029 00030 namespace FX { 00031 00032 00033 class FXMDIChild; 00034 00035 00036 /** 00037 * The MDI client window manages a number of MDI child windows in a multiple-document 00038 * interface (MDI) application. MDI child windows usually receive messages from the GUI controls 00039 * by delegation via the MDI client. This is accomplished by making the MDI client window 00040 * the target for most GUI controls. The MDI client filters out messages intented for itself, 00041 * and delegates the remaining messages to its currently active MDI child, if any. 00042 * If you use the auto-gray or auto-hide feature available in some GUI controls, these 00043 * controls can be automatically grayed out or hidden when there is no active MDI child. 00044 * When delegating messages via MDI client to MDI child windows of different types, care 00045 * should be taken that message ID's do not overlap, so that all message ID's only map to 00046 * the intented handlers no matter which MDI child window type is active. 00047 * The MDI client sends a SEL_CHANGED message to its target when the active MDI child is 00048 * switched, with the void* pointer refering to the new MDI child. 00049 * A MDI Window selection dialog can be brought up through the ID_MDI_OVER_X messages; 00050 * a menu button connected to the MDI client with the ID_MDI_OVER_X message will be 00051 * automatically grayed out if there are less than X MDI child windows. 00052 * The ID_MDI_ANY may be connected to a menu separator to cause automatic hiding of the 00053 * menu separator when no MDI child windows are present. 00054 */ 00055 class FXAPI FXMDIClient : public FXComposite { 00056 FXDECLARE(FXMDIClient) 00057 friend class FXMDIChild; 00058 protected: 00059 FXMDIChild *active; // Active child 00060 FXImage *backImage; // Optional background image 00061 FXint cascadex; // Cascade offset X 00062 FXint cascadey; // Cascade offset Y 00063 protected: 00064 FXMDIClient(); 00065 private: 00066 FXMDIClient(const FXMDIClient&); 00067 FXMDIClient &operator=(const FXMDIClient&); 00068 public: 00069 long onPaint(FXObject*,FXSelector,void*); 00070 long onCmdActivateNext(FXObject*,FXSelector,void*); 00071 long onCmdActivatePrev(FXObject*,FXSelector,void*); 00072 long onCmdTileHorizontal(FXObject*,FXSelector,void*); 00073 long onCmdTileVertical(FXObject*,FXSelector,void*); 00074 long onCmdCascade(FXObject*,FXSelector,void*); 00075 long onUpdActivateNext(FXObject*,FXSelector,void*); 00076 long onUpdActivatePrev(FXObject*,FXSelector,void*); 00077 long onUpdTileVertical(FXObject*,FXSelector,void*); 00078 long onUpdTileHorizontal(FXObject*,FXSelector,void*); 00079 long onUpdCascade(FXObject*,FXSelector,void*); 00080 long onUpdClose(FXObject*,FXSelector,void*); 00081 long onUpdMenuClose(FXObject*,FXSelector,void*); 00082 long onUpdRestore(FXObject*,FXSelector,void*); 00083 long onUpdMenuRestore(FXObject*,FXSelector,void*); 00084 long onUpdMinimize(FXObject*,FXSelector,void*); 00085 long onUpdMenuMinimize(FXObject*,FXSelector,void*); 00086 long onUpdMaximize(FXObject*,FXSelector,void*); 00087 long onUpdMenuWindow(FXObject*,FXSelector,void*); 00088 long onCmdWindowSelect(FXObject*,FXSelector,void*); 00089 long onUpdWindowSelect(FXObject*,FXSelector,void*); 00090 long onCmdOthersWindows(FXObject*,FXSelector,void*); 00091 long onUpdOthersWindows(FXObject*,FXSelector,void*); 00092 long onUpdAnyWindows(FXObject*,FXSelector,void*); 00093 virtual long onDefault(FXObject*,FXSelector,void*); 00094 public: 00095 enum { 00096 ID_MDI_ANY=65400, 00097 ID_MDI_1, // Select MDI child 1 00098 ID_MDI_2, 00099 ID_MDI_3, 00100 ID_MDI_4, 00101 ID_MDI_5, 00102 ID_MDI_6, 00103 ID_MDI_7, 00104 ID_MDI_8, 00105 ID_MDI_9, 00106 ID_MDI_10, 00107 ID_MDI_OVER_1, // Sensitize MDI menu when 1 or more children 00108 ID_MDI_OVER_2, 00109 ID_MDI_OVER_3, 00110 ID_MDI_OVER_4, 00111 ID_MDI_OVER_5, 00112 ID_MDI_OVER_6, 00113 ID_MDI_OVER_7, 00114 ID_MDI_OVER_8, 00115 ID_MDI_OVER_9, 00116 ID_MDI_OVER_10, 00117 ID_LAST 00118 }; 00119 public: 00120 00121 /// Construct MDI Client window 00122 FXMDIClient(FXComposite* p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00123 00124 /// Create window 00125 virtual void create(); 00126 00127 /// Return default width 00128 virtual FXint getDefaultWidth(); 00129 00130 /// Return default height 00131 virtual FXint getDefaultHeight(); 00132 00133 /// Perform layout 00134 virtual void layout(); 00135 00136 /** 00137 * Pass message to all MDI windows, stopping when one of 00138 * the MDI windows fails to handle the message. 00139 */ 00140 long forallWindows(FXObject* sender,FXSelector sel,void* ptr); 00141 00142 /** 00143 * Pass message once to all MDI windows with the same document, 00144 * stopping when one of the MDI windows fails to handle the message. 00145 */ 00146 long forallDocuments(FXObject* sender,FXSelector sel,void* ptr); 00147 00148 /** 00149 * Pass message to all MDI Child windows whose target is document, 00150 * stopping when one of the MDI windows fails to handle the message. 00151 */ 00152 long forallDocWindows(FXObject* document,FXObject* sender,FXSelector sel,void* ptr); 00153 00154 /// Set active MDI Child 00155 virtual FXbool setActiveChild(FXMDIChild* child=NULL,FXbool notify=true); 00156 00157 /// Get current active child; may be NULL! 00158 FXMDIChild* getActiveChild() const { return active; } 00159 00160 /// Get active document; this is the target of the active MDI Child, if any 00161 FXObject* getActiveDocument() const; 00162 00163 /// Change background image 00164 void setBackImage(FXImage* img); 00165 00166 /// Return background image 00167 FXImage* getBackImage() const { return backImage; } 00168 00169 /// Cascade windows 00170 virtual void cascade(FXbool notify=false); 00171 00172 /// Layout horizontally 00173 virtual void horizontal(FXbool notify=false); 00174 00175 /// Layout vertically 00176 virtual void vertical(FXbool notify=false); 00177 00178 /// Change cascade offset X 00179 void setCascadeX(FXint off){ cascadex=off; } 00180 00181 /// Change cascade offset Y 00182 void setCascadeY(FXint off){ cascadey=off; } 00183 00184 /// Get cascade offset X 00185 FXint getCascadeX() const { return cascadex; } 00186 00187 /// Get cascade offset Y 00188 FXint getCascadeY() const { return cascadey; } 00189 00190 /// Save object to a stream 00191 virtual void save(FXStream& store) const; 00192 00193 /// Load object from a stream 00194 virtual void load(FXStream& store); 00195 00196 /// Destructor 00197 virtual ~FXMDIClient(); 00198 }; 00199 00200 } 00201 00202 #endif
![]() |