f3d4e9f181e792a7b2a5d9f8bedccbce0377f6ab
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms.Theming / Default / TabControlPainter.cs
1 // Permission is hereby granted, free of charge, to any person obtaining\r
2 // a copy of this software and associated documentation files (the\r
3 // "Software"), to deal in the Software without restriction, including\r
4 // without limitation the rights to use, copy, modify, merge, publish,\r
5 // distribute, sublicense, and/or sell copies of the Software, and to\r
6 // permit persons to whom the Software is furnished to do so, subject to\r
7 // the following conditions:\r
8 //\r
9 // The above copyright notice and this permission notice shall be\r
10 // included in all copies or substantial portions of the Software.\r
11 //\r
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
19 //\r
20 // Copyright (c) 2007 Novell, Inc.\r
21 //\r
22 // Authors:\r
23 //      Andreia Gaita (avidigal@novell.com)\r
24 \r
25 using System;\r
26 using System.Drawing;\r
27 using System.Drawing.Text;\r
28 using System.Windows.Forms;\r
29 using System.Windows.Forms.VisualStyles;\r
30 \r
31 namespace System.Windows.Forms.Theming.Default\r
32 {\r
33         /// <summary>\r
34         /// Summary description for TabControl.\r
35         /// </summary>\r
36         internal class TabControlPainter {\r
37                 protected SystemResPool ResPool { get { return ThemeEngine.Current.ResPool; } }\r
38 \r
39                 #region private\r
40 \r
41                 private Size    defaultItemSize;\r
42                 private Point   defaultPadding;\r
43                 private int             minimumTabWidth;\r
44                 private Rectangle selectedTabDelta;\r
45 \r
46                 private Point   tabPanelOffset;\r
47                 \r
48                 private int             selectedSpacing;\r
49 \r
50                 private Size    rowSpacingNormal;\r
51                 private Size    rowSpacingButtons;\r
52                 private Size    rowSpacingFlatButtons;\r
53                 private int             scrollerWidth;\r
54                 private Point   focusRectSpacing;\r
55                 private Rectangle tabPageSpacing;\r
56                 private int             colSpacing;\r
57                 private int             flatButtonSpacing;\r
58 \r
59                 private Point   imagePadding;\r
60 \r
61                 private StringFormat defaultFormatting;\r
62 \r
63                 private Rectangle borderThickness;\r
64 \r
65                 #endregion\r
66 \r
67                 #region Properties\r
68 \r
69                 public virtual Size DefaultItemSize {\r
70                         get { return defaultItemSize; }\r
71                         set { defaultItemSize = value; }\r
72                 }\r
73 \r
74                 public virtual Point DefaultPadding {\r
75                         get { return defaultPadding; }\r
76                         set { defaultPadding = value; }\r
77                 }\r
78 \r
79                 public virtual int MinimumTabWidth {\r
80                         get { return minimumTabWidth; }\r
81                         set { minimumTabWidth = value; }\r
82                 }\r
83 \r
84                 public virtual Rectangle SelectedTabDelta {\r
85                         get { return selectedTabDelta; }\r
86                         set { selectedTabDelta = value; }\r
87                 }\r
88 \r
89                 public virtual Point TabPanelOffset {\r
90                         get { return tabPanelOffset; }\r
91                         set { tabPanelOffset = value; }\r
92                 }\r
93 \r
94                 public virtual int SelectedSpacing {\r
95                         get { return selectedSpacing; }\r
96                         set { selectedSpacing = value; }\r
97                 }\r
98 \r
99                 public virtual Size RowSpacingNormal { \r
100                         get { return rowSpacingNormal; }\r
101                         set { rowSpacingNormal = value; }\r
102                 }\r
103 \r
104                 public virtual Size RowSpacingButtons { \r
105                         get { return rowSpacingButtons; }\r
106                         set { rowSpacingButtons = value; }\r
107                 }\r
108 \r
109                 public virtual Size RowSpacingFlatButtons { \r
110                         get { return rowSpacingFlatButtons; }\r
111                         set { rowSpacingFlatButtons = value; }\r
112                 }\r
113 \r
114                 public virtual Point FocusRectSpacing {\r
115                         get { return focusRectSpacing; }\r
116                         set { focusRectSpacing = value; }\r
117                 }\r
118 \r
119                 public virtual int ColSpacing { \r
120                         get { return colSpacing; }\r
121                         set { colSpacing = value; }\r
122                 }\r
123 \r
124                 public virtual int FlatButtonSpacing { \r
125                         get { return flatButtonSpacing; }\r
126                         set { flatButtonSpacing = value; }\r
127                 }\r
128 \r
129                 public virtual Rectangle TabPageSpacing {\r
130                         get { return tabPageSpacing; }\r
131                         set { tabPageSpacing = value; }\r
132                 }\r
133 \r
134                 public virtual Point ImagePadding {\r
135                         get { return imagePadding; }\r
136                         set { imagePadding = value; }\r
137                 }\r
138 \r
139                 public virtual StringFormat DefaultFormatting {\r
140                         get { return defaultFormatting; }\r
141                         set { defaultFormatting = value; }\r
142                 }\r
143 \r
144                 public virtual Rectangle BorderThickness {\r
145                         get { return borderThickness; }\r
146                         set { borderThickness = value; }\r
147                 }\r
148 \r
149                 public virtual int ScrollerWidth {\r
150                         get { return scrollerWidth; }\r
151                         set { scrollerWidth = value; }\r
152                 }\r
153 \r
154                 public virtual Size RowSpacing (System.Windows.Forms.TabControl tab) {\r
155                         switch (tab.Appearance) {\r
156                                 case TabAppearance.Normal:\r
157                                         return rowSpacingNormal;\r
158                                 case TabAppearance.Buttons:\r
159                                         return rowSpacingButtons;\r
160                                 case TabAppearance.FlatButtons:\r
161                                         return rowSpacingFlatButtons;\r
162                                 default:\r
163                                         throw new Exception ("Invalid Appearance value: " + tab.Appearance);\r
164                         }\r
165                 }\r
166                 #endregion\r
167 \r
168                 public TabControlPainter ()\r
169                 {\r
170                         defaultItemSize = new Size (42, 16);\r
171                         defaultPadding = new Point (6, 3);\r
172                         selectedTabDelta = new Rectangle (2, 2, 4, 3);\r
173                         selectedSpacing = 0;\r
174 \r
175                         rowSpacingNormal = new Size (0, 0);\r
176                         rowSpacingButtons = new Size (3, 3);\r
177                         rowSpacingFlatButtons = new Size (9, 3);\r
178                         \r
179                         colSpacing = 0;\r
180 \r
181                         minimumTabWidth = 42;\r
182                         scrollerWidth = 17;\r
183                         focusRectSpacing = new Point (2, 2);\r
184                         tabPanelOffset = new Point (4, 0);\r
185                         flatButtonSpacing = 8;\r
186                         tabPageSpacing = new Rectangle (4, 2, 3, 4);\r
187 \r
188                         imagePadding = new Point (2, 3);\r
189 \r
190                         defaultFormatting = new StringFormat();\r
191                         // Horizontal Alignment is handled in the Draw method\r
192                         defaultFormatting.Alignment = StringAlignment.Near;\r
193                         defaultFormatting.LineAlignment = StringAlignment.Center;\r
194                         defaultFormatting.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.NoClip;\r
195                         defaultFormatting.HotkeyPrefix = HotkeyPrefix.Show;\r
196 \r
197                         borderThickness = new Rectangle (1, 1, 2, 2);\r
198                 }\r
199 \r
200                 public virtual Rectangle GetLeftScrollRect (System.Windows.Forms.TabControl tab)\r
201                 {\r
202                         switch (tab.Alignment) {\r
203                                 case TabAlignment.Top:\r
204                                         return new Rectangle (tab.ClientRectangle.Right - (scrollerWidth * 2), tab.ClientRectangle.Top + 1, scrollerWidth, scrollerWidth);\r
205                                 default:\r
206                                         Rectangle panel_rect = GetTabPanelRect (tab);\r
207                                         return new Rectangle (tab.ClientRectangle.Right - (scrollerWidth * 2), panel_rect.Bottom + 2, scrollerWidth, scrollerWidth);\r
208                         }\r
209                 }\r
210 \r
211                 public virtual Rectangle GetRightScrollRect (System.Windows.Forms.TabControl tab)\r
212                 {\r
213                         switch (tab.Alignment) {\r
214                                 case TabAlignment.Top:\r
215                                         return new Rectangle (tab.ClientRectangle.Right - (scrollerWidth), tab.ClientRectangle.Top + 1, scrollerWidth, scrollerWidth);\r
216                                 default:\r
217                                         Rectangle panel_rect = GetTabPanelRect (tab);\r
218                                         return new Rectangle (tab.ClientRectangle.Right - (scrollerWidth), panel_rect.Bottom + 2, scrollerWidth, scrollerWidth);\r
219                         }\r
220                 }\r
221 \r
222                 public Rectangle GetDisplayRectangle (System.Windows.Forms.TabControl tab)\r
223                 {\r
224                         Rectangle ext = GetTabPanelRect (tab);\r
225                         // Account for border size\r
226                         return new Rectangle (ext.Left + tabPageSpacing.X, ext.Top + tabPageSpacing.Y, \r
227                                 ext.Width - tabPageSpacing.X - tabPageSpacing.Width, ext.Height - tabPageSpacing.Y - tabPageSpacing.Height);\r
228                 }\r
229                 \r
230                 public Rectangle GetTabPanelRect (System.Windows.Forms.TabControl tab)\r
231                 {       \r
232                         // Offset the tab page (panel) from the top corner\r
233                         Rectangle res = tab.ClientRectangle;\r
234 \r
235                         if (tab.TabCount == 0)\r
236                                 return res;\r
237 \r
238                         int spacing = RowSpacing (tab).Height;\r
239                         int tabOffset = (tab.ItemSize.Height + spacing - selectedTabDelta.Height) * tab.RowCount + selectedTabDelta.Y;\r
240                         switch (tab.Alignment) {\r
241                                 case TabAlignment.Top:\r
242                                         res.Y += tabOffset;\r
243                                         res.Height -= tabOffset;\r
244                                         break;\r
245                                 case TabAlignment.Bottom:\r
246                                         res.Height -= tabOffset;\r
247                                         break;\r
248                                 case TabAlignment.Left:\r
249                                         res.X += tabOffset;\r
250                                         res.Width -= tabOffset;\r
251                                         break;\r
252                                 case TabAlignment.Right:\r
253                                         res.Width -= tabOffset;\r
254                                         break;\r
255                         }\r
256 \r
257                         return res;\r
258                 }\r
259 \r
260                 public virtual void Draw (Graphics dc, Rectangle area, TabControl tab)\r
261                 {\r
262                         DrawBackground (dc, area, tab);\r
263 \r
264                         int start = 0;\r
265                         int end = tab.TabPages.Count;\r
266                         int delta = 1;\r
267 \r
268                         if (tab.Alignment == TabAlignment.Top) {\r
269                                 start = end;\r
270                                 end = 0;\r
271                                 delta = -1;\r
272                         }\r
273 \r
274                         if (tab.SizeMode == TabSizeMode.Fixed)\r
275                                 defaultFormatting.Alignment = StringAlignment.Center;\r
276                         else\r
277                                 defaultFormatting.Alignment = StringAlignment.Near;\r
278 \r
279                         int counter = start;\r
280                         for (; counter != end; counter += delta) {\r
281                                 for (int i = tab.SliderPos; i < tab.TabPages.Count; i++) {\r
282                                         if (i == tab.SelectedIndex)\r
283                                                 continue;\r
284                                         if (counter != tab.TabPages[i].Row)\r
285                                                 continue;\r
286                                         Rectangle rect = tab.GetTabRect (i);\r
287                                         if (!rect.IntersectsWith (area))\r
288                                                 continue;\r
289                                         DrawTab (dc, tab.TabPages[i], tab, rect, false);\r
290                                 }\r
291                         }\r
292 \r
293                         if (tab.SelectedIndex != -1 && tab.SelectedIndex >= tab.SliderPos) {\r
294                                 Rectangle rect = tab.GetTabRect (tab.SelectedIndex);\r
295                                 if (rect.IntersectsWith (area))\r
296                                         DrawTab (dc, tab.TabPages[tab.SelectedIndex], tab, rect, true);\r
297                         }\r
298 \r
299                         if (tab.ShowSlider) {\r
300                                 Rectangle right = GetRightScrollRect (tab);\r
301                                 Rectangle left = GetLeftScrollRect (tab);\r
302                                 DrawScrollButton (dc, right, area, ScrollButton.Right, tab.RightSliderState);\r
303                                 DrawScrollButton (dc, left, area, ScrollButton.Left, tab.LeftSliderState);\r
304                         }\r
305                 }\r
306 \r
307                 protected virtual void DrawScrollButton (Graphics dc, Rectangle bounds, Rectangle clippingArea, ScrollButton button, PushButtonState state)\r
308                 {\r
309                         ControlPaint.DrawScrollButton (dc, bounds, button, GetButtonState (state));\r
310                 }\r
311 \r
312                 static ButtonState GetButtonState (PushButtonState state)\r
313                 {\r
314                         switch (state) {\r
315                         case PushButtonState.Pressed:\r
316                                 return ButtonState.Pushed;\r
317                         default:\r
318                                 return ButtonState.Normal;\r
319                         }\r
320                 }\r
321 \r
322                 protected virtual void DrawBackground (Graphics dc, Rectangle area, TabControl tab)\r
323                 {\r
324                         Brush brush = SystemBrushes.Control;\r
325                         dc.FillRectangle (brush, area);\r
326                         Rectangle panel_rect = GetTabPanelRect (tab);\r
327 \r
328                         if (tab.Appearance == TabAppearance.Normal) {\r
329                                 ControlPaint.DrawBorder3D (dc, panel_rect, Border3DStyle.RaisedInner, Border3DSide.Left | Border3DSide.Top);\r
330                                 ControlPaint.DrawBorder3D (dc, panel_rect, Border3DStyle.Raised, Border3DSide.Right | Border3DSide.Bottom);\r
331                         }\r
332                 }\r
333 \r
334                 protected virtual int DrawTab (Graphics dc, System.Windows.Forms.TabPage page, System.Windows.Forms.TabControl tab, Rectangle bounds, bool is_selected)\r
335                 {\r
336                         Rectangle interior;\r
337                         int res = bounds.Width;\r
338 \r
339                         dc.FillRectangle (ResPool.GetSolidBrush (tab.BackColor), bounds);\r
340 \r
341                         if (tab.Appearance == TabAppearance.Buttons || tab.Appearance == TabAppearance.FlatButtons) {\r
342                                 // Separators\r
343                                 if (tab.Appearance == TabAppearance.FlatButtons) {\r
344                                         int width = bounds.Width;\r
345                                         bounds.Width += (flatButtonSpacing - 2);\r
346                                         res = bounds.Width;\r
347                                         if (tab.Alignment == TabAlignment.Top || tab.Alignment == TabAlignment.Bottom)\r
348                                                 ThemeEngine.Current.CPDrawBorder3D (dc, bounds, Border3DStyle.Etched, Border3DSide.Right);\r
349                                         else\r
350                                                 ThemeEngine.Current.CPDrawBorder3D (dc, bounds, Border3DStyle.Etched, Border3DSide.Top);\r
351                                         bounds.Width = width;\r
352                                 }\r
353 \r
354                                 if (is_selected) {\r
355                                         ThemeEngine.Current.CPDrawBorder3D (dc, bounds, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom);\r
356                                 } else if (tab.Appearance != TabAppearance.FlatButtons) {\r
357                                         ThemeEngine.Current.CPDrawBorder3D (dc, bounds, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom);\r
358                                 }\r
359 \r
360 \r
361                         } else {\r
362                                 CPColor cpcolor = ResPool.GetCPColor (tab.BackColor);\r
363 \r
364                                 Pen light = ResPool.GetPen (cpcolor.LightLight);\r
365 \r
366                                 switch (tab.Alignment) {\r
367 \r
368                                         case TabAlignment.Top:\r
369 \r
370                                                 dc.DrawLine (light, bounds.Left, bounds.Bottom - 1, bounds.Left, bounds.Top + 3);\r
371                                                 dc.DrawLine (light, bounds.Left, bounds.Top + 3, bounds.Left + 2, bounds.Top);\r
372                                                 dc.DrawLine (light, bounds.Left + 2, bounds.Top, bounds.Right - 3, bounds.Top);\r
373 \r
374                                                 dc.DrawLine (SystemPens.ControlDark, bounds.Right - 2, bounds.Top + 1, bounds.Right - 2, bounds.Bottom - 1);\r
375                                                 dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right - 2, bounds.Top + 1, bounds.Right - 1, bounds.Top + 2);\r
376                                                 dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right - 1, bounds.Top + 2, bounds.Right - 1, bounds.Bottom - 1);\r
377                                                 break;\r
378 \r
379                                         case TabAlignment.Bottom:\r
380 \r
381                                                 dc.DrawLine (light, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 2);\r
382                                                 dc.DrawLine (light, bounds.Left, bounds.Bottom - 2, bounds.Left + 3, bounds.Bottom);\r
383                                                 \r
384                                                 dc.DrawLine (SystemPens.ControlDarkDark, bounds.Left + 3, bounds.Bottom, bounds.Right - 3, bounds.Bottom);\r
385                                                 dc.DrawLine (SystemPens.ControlDark, bounds.Left + 3, bounds.Bottom - 1, bounds.Right - 3, bounds.Bottom - 1);\r
386 \r
387                                                 dc.DrawLine (SystemPens.ControlDark, bounds.Right - 2, bounds.Bottom - 1, bounds.Right - 2, bounds.Top + 1);\r
388                                                 dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right - 2, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 2);\r
389                                                 dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right - 1, bounds.Bottom - 2, bounds.Right - 1, bounds.Top + 1);\r
390 \r
391                                                 break;\r
392 \r
393                                         case TabAlignment.Left:\r
394 \r
395                                                 dc.DrawLine (light, bounds.Left - 2, bounds.Top, bounds.Right, bounds.Top);\r
396                                                 dc.DrawLine (light, bounds.Left, bounds.Top + 2, bounds.Left - 2, bounds.Top);\r
397                                                 dc.DrawLine (light, bounds.Left, bounds.Top + 2, bounds.Left, bounds.Bottom - 2);\r
398 \r
399                                                 dc.DrawLine (SystemPens.ControlDark, bounds.Left, bounds.Bottom - 2, bounds.Left + 2, bounds.Bottom - 1);\r
400 \r
401                                                 dc.DrawLine (SystemPens.ControlDark, bounds.Left + 2, bounds.Bottom - 1, bounds.Right, bounds.Bottom - 1);\r
402                                                 dc.DrawLine (SystemPens.ControlDarkDark, bounds.Left + 2, bounds.Bottom, bounds.Right, bounds.Bottom);\r
403 \r
404                                                 break;\r
405 \r
406                                         default: // TabAlignment.Right\r
407 \r
408                                                 dc.DrawLine (light, bounds.Left, bounds.Top, bounds.Right - 3, bounds.Top);\r
409                                                 dc.DrawLine (light, bounds.Right - 3, bounds.Top, bounds.Right, bounds.Top + 3);\r
410 \r
411                                                 dc.DrawLine (SystemPens.ControlDark, bounds.Right - 1, bounds.Top + 1, bounds.Right - 1, bounds.Bottom - 1);\r
412                                                 dc.DrawLine (SystemPens.ControlDark, bounds.Left, bounds.Bottom - 1, bounds.Right - 2, bounds.Bottom - 1);\r
413 \r
414                                                 dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom - 3);\r
415                                                 dc.DrawLine (SystemPens.ControlDarkDark, bounds.Left, bounds.Bottom, bounds.Right - 3, bounds.Bottom);\r
416 \r
417                                                 break;\r
418                                 }\r
419                         }\r
420 \r
421                         Point padding = tab.Padding;\r
422                         interior = new Rectangle (bounds.Left + padding.X - 1, // substract a little offset\r
423                                 bounds.Top + padding.Y,\r
424                                 bounds.Width - (padding.X * 2), \r
425                                 bounds.Height - (padding.Y * 2));\r
426 \r
427                         if (tab.DrawMode == TabDrawMode.Normal && page.Text != null) {\r
428                                 if (tab.Alignment == TabAlignment.Left) {\r
429                                         dc.TranslateTransform (bounds.Left, bounds.Bottom);\r
430                                         dc.RotateTransform (-90);\r
431                                         dc.DrawString (page.Text, tab.Font,\r
432                                                 SystemBrushes.ControlText, \r
433                                                 tab.Padding.X - 2, // drawstring adds some extra unwanted leading spaces, so trimming\r
434                                                 tab.Padding.Y,\r
435                                                 defaultFormatting);\r
436                                         dc.ResetTransform ();\r
437                                 } else if (tab.Alignment == TabAlignment.Right) {\r
438                                         dc.TranslateTransform (bounds.Right, bounds.Top);\r
439                                         dc.RotateTransform (90);\r
440                                         dc.DrawString (page.Text, tab.Font,\r
441                                                 SystemBrushes.ControlText, \r
442                                                 tab.Padding.X - 2, // drawstring adds some extra unwanted leading spaces, so trimming\r
443                                                 tab.Padding.Y,\r
444                                                 defaultFormatting);\r
445                                         dc.ResetTransform ();\r
446                                 } else {\r
447                                         Rectangle str_rect = interior;\r
448 \r
449                                         if (tab.ImageList != null && page.ImageIndex >= 0 && page.ImageIndex < tab.ImageList.Images.Count) {\r
450                                                 int image_x;\r
451                                                 if (tab.SizeMode != TabSizeMode.Fixed) {\r
452                                                         image_x = str_rect.X;\r
453                                                 }\r
454                                                 else {\r
455                                                         image_x = str_rect.X + (str_rect.Width - tab.ImageList.ImageSize.Width) / 2;\r
456                                                         if (page.Text != null) {\r
457                                                                 SizeF textSize = dc.MeasureString(page.Text, page.Font, str_rect.Size);\r
458                                                                 image_x -= (int)(textSize.Width / 2);\r
459                                                         }\r
460                                                 }\r
461                                                 int image_y = str_rect.Y + (str_rect.Height - tab.ImageList.ImageSize.Height) / 2;\r
462                                                 tab.ImageList.Draw (dc, new Point (image_x, image_y), page.ImageIndex);\r
463                                                 str_rect.X += tab.ImageList.ImageSize.Width + 2;\r
464                                                 str_rect.Width -= tab.ImageList.ImageSize.Width + 2;\r
465                                         }\r
466                                         dc.DrawString (page.Text, tab.Font,\r
467                                                 SystemBrushes.ControlText,\r
468                                                 str_rect, \r
469                                                 defaultFormatting);\r
470 \r
471                                 }\r
472                         } else if (page.Text != null) {\r
473                                 DrawItemState state = DrawItemState.None;\r
474                                 if (page == tab.SelectedTab)\r
475                                         state |= DrawItemState.Selected;\r
476                                 DrawItemEventArgs e = new DrawItemEventArgs (dc,\r
477                                         tab.Font, bounds, tab.IndexForTabPage (page),\r
478                                         state, page.ForeColor, page.BackColor);\r
479                                 tab.OnDrawItemInternal (e);\r
480                                 return res;\r
481                         }\r
482 \r
483                         // TabControl ignores the value of ShowFocusCues\r
484                         if (page.Parent.Focused && is_selected) {\r
485                                 Rectangle focus_rect = bounds;\r
486                                 focus_rect.Inflate (-2, -2);\r
487                                 ThemeEngine.Current.CPDrawFocusRectangle (dc, focus_rect, tab.BackColor, tab.ForeColor);\r
488                         }\r
489 \r
490                         return res;\r
491                 }\r
492 \r
493                 public virtual bool HasHotElementStyles (TabControl tabControl) {\r
494                         return false;\r
495                 }\r
496         }\r
497 }\r