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,2004 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.29 2004/02/08 17:17:33 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 00039 * a multiple-document interface (MDI) application. 00040 * MDI child windows usually receive messages from the GUI through 00041 * delegation via the MDI client, i.e. the MDI client window is set as 00042 * the target for most GUI commands; the MDI client filters out a few messages 00043 * and forwards all other messages to the active MDI child. 00044 * MDI client can arrange the MDI child windows in various ways:- 00045 * it may maximize one of the MDI child windows, arrange them side-by-side, 00046 * cascade them, or iconify them. 00047 * MDI child windows are notified about changes in the active MDI child 00048 * window by the MDI client. 00049 */ 00050 class FXAPI FXMDIClient : public FXComposite { 00051 FXDECLARE(FXMDIClient) 00052 friend class FXMDIChild; 00053 protected: 00054 FXMDIChild *active; // Active child 00055 FXint cascadex; // Cascade offset X 00056 FXint cascadey; // Cascade offset Y 00057 protected: 00058 FXMDIClient(); 00059 private: 00060 FXMDIClient(const FXMDIClient&); 00061 FXMDIClient &operator=(const FXMDIClient&); 00062 public: 00063 long onCmdActivateNext(FXObject*,FXSelector,void*); 00064 long onCmdActivatePrev(FXObject*,FXSelector,void*); 00065 long onCmdTileHorizontal(FXObject*,FXSelector,void*); 00066 long onCmdTileVertical(FXObject*,FXSelector,void*); 00067 long onCmdCascade(FXObject*,FXSelector,void*); 00068 long onUpdActivateNext(FXObject*,FXSelector,void*); 00069 long onUpdActivatePrev(FXObject*,FXSelector,void*); 00070 long onUpdTileVertical(FXObject*,FXSelector,void*); 00071 long onUpdTileHorizontal(FXObject*,FXSelector,void*); 00072 long onUpdCascade(FXObject*,FXSelector,void*); 00073 long onUpdClose(FXObject*,FXSelector,void*); 00074 long onUpdMenuClose(FXObject*,FXSelector,void*); 00075 long onUpdRestore(FXObject*,FXSelector,void*); 00076 long onUpdMenuRestore(FXObject*,FXSelector,void*); 00077 long onUpdMinimize(FXObject*,FXSelector,void*); 00078 long onUpdMenuMinimize(FXObject*,FXSelector,void*); 00079 long onUpdMaximize(FXObject*,FXSelector,void*); 00080 long onUpdMenuWindow(FXObject*,FXSelector,void*); 00081 long onCmdWindowSelect(FXObject*,FXSelector,void*); 00082 long onUpdWindowSelect(FXObject*,FXSelector,void*); 00083 long onCmdOthersWindows(FXObject*,FXSelector,void*); 00084 long onUpdOthersWindows(FXObject*,FXSelector,void*); 00085 long onUpdAnyWindows(FXObject*,FXSelector,void*); 00086 virtual long onDefault(FXObject*,FXSelector,void*); 00087 public: 00088 enum { 00089 ID_MDI_ANY=65400, 00090 ID_MDI_1, // Select MDI child 1 00091 ID_MDI_2, 00092 ID_MDI_3, 00093 ID_MDI_4, 00094 ID_MDI_5, 00095 ID_MDI_6, 00096 ID_MDI_7, 00097 ID_MDI_8, 00098 ID_MDI_9, 00099 ID_MDI_10, 00100 ID_MDI_OVER_1, // Sensitize MDI menu when 1 or more children 00101 ID_MDI_OVER_2, 00102 ID_MDI_OVER_3, 00103 ID_MDI_OVER_4, 00104 ID_MDI_OVER_5, 00105 ID_MDI_OVER_6, 00106 ID_MDI_OVER_7, 00107 ID_MDI_OVER_8, 00108 ID_MDI_OVER_9, 00109 ID_MDI_OVER_10, 00110 ID_LAST 00111 }; 00112 public: 00113 00114 /// Construct MDI Client window 00115 FXMDIClient(FXComposite* p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00116 00117 /// Return default width 00118 virtual FXint getDefaultWidth(); 00119 00120 /// Return default height 00121 virtual FXint getDefaultHeight(); 00122 00123 /// Perform layout 00124 virtual void layout(); 00125 00126 /** 00127 * Pass message to all MDI windows, stopping when one of 00128 * the MDI windows fails to handle the message. 00129 */ 00130 long forallWindows(FXObject* sender,FXSelector sel,void* ptr); 00131 00132 /** 00133 * Pass message once to all MDI windows with the same document, 00134 * stopping when one of the MDI windows fails to handle the message. 00135 */ 00136 long forallDocuments(FXObject* sender,FXSelector sel,void* ptr); 00137 00138 /** 00139 * Pass message to all MDI Child windows whose target is document, 00140 * stopping when one of the MDI windows fails to handle the message. 00141 */ 00142 long forallDocWindows(FXObject* document,FXObject* sender,FXSelector sel,void* ptr); 00143 00144 /// Set active MDI Child 00145 virtual FXbool setActiveChild(FXMDIChild* child=NULL,FXbool notify=TRUE); 00146 00147 /// Get current active child; may be NULL! 00148 FXMDIChild* getActiveChild() const { return active; } 00149 00150 // Cascade windows 00151 virtual void cascade(FXbool notify=FALSE); 00152 00153 // Layout horizontally 00154 virtual void horizontal(FXbool notify=FALSE); 00155 00156 // Layout vertically 00157 virtual void vertical(FXbool notify=FALSE); 00158 00159 /// Change cascade offset X 00160 void setCascadeX(FXint off){ cascadex=off; } 00161 00162 /// Change cascade offset Y 00163 void setCascadeY(FXint off){ cascadey=off; } 00164 00165 /// Get cascade offset X 00166 FXint getCascadeX() const { return cascadex; } 00167 00168 /// Get cascade offset Y 00169 FXint getCascadeY() const { return cascadey; } 00170 00171 /// Save object to a stream 00172 virtual void save(FXStream& store) const; 00173 00174 /// Load object from a stream 00175 virtual void load(FXStream& store); 00176 00177 /// Destructor 00178 virtual ~FXMDIClient(); 00179 }; 00180 00181 } 00182 00183 #endif
Copyright © 1997-2004 Jeroen van der Zijp |