@@ -71,25 +71,11 @@ BOOL InitializeGroups()
7171 if (!RegisterClassEx (& wce ))
7272 return FALSE;
7373
74- // TempCreateGroup();
75-
76- CreateGroupWindow (NULL );
74+ // CreateGroupWindow(NULL);
7775
7876 return TRUE;
7977}
8078
81-
82- /* * * *\
83- TempCreateGroup -
84- th
85- RETURNS -
86- real
87- \* * * */
88- VOID TempCreateGroup ()
89- {
90- return ;
91- }
92-
9379/* * * *\
9480 CreateGroupWindow -
9581 Create an MDI window from a group structure
@@ -101,35 +87,69 @@ PGROUPWND CreateGroupWindow(PGROUP pgGroup)
10187{
10288 GROUPWND gw = { NULL };
10389 MDICREATESTRUCT mcs = { NULL };
104- HWND hGroup ;
90+ HICON hIconBig = NULL ;
91+ HICON hIconSmall = NULL ;
92+
93+ // Copy group structure to our group window
94+ gw .grp = * pgGroup ;
10595
10696 // TODO: allocate memory from pgwArray in here
10797
108- // TODO: rethink the structure of this, when i create a group window
109- // i don't have a pggroup handle. or maybe i do. think about this
110- // just a little bit more, thanks!
98+ // TODO: Automatically add itself to the array of
99+ // PGW pointers?
100+
101+ // Get group minimized/maximized flags
111102
112103 mcs .szClass = szGrpClass ;
113- mcs .szTitle = L"" ;
104+ mcs .szTitle = gw . grp . szName ;
114105 mcs .hOwner = hAppInstance ;
115- mcs .x = mcs .y = mcs .cx = mcs .cy = CW_USEDEFAULT ;
106+ if ((gw .grp .rcGroup .left == CW_USEDEFAULT ) & (gw .grp .rcGroup .right == CW_USEDEFAULT ))
107+ {
108+ mcs .x = mcs .y = mcs .cx = mcs .cy = CW_USEDEFAULT ;
109+ }
110+ else
111+ {
112+ mcs .x = gw .grp .rcGroup .left ;
113+ mcs .y = gw .grp .rcGroup .top ;
114+ mcs .cx = gw .grp .rcGroup .right - gw .grp .rcGroup .left ;
115+ mcs .cy = gw .grp .rcGroup .bottom - gw .grp .rcGroup .top ;
116+ }
116117 mcs .style = WS_VISIBLE ;
117118 mcs .lParam = (LPARAM )pgGroup ;
118119
119- if (!(hGroup = (HWND )SendMessage (hWndMDIClient , WM_MDICREATE , 0 , (LPARAM )(LPTSTR )& mcs )))
120+ if (!(gw . hWndGroup = (HWND )SendMessage (hWndMDIClient , WM_MDICREATE , 0 , (LPARAM )(LPTSTR )& mcs )))
120121 return NULL ;
121122
122- return NULL ;
123+ // Load the group icon
124+ ExtractIconEx (gw .grp .szIconPath , gw .grp .iIconIndex , & hIconBig , & hIconSmall , 0 );
125+ SendMessage (gw .hWndGroup , WM_SETICON , ICON_SMALL , (LPARAM )hIconSmall );
126+ SendMessage (gw .hWndGroup , WM_SETICON , ICON_BIG , (LPARAM )hIconBig );
127+
128+ // TODO: make sure the groups delete their icons upon destruction!
129+
130+ return & gw ;
131+ }
132+
133+ /* * * *\
134+ SetGroupFlags -
135+ Retrieve the flags of a group window.
136+ RETURNS -
137+ TRUE if the flag mask is applied
138+ FALSE if the flags aren't set
139+ \* * * */
140+ BOOL SetGroupFlags (PGROUPWND pgw , DWORD dwFlags )
141+ {
142+ return FALSE;
123143}
124144
125145/* * * *\
126146 GetGroupFlags -
127147 Retrieve the flags of a group window.
128148 RETURNS -
129- DWORD containing the flags of the group.
130- Otherwise 0xFFFFFFFF if failure.
149+ TRUE if the flag mask is applied
150+ FALSE if the flags aren't set
131151\* * * */
132- DWORD GetGroupFlags (PGROUPWND pgw )
152+ BOOL GetGroupFlags (PGROUPWND pgw , DWORD dwFlags )
133153{
134154 HWND hWndGrp ;
135155
@@ -184,7 +204,7 @@ GROUP SaveGroup(PGROUPWND pgw)
184204 WCHAR szGroupName [MAX_TITLE_LENGTH ];
185205
186206 // Find the group and copy it
187- grp = * pgw -> pGroup ;
207+ grp = pgw -> grp ;
188208
189209 // Get the window handle as well
190210 hWndGrp = pgw -> hWndGroup ;
@@ -196,7 +216,7 @@ GROUP SaveGroup(PGROUPWND pgw)
196216 GetWindowText (hWndGrp , szGroupName , MAX_TITLE_LENGTH );
197217 StringCchCopy (grp .szName , MAX_TITLE_LENGTH , szGroupName );
198218
199- grp .dwFlags = GetGroupFlags (pgw );
219+ grp .dwFlags = GRP_FLAG_MAXIMIZED ; // GetGroupFlags(pgw);
200220
201221 GetSystemTimeAsFileTime (& grp .ftLastWrite );
202222
0 commit comments