#include <dockart.h>
Inheritance diagram for wxAuiDefaultDockArt:
Public Member Functions | |
wxAuiDefaultDockArt () | |
int | GetMetric (int metric_id) |
void | SetMetric (int metric_id, int new_val) |
wxColour | GetColour (int id) |
void | SetColour (int id, const wxColor &colour) |
void | SetFont (int id, const wxFont &font) |
wxFont | GetFont (int id) |
void | DrawSash (wxDC &dc, int orientation, const wxRect &rect) |
void | DrawBackground (wxDC &dc, int orientation, const wxRect &rect) |
void | DrawCaption (wxDC &dc, const wxString &text, const wxRect &rect, wxAuiPaneInfo &pane) |
void | DrawGripper (wxDC &dc, const wxRect &rect, wxAuiPaneInfo &pane) |
void | DrawBorder (wxDC &dc, const wxRect &rect, wxAuiPaneInfo &pane) |
void | DrawPaneButton (wxDC &dc, int button, int button_state, const wxRect &rect, wxAuiPaneInfo &pane) |
Protected Member Functions | |
void | DrawCaptionBackground (wxDC &dc, const wxRect &rect, bool active) |
Protected Attributes | |
wxPen | m_border_pen |
wxBrush | m_sash_brush |
wxBrush | m_background_brush |
wxBrush | m_gripper_brush |
wxFont | m_caption_font |
wxBitmap | m_inactive_close_bitmap |
wxBitmap | m_inactive_pin_bitmap |
wxBitmap | m_active_close_bitmap |
wxBitmap | m_active_pin_bitmap |
wxPen | m_gripper_pen1 |
wxPen | m_gripper_pen2 |
wxPen | m_gripper_pen3 |
wxColour | m_active_caption_colour |
wxColour | m_active_caption_gradient_colour |
wxColour | m_active_caption_text_colour |
wxColour | m_inactive_caption_colour |
wxColour | m_inactive_caption_gradient_colour |
wxColour | m_inactive_caption_text_colour |
int | m_border_size |
int | m_caption_size |
int | m_sash_size |
int | m_button_size |
int | m_gripper_size |
int | m_gradient_type |
Definition at line 82 of file dockart.h.
|
Definition at line 113 of file dockart.cpp. 00114 { 00115 #ifdef __WXMAC__ 00116 wxBrush toolbarbrush; 00117 toolbarbrush.MacSetTheme( kThemeBrushToolbarBackground ); 00118 wxColor base_color = toolbarbrush.GetColour(); 00119 #else 00120 wxColor base_color = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); 00121 #endif 00122 00123 wxColor darker1_color = wxAuiStepColour(base_color, 85); 00124 wxColor darker2_color = wxAuiStepColour(base_color, 70); 00125 wxColor darker3_color = wxAuiStepColour(base_color, 60); 00126 wxColor darker4_color = wxAuiStepColour(base_color, 50); 00127 wxColor darker5_color = wxAuiStepColour(base_color, 40); 00128 00129 m_active_caption_colour = wxAuiLightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); 00130 m_active_caption_gradient_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); 00131 m_active_caption_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); 00132 m_inactive_caption_colour = wxAuiStepColour(darker1_color, 80); 00133 m_inactive_caption_gradient_colour = darker1_color; 00134 m_inactive_caption_text_colour = *wxBLACK; 00135 00136 #ifdef __WXMAC__ 00137 m_sash_brush = toolbarbrush; 00138 m_background_brush = toolbarbrush; 00139 m_gripper_brush = toolbarbrush; 00140 #else 00141 m_sash_brush = wxBrush(base_color); 00142 m_background_brush = wxBrush(base_color); 00143 m_gripper_brush = wxBrush(base_color); 00144 #endif 00145 m_border_pen = wxPen(darker2_color); 00146 m_gripper_pen1 = wxPen(darker5_color); 00147 m_gripper_pen2 = wxPen(darker3_color); 00148 m_gripper_pen3 = *wxWHITE_PEN; 00149 00150 #ifdef __WXMAC__ 00151 m_caption_font = *wxSMALL_FONT; 00152 #else 00153 m_caption_font = wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE); 00154 #endif 00155 00156 // some built in bitmaps 00157 #ifdef __WXMAC__ 00158 static unsigned char close_bits[]={ 00159 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3, 00160 0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3, 00161 0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF }; 00162 #else 00163 static unsigned char close_bits[]={ 00164 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xfb,0xcf,0xf9, 00165 0x9f,0xfc,0x3f,0xfe,0x3f,0xfe,0x9f,0xfc,0xcf,0xf9,0xef,0xfb, 00166 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; 00167 #endif 00168 00169 static unsigned char pin_bits[]={ 00170 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc, 00171 0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff, 00172 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; 00173 00174 #ifdef __WXMAC__ 00175 m_inactive_close_bitmap = wxAuiBitmapFromBits(close_bits, 16, 16, *wxWHITE); 00176 #else 00177 m_inactive_close_bitmap = wxAuiBitmapFromBits(close_bits, 16, 16, m_inactive_caption_text_colour); 00178 #endif 00179 m_inactive_pin_bitmap = wxAuiBitmapFromBits(pin_bits, 16, 16, m_inactive_caption_text_colour); 00180 #ifdef __WXMAC__ 00181 m_active_close_bitmap = wxAuiBitmapFromBits(close_bits, 16, 16, *wxWHITE ); 00182 #else 00183 m_active_close_bitmap = wxAuiBitmapFromBits(close_bits, 16, 16, m_active_caption_text_colour); 00184 #endif 00185 m_active_pin_bitmap = wxAuiBitmapFromBits(pin_bits, 16, 16, m_active_caption_text_colour); 00186 00187 // default metric values 00188 #ifdef __WXMAC__ 00189 SInt32 height; 00190 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight , &height ); 00191 m_sash_size = height; 00192 #else 00193 m_sash_size = 4; 00194 #endif 00195 m_caption_size = 17; 00196 m_border_size = 1; 00197 m_button_size = 14; 00198 m_gripper_size = 9; 00199 m_gradient_type = wxAUI_GRADIENT_VERTICAL; 00200 }
|
|
Implements wxAuiDockArt. Definition at line 321 of file dockart.cpp. 00322 { 00323 dc.SetPen(*wxTRANSPARENT_PEN); 00324 #ifdef __WXMAC__ 00325 // we have to clear first, otherwise we are drawing a light striped pattern 00326 // over an already darker striped background 00327 dc.SetBrush(*wxWHITE_BRUSH) ; 00328 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); 00329 #endif 00330 dc.SetBrush(m_background_brush); 00331 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); 00332 }
|
|
Implements wxAuiDockArt. Definition at line 334 of file dockart.cpp. 00336 { 00337 dc.SetPen(m_border_pen); 00338 dc.SetBrush(*wxTRANSPARENT_BRUSH); 00339 00340 wxRect rect = _rect; 00341 int i, border_width = GetMetric(wxAUI_ART_PANE_BORDER_SIZE); 00342 00343 if (pane.IsToolbar()) 00344 { 00345 for (i = 0; i < border_width; ++i) 00346 { 00347 dc.SetPen(*wxWHITE_PEN); 00348 dc.DrawLine(rect.x, rect.y, rect.x+rect.width, rect.y); 00349 dc.DrawLine(rect.x, rect.y, rect.x, rect.y+rect.height); 00350 dc.SetPen(m_border_pen); 00351 dc.DrawLine(rect.x, rect.y+rect.height-1, 00352 rect.x+rect.width, rect.y+rect.height-1); 00353 dc.DrawLine(rect.x+rect.width-1, rect.y, 00354 rect.x+rect.width-1, rect.y+rect.height); 00355 rect.Deflate(1); 00356 } 00357 } 00358 else 00359 { 00360 for (i = 0; i < border_width; ++i) 00361 { 00362 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); 00363 rect.Deflate(1); 00364 } 00365 } 00366 }
|
|
Implements wxAuiDockArt. Definition at line 416 of file dockart.cpp. 00420 { 00421 dc.SetPen(*wxTRANSPARENT_PEN); 00422 dc.SetFont(m_caption_font); 00423 00424 DrawCaptionBackground(dc, rect, 00425 (pane.state & wxAuiPaneInfo::optionActive)?true:false); 00426 00427 if (pane.state & wxAuiPaneInfo::optionActive) 00428 dc.SetTextForeground(m_active_caption_text_colour); 00429 else 00430 dc.SetTextForeground(m_inactive_caption_text_colour); 00431 00432 00433 wxCoord w,h; 00434 dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h); 00435 00436 dc.SetClippingRegion(rect); 00437 dc.DrawText(text, rect.x+3, rect.y+(rect.height/2)-(h/2)-1); 00438 dc.DestroyClippingRegion(); 00439 }
|
|
Definition at line 369 of file dockart.cpp. 00370 { 00371 if (m_gradient_type == wxAUI_GRADIENT_NONE) 00372 { 00373 if (active) 00374 dc.SetBrush(wxBrush(m_active_caption_colour)); 00375 else 00376 dc.SetBrush(wxBrush(m_inactive_caption_colour)); 00377 00378 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); 00379 } 00380 else 00381 { 00382 if (active) 00383 { 00384 // on mac the gradients are expected to become darker from the top 00385 #ifdef __WXMAC__ 00386 DrawGradientRectangle(dc, rect, 00387 m_active_caption_gradient_colour, 00388 m_active_caption_colour, 00389 m_gradient_type); 00390 #else 00391 DrawGradientRectangle(dc, rect, 00392 m_active_caption_colour, 00393 m_active_caption_gradient_colour, 00394 m_gradient_type); 00395 #endif 00396 } 00397 else 00398 { 00399 // on mac the gradients are expected to become darker from the top 00400 #ifdef __WXMAC__ 00401 DrawGradientRectangle(dc, rect, 00402 m_inactive_caption_gradient_colour, 00403 m_inactive_caption_colour, 00404 m_gradient_type); 00405 #else 00406 DrawGradientRectangle(dc, rect, 00407 m_inactive_caption_colour, 00408 m_inactive_caption_gradient_colour, 00409 m_gradient_type); 00410 #endif 00411 } 00412 } 00413 }
|
|
Implements wxAuiDockArt. Definition at line 441 of file dockart.cpp. 00444 { 00445 dc.SetPen(*wxTRANSPARENT_PEN); 00446 dc.SetBrush(m_gripper_brush); 00447 00448 dc.DrawRectangle(rect.x, rect.y, rect.width,rect.height); 00449 00450 if (!pane.HasGripperTop()) 00451 { 00452 int y = 5; 00453 while (1) 00454 { 00455 dc.SetPen(m_gripper_pen1); 00456 dc.DrawPoint(rect.x+3, rect.y+y); 00457 dc.SetPen(m_gripper_pen2); 00458 dc.DrawPoint(rect.x+3, rect.y+y+1); 00459 dc.DrawPoint(rect.x+4, rect.y+y); 00460 dc.SetPen(m_gripper_pen3); 00461 dc.DrawPoint(rect.x+5, rect.y+y+1); 00462 dc.DrawPoint(rect.x+5, rect.y+y+2); 00463 dc.DrawPoint(rect.x+4, rect.y+y+2); 00464 00465 y += 4; 00466 if (y > rect.GetHeight()-5) 00467 break; 00468 } 00469 } 00470 else 00471 { 00472 int x = 5; 00473 while (1) 00474 { 00475 dc.SetPen(m_gripper_pen1); 00476 dc.DrawPoint(rect.x+x, rect.y+3); 00477 dc.SetPen(m_gripper_pen2); 00478 dc.DrawPoint(rect.x+x+1, rect.y+3); 00479 dc.DrawPoint(rect.x+x, rect.y+4); 00480 dc.SetPen(m_gripper_pen3); 00481 dc.DrawPoint(rect.x+x+1, rect.y+5); 00482 dc.DrawPoint(rect.x+x+2, rect.y+5); 00483 dc.DrawPoint(rect.x+x+2, rect.y+4); 00484 00485 x += 4; 00486 if (x > rect.GetWidth()-5) 00487 break; 00488 } 00489 } 00490 }
|
|
Implements wxAuiDockArt. Definition at line 492 of file dockart.cpp. 00497 { 00498 wxRect rect = _rect; 00499 00500 if (button_state == wxAUI_BUTTON_STATE_PRESSED) 00501 { 00502 rect.x++; 00503 rect.y++; 00504 } 00505 00506 if (button_state == wxAUI_BUTTON_STATE_HOVER || 00507 button_state == wxAUI_BUTTON_STATE_PRESSED) 00508 { 00509 if (pane.state & wxAuiPaneInfo::optionActive) 00510 { 00511 dc.SetBrush(wxBrush(wxAuiStepColour(m_active_caption_colour, 120))); 00512 dc.SetPen(wxPen(wxAuiStepColour(m_active_caption_colour, 70))); 00513 } 00514 else 00515 { 00516 dc.SetBrush(wxBrush(wxAuiStepColour(m_inactive_caption_colour, 120))); 00517 dc.SetPen(wxPen(wxAuiStepColour(m_inactive_caption_colour, 70))); 00518 } 00519 00520 // draw the background behind the button 00521 dc.DrawRectangle(rect.x, rect.y, 15, 15); 00522 } 00523 00524 wxBitmap bmp; 00525 switch (button) 00526 { 00527 default: 00528 case wxAuiPaneInfo::buttonClose: 00529 if (pane.state & wxAuiPaneInfo::optionActive) 00530 bmp = m_active_close_bitmap; 00531 else 00532 bmp = m_inactive_close_bitmap; 00533 break; 00534 case wxAuiPaneInfo::buttonPin: 00535 if (pane.state & wxAuiPaneInfo::optionActive) 00536 bmp = m_active_pin_bitmap; 00537 else 00538 bmp = m_inactive_pin_bitmap; 00539 break; 00540 } 00541 00542 // draw the button itself 00543 dc.DrawBitmap(bmp, rect.x, rect.y, true); 00544 }
|
|
Implements wxAuiDockArt. Definition at line 287 of file dockart.cpp. 00288 { 00289 #ifdef __WXMAC__ 00290 HIRect splitterRect = CGRectMake( rect.x , rect.y , rect.width , rect.height ); 00291 CGContextRef cgContext ; 00292 #if wxMAC_USE_CORE_GRAPHICS 00293 cgContext = ((wxMacCGContext*)(dc.GetGraphicContext()))->GetNativeContext() ; 00294 #else 00295 Rect bounds ; 00296 GetPortBounds( (CGrafPtr) dc.m_macPort , &bounds ) ; 00297 QDBeginCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ; 00298 CGContextTranslateCTM( cgContext , 0 , bounds.bottom - bounds.top ) ; 00299 CGContextScaleCTM( cgContext , 1 , -1 ) ; 00300 #endif 00301 00302 HIThemeSplitterDrawInfo drawInfo ; 00303 drawInfo.version = 0 ; 00304 drawInfo.state = kThemeStateActive ; 00305 drawInfo.adornment = kHIThemeSplitterAdornmentNone ; 00306 HIThemeDrawPaneSplitter( &splitterRect , &drawInfo , cgContext , kHIThemeOrientationNormal ) ; 00307 00308 #if wxMAC_USE_CORE_GRAPHICS 00309 #else 00310 QDEndCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ; 00311 #endif 00312 00313 #else 00314 dc.SetPen(*wxTRANSPARENT_PEN); 00315 dc.SetBrush(m_sash_brush); 00316 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); 00317 #endif 00318 }
|
|
|
Implements wxAuiDockArt. Definition at line 280 of file dockart.cpp. 00281 { 00282 if (id == wxAUI_ART_CAPTION_FONT) 00283 return m_caption_font; 00284 return wxNullFont; 00285 }
|
|
Implements wxAuiDockArt. Definition at line 202 of file dockart.cpp. 00203 { 00204 switch (id) 00205 { 00206 case wxAUI_ART_SASH_SIZE: return m_sash_size; 00207 case wxAUI_ART_CAPTION_SIZE: return m_caption_size; 00208 case wxAUI_ART_GRIPPER_SIZE: return m_gripper_size; 00209 case wxAUI_ART_PANE_BORDER_SIZE: return m_border_size; 00210 case wxAUI_ART_PANE_BUTTON_SIZE: return m_button_size; 00211 case wxAUI_ART_GRADIENT_TYPE: return m_gradient_type; 00212 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; 00213 } 00214 00215 return 0; 00216 }
|
|
|
Implements wxAuiDockArt. Definition at line 274 of file dockart.cpp. 00275 { 00276 if (id == wxAUI_ART_CAPTION_FONT) 00277 m_caption_font = font; 00278 }
|
|
Implements wxAuiDockArt. Definition at line 218 of file dockart.cpp. 00219 { 00220 switch (id) 00221 { 00222 case wxAUI_ART_SASH_SIZE: m_sash_size = new_val; break; 00223 case wxAUI_ART_CAPTION_SIZE: m_caption_size = new_val; break; 00224 case wxAUI_ART_GRIPPER_SIZE: m_gripper_size = new_val; break; 00225 case wxAUI_ART_PANE_BORDER_SIZE: m_border_size = new_val; break; 00226 case wxAUI_ART_PANE_BUTTON_SIZE: m_button_size = new_val; break; 00227 case wxAUI_ART_GRADIENT_TYPE: m_gradient_type = new_val; break; 00228 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; 00229 } 00230 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|