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,2005 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: FXMDIClient.h,v 1.31 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXMDICLIENT_H 00025 #define FXMDICLIENT_H 00026 00027 #ifndef FXCOMPOSITE_H 00028 #include "FXComposite.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 class FXMDIChild; 00035 00036 00037 /** 00038 * The MDI client window manages a number of MDI child windows in a multiple-document 00039 * interface (MDI) application. MDI child windows usually receive messages from the GUI controls 00040 * by delegation via the MDI client. This is accomplished by making the MDI client window 00041 * the target for most GUI controls. The MDI client filters out messages intented for itself, 00042 * and delegates the remaining messages to its currently active MDI child, if any. 00043 * If you use the auto-gray or auto-hide feature available in some GUI controls, these 00044 * controls can be automatically grayed out or hidden when there is no active MDI child. 00045 * When delegating messages via MDI client to MDI child windows of different types, care 00046 * should be taken that message ID's do not overlap, so that all message ID's only map to 00047 * the intented handlers no matter which MDI child window type is active. 00048 * The MDI client sends a SEL_CHANGED message to its target when the active MDI child is 00049 * switched, with the void* pointer refering to the new MDI child. 00050 * A MDI Window selection dialog can be brought up through the ID_MDI_OVER_X messages; 00051 * a menu button connected to the MDI client with the ID_MDI_OVER_X message will be 00052 * automatically grayed out if there are less than X MDI child windows. 00053 */ 00054 class FXAPI FXMDIClient : public FXComposite { 00055 FXDECLARE(FXMDIClient) 00056 friend class FXMDIChild; 00057 protected: 00058 FXMDIChild *active; // Active child 00059 FXint cascadex; // Cascade offset X 00060 FXint cascadey; // Cascade offset Y 00061 protected: 00062 FXMDIClient(); 00063 private: 00064 FXMDIClient(const FXMDIClient&); 00065 FXMDIClient &operator=(const FXMDIClient&); 00066 public: 00067 long onCmdActivateNext(FXObject*,FXSelector,void*); 00068 long onCmdActivatePrev(FXObject*,FXSelector,void*); 00069 long onCmdTileHorizontal(FXObject*,FXSelector,void*); 00070 long onCmdTileVertical(FXObject*,FXSelector,void*); 00071 long onCmdCascade(FXObject*,FXSelector,void*); 00072 long onUpdActivateNext(FXObject*,FXSelector,void*); 00073 long onUpdActivatePrev(FXObject*,FXSelector,void*); 00074 long onUpdTileVertical(FXObject*,FXSelector,void*); 00075 long onUpdTileHorizontal(FXObject*,FXSelector,void*); 00076 long onUpdCascade(FXObject*,FXSelector,void*); 00077 long onUpdClose(FXObject*,FXSelector,void*); 00078 long onUpdMenuClose(FXObject*,FXSelector,void*); 00079 long onUpdRestore(FXObject*,FXSelector,void*); 00080 long onUpdMenuRestore(FXObject*,FXSelector,void*); 00081 long onUpdMinimize(FXObject*,FXSelector,void*); 00082 long onUpdMenuMinimize(FXObject*,FXSelector,void*); 00083 long onUpdMaximize(FXObject*,FXSelector,void*); 00084 long onUpdMenuWindow(FXObject*,FXSelector,void*); 00085 long onCmdWindowSelect(FXObject*,FXSelector,void*); 00086 long onUpdWindowSelect(FXObject*,FXSelector,void*); 00087 long onCmdOthersWindows(FXObject*,FXSelector,void*); 00088 long onUpdOthersWindows(FXObject*,FXSelector,void*); 00089 long onUpdAnyWindows(FXObject*,FXSelector,void*); 00090 virtual long onDefault(FXObject*,FXSelector,void*); 00091 public: 00092 enum { 00093 ID_MDI_ANY=65400, 00094 ID_MDI_1, // Select MDI child 1 00095 ID_MDI_2, 00096 ID_MDI_3, 00097 ID_MDI_4, 00098 ID_MDI_5, 00099 ID_MDI_6, 00100 ID_MDI_7, 00101 ID_MDI_8, 00102 ID_MDI_9, 00103 ID_MDI_10, 00104 ID_MDI_OVER_1, // Sensitize MDI menu when 1 or more children 00105 ID_MDI_OVER_2, 00106 ID_MDI_OVER_3, 00107 ID_MDI_OVER_4, 00108 ID_MDI_OVER_5, 00109 ID_MDI_OVER_6, 00110 ID_MDI_OVER_7, 00111 ID_MDI_OVER_8, 00112 ID_MDI_OVER_9, 00113 ID_MDI_OVER_10, 00114 ID_LAST 00115 }; 00116 public: 00117 00118 /// Construct MDI Client window 00119 FXMDIClient(FXComposite* p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00120 00121 /// Return default width 00122 virtual FXint getDefaultWidth(); 00123 00124 /// Return default height 00125 virtual FXint getDefaultHeight(); 00126 00127 /// Perform layout 00128 virtual void layout(); 00129 00130 /** 00131 * Pass message to all MDI windows, stopping when one of 00132 * the MDI windows fails to handle the message. 00133 */ 00134 long forallWindows(FXObject* sender,FXSelector sel,void* ptr); 00135 00136 /** 00137 * Pass message once to all MDI windows with the same document, 00138 * stopping when one of the MDI windows fails to handle the message. 00139 */ 00140 long forallDocuments(FXObject* sender,FXSelector sel,void* ptr); 00141 00142 /** 00143 * Pass message to all MDI Child windows whose target is document, 00144 * stopping when one of the MDI windows fails to handle the message. 00145 */ 00146 long forallDocWindows(FXObject* document,FXObject* sender,FXSelector sel,void* ptr); 00147 00148 /// Set active MDI Child 00149 virtual FXbool setActiveChild(FXMDIChild* child=NULL,FXbool notify=TRUE); 00150 00151 /// Get current active child; may be NULL! 00152 FXMDIChild* getActiveChild() const { return active; } 00153 00154 /// Cascade windows 00155 virtual void cascade(FXbool notify=FALSE); 00156 00157 /// Layout horizontally 00158 virtual void horizontal(FXbool notify=FALSE); 00159 00160 /// Layout vertically 00161 virtual void vertical(FXbool notify=FALSE); 00162 00163 /// Change cascade offset X 00164 void setCascadeX(FXint off){ cascadex=off; } 00165 00166 /// Change cascade offset Y 00167 void setCascadeY(FXint off){ cascadey=off; } 00168 00169 /// Get cascade offset X 00170 FXint getCascadeX() const { return cascadex; } 00171 00172 /// Get cascade offset Y 00173 FXint getCascadeY() const { return cascadey; } 00174 00175 /// Save object to a stream 00176 virtual void save(FXStream& store) const; 00177 00178 /// Load object from a stream 00179 virtual void load(FXStream& store); 00180 00181 /// Destructor 00182 virtual ~FXMDIClient(); 00183 }; 00184 00185 } 00186 00187 #endif
Copyright © 1997-2005 Jeroen van der Zijp |