00001
00002
00003
00004
00005
00006
00007 #include "math.h"
00008 #include "stdinc.h"
00009 #include "icon.h"
00010 #include "eventhandler.h"
00011 #include "widgets.h"
00012 #include "menu.h"
00013 #include "widget.h"
00014 #include "dockwindow.h"
00015 #include "window.h"
00016 #include "exception.h"
00017 namespace MWidgets
00018 {
00019
00020
00021 Window::Window():Widget()
00022 {
00023 m_iLeftWidth=0;
00024 m_iTopHeight=0;
00025 m_iRightWidth=0;
00026 m_iBottomHeight=0;
00027 m_mapDockOrder[LEFT_DOCK].offsetone=-1;
00028 m_mapDockOrder[LEFT_DOCK].offsettwo=-1;
00029 m_mapDockOrder[TOP_DOCK].offsetone=-1;
00030 m_mapDockOrder[TOP_DOCK].offsettwo=-1;
00031 m_mapDockOrder[RIGHT_DOCK].offsetone=-1;
00032 m_mapDockOrder[RIGHT_DOCK].offsettwo=-1;
00033 m_mapDockOrder[BOTTOM_DOCK].offsetone=-1;
00034 m_mapDockOrder[BOTTOM_DOCK].offsettwo=-1;
00035 };
00036
00037 Window::~Window()
00038 {
00039 if(m_pOnSizeHandler!=NULL)
00040 delete m_pOnSizeHandler;
00041 };
00042
00043 void Window::Create(int x,int y,int w,int h,string caption)
00044 {
00045 Widget::Create(x,y,w,h,caption,"MicroWidget",WS_SYSMENU|WS_SIZEBOX|WS_MAXIMIZEBOX|WS_MINIMIZEBOX|WS_CAPTION |WS_CLIPCHILDREN|WS_CLIPSIBLINGS ,NULL);
00046 };
00047
00048 LRESULT Window::OnMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
00049 {
00050 RECT rc;
00051 MINMAXINFO *pMinmax;
00052 switch(message)
00053 {
00054 case WM_CANCELMODE:
00055 ActivateDockWindows(false);
00056 break;
00057 case WM_ENABLE:
00058 if(wParam==TRUE)
00059 ActivateDockWindows(true);
00060 else
00061 ActivateDockWindows(false);
00062 break;
00063 case WM_GETMINMAXINFO:
00064 pMinmax=(MINMAXINFO*)lParam;
00065 pMinmax->ptMinTrackSize.x=m_iLeftWidth+m_iRightWidth+70;
00066 pMinmax->ptMinTrackSize.y=m_iTopHeight+m_iBottomHeight+70;
00067 return 0;
00068 case WM_SIZE:
00069 rc=UpdateLayout();
00070 OnSize(rc.left,rc.top,rc.right,rc.bottom);
00071 return 0;
00072 case WM_MOVE:
00073 UpdateLayout();
00074 break;
00075 }
00076 return Widget::OnMessage(hWnd, message, wParam, lParam);
00077 };
00078
00079 WIDGET_TYPE Window::GetType()
00080 {
00081 return WINDOW;
00082 };
00083
00084 void Window::DockToLeft(DockWindow* pWnd)
00085 {
00086 RECT rc;
00087 RECT rc2;
00088 float l=1.0f;
00089 m_vecLeft.insert(m_vecLeft.begin(),pWnd);
00090 GetWindowRect(pWnd->GetHwnd(),&rc);
00091 GetClientRect(m_hWnd,&rc2);
00092 if(m_iLeftWidth==0)
00093 {
00094 m_iLeftWidth=rc.right-rc.left;
00095 }
00096 l=(float)(rc.bottom-rc.top)/(float)(rc2.bottom-rc2.top-m_iTopHeight-m_iBottomHeight);
00097 pWnd->SetLayout(l);
00098 for(int i=1;i<(int)m_vecLeft.size();i++)
00099 m_vecLeft[i]->SetLayout(m_vecLeft[1]->GetLayout()-l/m_vecLeft.size());
00100
00101 if(m_iTopHeight==0)
00102 m_mapDockOrder[LEFT_DOCK].offsetone=0;
00103 else if(m_iTopHeight!=0&&m_mapDockOrder[LEFT_DOCK].offsetone==-1)
00104 m_mapDockOrder[LEFT_DOCK].offsetone=1;
00105 if(m_iBottomHeight==0)
00106 m_mapDockOrder[LEFT_DOCK].offsettwo=0;
00107 else if(m_iBottomHeight!=0&&m_mapDockOrder[LEFT_DOCK].offsettwo==-1)
00108 m_mapDockOrder[LEFT_DOCK].offsettwo=1;
00109 };
00110
00111 void Window::DockToTop(DockWindow* pWnd)
00112 {
00113 RECT rc;
00114 RECT rc2;
00115 float l=1.0f;
00116 m_vecTop.insert(m_vecTop.begin(),pWnd);
00117 GetWindowRect(pWnd->GetHwnd(),&rc);
00118 GetClientRect(m_hWnd,&rc2);
00119 if(m_iTopHeight==0)
00120 {
00121 m_iTopHeight=rc.bottom-rc.top;
00122 }
00123 l=(float)(rc.right-rc.left)/(float)(rc2.right-rc2.left-m_iLeftWidth-m_iRightWidth);
00124 pWnd->SetLayout(l);
00125 for(int i=1;i<(int)m_vecTop.size();i++)
00126 m_vecTop[i]->SetLayout(m_vecTop[1]->GetLayout()-l/m_vecTop.size());
00127
00128 if(m_iLeftWidth==0)
00129 m_mapDockOrder[TOP_DOCK].offsetone=0;
00130 else if(m_iLeftWidth!=0&&m_mapDockOrder[TOP_DOCK].offsetone==-1)
00131 m_mapDockOrder[TOP_DOCK].offsetone=1;
00132 if(m_iRightWidth==0)
00133 m_mapDockOrder[TOP_DOCK].offsettwo=0;
00134 else if(m_iRightWidth!=0&&m_mapDockOrder[TOP_DOCK].offsettwo==-1)
00135 m_mapDockOrder[TOP_DOCK].offsettwo=1;
00136
00137 };
00138
00139 void Window::DockToRight(DockWindow* pWnd)
00140 {
00141 RECT rc;
00142 RECT rc2;
00143 float l=1.0f;
00144 m_vecRight.insert(m_vecRight.begin(),pWnd);
00145 GetWindowRect(pWnd->GetHwnd(),&rc);
00146 GetClientRect(m_hWnd,&rc2);
00147 if(m_iRightWidth==0)
00148 {
00149 m_iRightWidth=rc.right-rc.left;
00150 }
00151 l=(float)(rc.bottom-rc.top)/(float)(rc2.bottom-rc2.top-m_iTopHeight-m_iBottomHeight);
00152 pWnd->SetLayout(l);
00153 for(int i=1;i<(int)m_vecRight.size();i++)
00154 m_vecRight[i]->SetLayout(m_vecRight[1]->GetLayout()-l/m_vecRight.size());
00155
00156 if(m_iTopHeight==0)
00157 m_mapDockOrder[RIGHT_DOCK].offsetone=0;
00158 else if(m_iTopHeight!=0&&m_mapDockOrder[RIGHT_DOCK].offsetone==-1)
00159 m_mapDockOrder[RIGHT_DOCK].offsetone=1;
00160 if(m_iBottomHeight==0)
00161 m_mapDockOrder[RIGHT_DOCK].offsettwo=0;
00162 else if(m_iBottomHeight!=0&&m_mapDockOrder[RIGHT_DOCK].offsettwo==-1)
00163 m_mapDockOrder[RIGHT_DOCK].offsettwo=1;
00164 };
00165
00166 void Window::DockToBottom(DockWindow* pWnd)
00167 {
00168 RECT rc;
00169 RECT rc2;
00170 float l=1.0f;
00171 m_vecBottom.insert(m_vecBottom.begin(),pWnd);
00172 GetWindowRect(pWnd->GetHwnd(),&rc);
00173 GetClientRect(m_hWnd,&rc2);
00174 if(m_iBottomHeight==0)
00175 {
00176 m_iBottomHeight=rc.bottom-rc.top;
00177 }
00178 l=(float)(rc.right-rc.left)/(float)(rc2.right-rc2.left-m_iLeftWidth-m_iRightWidth);
00179 pWnd->SetLayout(l);
00180 for(int i=1;i<(int)m_vecBottom.size();i++)
00181 m_vecBottom[i]->SetLayout(m_vecBottom[1]->GetLayout()-l/m_vecBottom.size());
00182
00183 if(m_iLeftWidth==0)
00184 m_mapDockOrder[BOTTOM_DOCK].offsetone=0;
00185 else if(m_iLeftWidth!=0&&m_mapDockOrder[BOTTOM_DOCK].offsetone==-1)
00186 m_mapDockOrder[BOTTOM_DOCK].offsetone=1;
00187 if(m_iRightWidth==0)
00188 m_mapDockOrder[BOTTOM_DOCK].offsettwo=0;
00189 else if(m_iRightWidth!=0&&m_mapDockOrder[BOTTOM_DOCK].offsettwo==-1)
00190 m_mapDockOrder[BOTTOM_DOCK].offsettwo=1;
00191 };
00192
00193 void Window::UndockFromLeft(DockWindow* pWnd)
00194 {
00195 std::vector<DockWindow*>::iterator i;
00196 i=std::find(m_vecLeft.begin(),m_vecLeft.end(),pWnd);
00197 if(i!=m_vecLeft.end())
00198 {
00199 m_vecLeft.erase(i);
00200 if(m_vecLeft.size()==0)
00201 {
00202 m_iLeftWidth=0;
00203 m_mapDockOrder[LEFT_DOCK].offsetone=-1;
00204 m_mapDockOrder[LEFT_DOCK].offsettwo=-1;
00205 if(m_mapDockOrder[TOP_DOCK].offsetone>0)
00206 m_mapDockOrder[TOP_DOCK].offsetone=0;
00207 if(m_mapDockOrder[BOTTOM_DOCK].offsetone>0)
00208 m_mapDockOrder[BOTTOM_DOCK].offsetone=0;
00209 }
00210 }
00211 else
00212 EXCEPT("Window::UndockFromLeft - wrong pointer!");
00213 };
00214
00215 void Window::UndockFromTop(DockWindow* pWnd)
00216 {
00217 std::vector<DockWindow*>::iterator i;
00218 i=std::find(m_vecTop.begin(),m_vecTop.end(),pWnd);
00219 if(i!=m_vecTop.end())
00220 {
00221 m_vecTop.erase(i);
00222 if(m_vecTop.size()==0)
00223 {
00224 m_iTopHeight=0;
00225 m_mapDockOrder[TOP_DOCK].offsetone=-1;
00226 m_mapDockOrder[TOP_DOCK].offsettwo=-1;
00227 if(m_mapDockOrder[LEFT_DOCK].offsetone>0)
00228 m_mapDockOrder[LEFT_DOCK].offsetone=0;
00229 if(m_mapDockOrder[RIGHT_DOCK].offsetone>0)
00230 m_mapDockOrder[RIGHT_DOCK].offsetone=0;
00231 }
00232 }
00233 else
00234 EXCEPT("Window::UndockFromTop - wrong pointer!");
00235 };
00236
00237 void Window::UndockFromRight(DockWindow* pWnd)
00238 {
00239 std::vector<DockWindow*>::iterator i;
00240 i=std::find(m_vecRight.begin(),m_vecRight.end(),pWnd);
00241 if(i!=m_vecRight.end())
00242 {
00243 m_vecRight.erase(i);
00244 if(m_vecRight.size()==0)
00245 {
00246 m_iRightWidth=0;
00247 m_mapDockOrder[RIGHT_DOCK].offsetone=-1;
00248 m_mapDockOrder[RIGHT_DOCK].offsettwo=-1;
00249 if(m_mapDockOrder[TOP_DOCK].offsettwo>0)
00250 m_mapDockOrder[TOP_DOCK].offsettwo=0;
00251 if(m_mapDockOrder[BOTTOM_DOCK].offsettwo>0)
00252 m_mapDockOrder[BOTTOM_DOCK].offsettwo=0;
00253 }
00254 }
00255 else
00256 EXCEPT("Window::UndockFromRight - wrong pointer!");
00257 };
00258
00259 void Window::UndockFromBottom(DockWindow* pWnd)
00260 {
00261 std::vector<DockWindow*>::iterator i;
00262 i=std::find(m_vecBottom.begin(),m_vecBottom.end(),pWnd);
00263 if(i!=m_vecBottom.end())
00264 {
00265 m_vecBottom.erase(i);
00266 if(m_vecBottom.size()==0)
00267 {
00268 m_iBottomHeight=0;
00269 m_mapDockOrder[BOTTOM_DOCK].offsetone=-1;
00270 m_mapDockOrder[BOTTOM_DOCK].offsettwo=-1;
00271 if(m_mapDockOrder[LEFT_DOCK].offsettwo>0)
00272 m_mapDockOrder[LEFT_DOCK].offsettwo=0;
00273 if(m_mapDockOrder[RIGHT_DOCK].offsettwo>0)
00274 m_mapDockOrder[RIGHT_DOCK].offsettwo=0;
00275 }
00276 }
00277 else
00278 EXCEPT("Window::UndockFromBottom - wrong pointer!");
00279 };
00280
00281 int Window::GetLeftWidth()
00282 {
00283 return m_iLeftWidth;
00284 };
00285
00286 int Window::GetLeftHeight()
00287 {
00288 int height=0;
00289 RECT rc;
00290 if(m_vecLeft.size()>0)
00291 {
00292 GetClientRect(m_hWnd,&rc);
00293 height=(rc.bottom-rc.top)/((int)m_vecLeft.size()+1);
00294 }
00295 return height;
00296 };
00297
00298 int Window::GetTopHeight()
00299 {
00300 return m_iTopHeight;
00301 };
00302
00303 int Window::GetTopWidth()
00304 {
00305 int width=0;
00306 RECT rc;
00307 if(m_vecTop.size()>0)
00308 {
00309 GetClientRect(m_hWnd,&rc);
00310 width=(rc.right-rc.left)/((int)m_vecTop.size()+1);
00311 }
00312 return width;
00313 };
00314
00315 int Window::GetRightWidth()
00316 {
00317 return m_iRightWidth;
00318 };
00319
00320 int Window::GetRightHeight()
00321 {
00322 int height=0;
00323 RECT rc;
00324 if(m_vecRight.size()>0)
00325 {
00326 GetClientRect(m_hWnd,&rc);
00327 height=(rc.bottom-rc.top)/((int)m_vecRight.size()+1);
00328 }
00329 return height;
00330 };
00331
00332 int Window::GetBottomHeight()
00333 {
00334 return m_iBottomHeight;
00335 };
00336
00337 int Window::GetBottomWidth()
00338 {
00339 int width=0;
00340 RECT rc;
00341 if(m_vecBottom.size()>0)
00342 {
00343 GetClientRect(m_hWnd,&rc);
00344 width=(rc.right-rc.left)/((int)m_vecBottom.size()+1);
00345 }
00346 return width;
00347 };
00348
00349 RECT Window::UpdateLayout(DockWindow *pWnd)
00350 {
00351 RECT rc;
00352 POINT pt;
00353 GetClientRect(m_hWnd,&rc);
00354 int width=rc.right-rc.left;
00355 int height=rc.bottom-rc.top;
00356 HWND tempHwnd=FindWindowEx(m_hWnd,NULL,STATUSCLASSNAME,NULL);
00357 if(tempHwnd)
00358 {
00359 GetWindowRect(tempHwnd,&rc);
00360 height-=rc.bottom-rc.top;
00361 }
00362
00363
00364 if(pWnd!=NULL)
00365 {
00366 GetWindowRect(pWnd->GetHwnd(),&rc);
00367 switch(pWnd->GetDockPos())
00368 {
00369 case LEFT_DOCK:
00370 m_iLeftWidth=rc.right-rc.left;
00371 break;
00372 case TOP_DOCK:
00373 m_iTopHeight=rc.bottom-rc.top;
00374 break;
00375 case RIGHT_DOCK:
00376 m_iRightWidth=rc.right-rc.left;
00377 break;
00378 case BOTTOM_DOCK:
00379 m_iBottomHeight=rc.bottom-rc.top;
00380 break;
00381 case NONE_DOCK:
00382 break;
00383 };
00384 }
00385
00386
00387 if(m_iLeftWidth>=(width-m_iRightWidth))
00388 {
00389 if(width-m_iRightWidth>=50)
00390 m_iLeftWidth=width-m_iRightWidth;
00391 else if(width-m_iLeftWidth>=50)
00392 m_iRightWidth=width-m_iLeftWidth;
00393 }
00394 if(m_iRightWidth>=(width-m_iLeftWidth))
00395 {
00396 if(width-m_iLeftWidth>=50)
00397 m_iRightWidth=width-m_iLeftWidth;
00398 else if(width-m_iRightWidth>=50)
00399 m_iLeftWidth=width-m_iRightWidth;
00400 }
00401
00402 if(m_iTopHeight>=(height-m_iBottomHeight))
00403 {
00404 if(height-m_iBottomHeight>=50)
00405 m_iTopHeight=height-m_iBottomHeight;
00406 else if(height-m_iTopHeight>=50)
00407 m_iBottomHeight=height-m_iTopHeight;
00408 }
00409 if(m_iBottomHeight>=(height-m_iTopHeight))
00410 {
00411 if(height-m_iTopHeight>=50)
00412 m_iBottomHeight=height-m_iTopHeight;
00413 else if(height-m_iBottomHeight>=50)
00414 m_iTopHeight=height-m_iBottomHeight;
00415 }
00416
00417
00418 int len=0;
00419 int xpos=0;
00420 int ypos=0;
00421
00422
00423 len=0;
00424 xpos=0;
00425 if(m_mapDockOrder[LEFT_DOCK].offsetone==1)
00426 ypos=m_iTopHeight;
00427 else
00428 ypos=0;
00429 for(int i=0;i<(int)m_vecLeft.size();i++)
00430 {
00431 if(m_vecLeft[i]==pWnd)
00432 {
00433 GetWindowRect(pWnd->GetHwnd(),&rc);
00434 float l=(float)(rc.bottom-rc.top)/(float)(height-m_iTopHeight-m_iBottomHeight);
00435 if((i+1)<(int)m_vecLeft.size())
00436 m_vecLeft[i+1]->SetLayout((m_vecLeft[i+1]->GetLayout()+m_vecLeft[i]->GetLayout())-l);
00437 m_vecLeft[i]->SetLayout(l);
00438 };
00439 len=(int)(m_vecLeft[i]->GetLayout()*(height-m_iTopHeight-m_iBottomHeight));
00440 pt.x=xpos;
00441 pt.y=ypos;
00442 ClientToScreen(m_hWnd,&pt);
00443
00444 DWORD flags=SWP_NOZORDER;
00445 if(i!=(int)m_vecLeft.size()-1)
00446 SetWindowPos(m_vecLeft[i]->GetHwnd(),HWND_TOP,pt.x,pt.y,m_iLeftWidth,len,flags);
00447 else
00448 {
00449 int sub1=0;
00450 int sub2=0;
00451 if(m_mapDockOrder[LEFT_DOCK].offsetone==1)
00452 sub1=m_iTopHeight;
00453 if(m_mapDockOrder[LEFT_DOCK].offsettwo==1)
00454 sub2=m_iBottomHeight;
00455 SetWindowPos(m_vecLeft[i]->GetHwnd(),HWND_TOP,pt.x,pt.y,m_iLeftWidth,height-sub1-sub2-(ypos-sub1),flags);
00456 }
00457 ypos+=len;
00458 };
00459
00460
00461 len=0;
00462 if(m_mapDockOrder[TOP_DOCK].offsetone==1)
00463 xpos=m_iLeftWidth;
00464 else
00465 xpos=0;
00466 ypos=0;
00467 for(int i=0;i<(int)m_vecTop.size();i++)
00468 {
00469 if(m_vecTop[i]==pWnd)
00470 {
00471 GetWindowRect(pWnd->GetHwnd(),&rc);
00472 float l=(float)(rc.right-rc.left)/(float)(width-m_iLeftWidth-m_iRightWidth);
00473 if((i+1)<(int)m_vecTop.size())
00474 m_vecTop[i+1]->SetLayout((m_vecTop[i+1]->GetLayout()+m_vecTop[i]->GetLayout())-l);
00475 m_vecTop[i]->SetLayout(l);
00476 };
00477 len=(int)(m_vecTop[i]->GetLayout()*(width-m_iLeftWidth-m_iRightWidth));
00478 pt.x=xpos;
00479 pt.y=ypos;
00480 ClientToScreen(m_hWnd,&pt);
00481
00482 DWORD flags=SWP_NOZORDER;
00483 if(i!=(int)m_vecTop.size()-1)
00484 SetWindowPos(m_vecTop[i]->GetHwnd(),HWND_TOP,pt.x,pt.y,len,m_iTopHeight,flags);
00485 else
00486 {
00487 int sub1=0;
00488 int sub2=0;
00489 if(m_mapDockOrder[TOP_DOCK].offsetone==1)
00490 sub1=m_iLeftWidth;
00491 if(m_mapDockOrder[TOP_DOCK].offsettwo==1)
00492 sub2=m_iRightWidth;
00493 SetWindowPos(m_vecTop[i]->GetHwnd(),HWND_TOP,pt.x,pt.y,width-sub1-sub2-(xpos-sub1),m_iTopHeight,flags);
00494 }
00495 xpos+=len;
00496 };
00497
00498
00499 len=0;
00500 xpos=width-m_iRightWidth;
00501 if(m_mapDockOrder[RIGHT_DOCK].offsetone==1)
00502 ypos=m_iTopHeight;
00503 else
00504 ypos=0;
00505 for(int i=0;i<(int)m_vecRight.size();i++)
00506 {
00507 if(m_vecRight[i]==pWnd)
00508 {
00509 GetWindowRect(pWnd->GetHwnd(),&rc);
00510 float l=(float)(rc.bottom-rc.top)/(float)(height-m_iTopHeight-m_iBottomHeight);
00511 if((i+1)<(int)m_vecRight.size())
00512 m_vecRight[i+1]->SetLayout((m_vecRight[i+1]->GetLayout()+m_vecRight[i]->GetLayout())-l);
00513 m_vecRight[i]->SetLayout(l);
00514 };
00515 len=(int)(m_vecRight[i]->GetLayout()*(height-m_iTopHeight-m_iBottomHeight));
00516 pt.x=xpos;
00517 pt.y=ypos;
00518 ClientToScreen(m_hWnd,&pt);
00519
00520 DWORD flags=SWP_NOZORDER;
00521 if(i!=(int)m_vecRight.size()-1)
00522 SetWindowPos(m_vecRight[i]->GetHwnd(),HWND_TOP,pt.x,pt.y,m_iRightWidth,len,flags);
00523 else
00524 {
00525 int sub1=0;
00526 int sub2=0;
00527 if(m_mapDockOrder[RIGHT_DOCK].offsetone==1)
00528 sub1=m_iTopHeight;
00529 if(m_mapDockOrder[RIGHT_DOCK].offsettwo==1)
00530 sub2=m_iBottomHeight;
00531 SetWindowPos(m_vecRight[i]->GetHwnd(),HWND_TOP,pt.x,pt.y,m_iRightWidth,height-sub1-sub2-(ypos-sub1),flags);
00532 }
00533 ypos+=len;
00534 };
00535
00536
00537 len=0;
00538 if(m_mapDockOrder[BOTTOM_DOCK].offsetone==1)
00539 xpos=m_iLeftWidth;
00540 else
00541 xpos=0;
00542 ypos=height-m_iBottomHeight;
00543 for(int i=0;i<(int)m_vecBottom.size();i++)
00544 {
00545 if(m_vecBottom[i]==pWnd)
00546 {
00547 GetWindowRect(pWnd->GetHwnd(),&rc);
00548 float l=(float)(rc.right-rc.left)/(float)(width-m_iLeftWidth-m_iRightWidth);
00549 if((i+1)<(int)m_vecBottom.size())
00550 m_vecBottom[i+1]->SetLayout((m_vecBottom[i+1]->GetLayout()+m_vecBottom[i]->GetLayout())-l);
00551 m_vecBottom[i]->SetLayout(l);
00552 };
00553 len=(int)(m_vecBottom[i]->GetLayout()*(width-m_iLeftWidth-m_iRightWidth));
00554 pt.x=xpos;
00555 pt.y=ypos;
00556 ClientToScreen(m_hWnd,&pt);
00557
00558 DWORD flags=SWP_NOZORDER;
00559 if(i!=(int)m_vecBottom.size()-1)
00560 SetWindowPos(m_vecBottom[i]->GetHwnd(),HWND_TOP,pt.x,pt.y,len,m_iBottomHeight,flags);
00561 else
00562 {
00563 int sub1=0;
00564 int sub2=0;
00565 if(m_mapDockOrder[BOTTOM_DOCK].offsetone==1)
00566 sub1=m_iLeftWidth;
00567 if(m_mapDockOrder[BOTTOM_DOCK].offsettwo==1)
00568 sub2=m_iRightWidth;
00569 SetWindowPos(m_vecBottom[i]->GetHwnd(),HWND_TOP,pt.x,pt.y,width-sub1-sub2-(xpos-sub1),m_iBottomHeight,flags);
00570 }
00571 xpos+=len;
00572 };
00573
00574 rc.left=m_iLeftWidth;
00575 rc.top=m_iTopHeight;
00576 rc.right=rc.left+(width-m_iLeftWidth-m_iRightWidth);
00577 rc.bottom=rc.top+(height-m_iTopHeight-m_iBottomHeight);
00578 return rc;
00579 };
00580
00581 bool Window::IsFirst(DockWindow *pWnd)
00582 {
00583 switch(pWnd->GetDockPos())
00584 {
00585 case LEFT_DOCK:
00586 if((*m_vecLeft.begin())==pWnd)
00587 return true;
00588 break;
00589 case TOP_DOCK:
00590 if((*m_vecTop.begin())==pWnd)
00591 return true;
00592 break;
00593 case RIGHT_DOCK:
00594 if((*m_vecRight.begin())==pWnd)
00595 return true;
00596 break;
00597 case BOTTOM_DOCK:
00598 if((*m_vecBottom.begin())==pWnd)
00599 return true;
00600 break;
00601 case NONE_DOCK:
00602 break;
00603 };
00604 return false;
00605 };
00606
00607 bool Window::IsLast(DockWindow *pWnd)
00608 {
00609 switch(pWnd->GetDockPos())
00610 {
00611 case LEFT_DOCK:
00612 if((*(m_vecLeft.end()-1))==pWnd)
00613 return true;
00614 break;
00615 case TOP_DOCK:
00616 if((*(m_vecTop.end()-1))==pWnd)
00617 return true;
00618 break;
00619 case RIGHT_DOCK:
00620 if((*(m_vecRight.end()-1))==pWnd)
00621 return true;
00622 break;
00623 case BOTTOM_DOCK:
00624 if((*(m_vecBottom.end()-1))==pWnd)
00625 return true;
00626 break;
00627 case NONE_DOCK:
00628 break;
00629 };
00630 return false;
00631 };
00632
00633 void Window::ActivateDockWindows(bool bActivate)
00634 {
00635 std::vector<DockWindow*>::iterator i;
00636 for(i=m_vecLeft.begin();i!=m_vecLeft.end();i++)
00637 {
00638 if(bActivate)
00639 EnableWindow((*i)->GetHwnd(),TRUE);
00640 else
00641 EnableWindow((*i)->GetHwnd(),FALSE);
00642 }
00643 for(i=m_vecTop.begin();i!=m_vecTop.end();i++)
00644 {
00645 if(bActivate)
00646 EnableWindow((*i)->GetHwnd(),TRUE);
00647 else
00648 EnableWindow((*i)->GetHwnd(),FALSE);
00649 }
00650 for(i=m_vecRight.begin();i!=m_vecRight.end();i++)
00651 {
00652 if(bActivate)
00653 EnableWindow((*i)->GetHwnd(),TRUE);
00654 else
00655 EnableWindow((*i)->GetHwnd(),FALSE);
00656 }
00657 for(i=m_vecBottom.begin();i!=m_vecBottom.end();i++)
00658 {
00659 if(bActivate)
00660 EnableWindow((*i)->GetHwnd(),TRUE);
00661 else
00662 EnableWindow((*i)->GetHwnd(),FALSE);
00663 }
00664 };
00665
00666 };