Exemplo n.º 1
0
		public Gdk.Rectangle GetWindowClientArea (Gdk.Rectangle allocation)
		{
			IntPtr hdc = GetDC (hWnd);
			RECT r = new RECT (allocation.X, allocation.Y, allocation.X + allocation.Width, allocation.Y + allocation.Height);
			SIZE size;
			GetThemePartSize (hTheme, hdc, WP_CAPTION, CS_ACTIVE, ref r, 1, out size);
			ReleaseDC (hWnd, hdc);

			return new Gdk.Rectangle (allocation.X + FrameBorder, allocation.Y + size.cy, allocation.Width - FrameBorder * 2, allocation.Height - size.cy - FrameBorder);
		}
Exemplo n.º 2
0
		public void DrawWindowFrame (Gtk.Widget w, string caption, int x, int y, int width, int height)
		{
			Gdk.Drawable drawable = w.GdkWindow;
			Gdk.Pixmap pix = new Gdk.Pixmap (drawable, width, height, drawable.Depth);

			Gdk.GC gcc = new Gdk.GC (pix);
			gcc.Foreground = w.Style.Backgrounds [(int)Gtk.StateType.Normal];
			pix.DrawRectangle (gcc, true, 0, 0, width, height);

			IntPtr hdc = gdk_win32_hdc_get (pix.Handle, gcc.Handle, 0);

			RECT r = new RECT (0, 0, width, height);
			SIZE size;
			GetThemePartSize (hTheme, hdc, WP_CAPTION, CS_ACTIVE, ref r, 1, out size);

			r.Bottom = size.cy;
			DrawThemeBackground (hTheme, hdc, WP_CAPTION, CS_ACTIVE, ref r, ref r);

			RECT rf = new RECT (FrameBorder, FrameBorder, width - FrameBorder * 2, size.cy);
			LOGFONT lf = new LOGFONT ();
			GetThemeSysFont (hTheme, TMT_CAPTIONFONT, ref lf);
			IntPtr titleFont = CreateFontIndirect (ref lf);
			IntPtr oldFont = SelectObject (hdc, titleFont);
			SetBkMode (hdc, 1 /*TRANSPARENT*/);
			DrawThemeText (hTheme, hdc, WP_CAPTION, CS_ACTIVE, caption, -1, DT_LEFT | DT_SINGLELINE | DT_WORD_ELLIPSIS, 0, ref rf);
			SelectObject (hdc, oldFont);
			DeleteObject (titleFont);

			int ny = r.Bottom;
			r = new RECT (0, ny, width, height);
			DrawThemeBackground (hTheme, hdc, WP_FRAMEBOTTOM, 0, ref r, ref r);

			gdk_win32_hdc_release (pix.Handle, gcc.Handle, 0);

			Gdk.Pixbuf img = Gdk.Pixbuf.FromDrawable (pix, pix.Colormap, 0, 0, 0, 0, width, height);
			drawable.DrawPixbuf (new Gdk.GC (drawable), img, 0, 0, x, y, width, height, Gdk.RgbDither.None, 0, 0);
			drawable.DrawRectangle (w.Style.BackgroundGC (Gtk.StateType.Normal), true, x + FrameBorder, y + size.cy, width - FrameBorder * 2, height - FrameBorder - size.cy);
		}
Exemplo n.º 3
0
		extern static Int32 DrawThemeBackground (IntPtr hTheme, IntPtr hdc, int iPartId,
		   int iStateId, ref RECT pRect, ref RECT pClipRect);
Exemplo n.º 4
0
		extern static Int32 DrawThemeText (IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, String text, int textLength, UInt32 textFlags, UInt32 textFlags2, ref RECT pRect);
Exemplo n.º 5
0
		extern static Int32 GetThemeBackgroundExtent (IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, ref RECT pBoundingRect, out RECT pContentRect);
Exemplo n.º 6
0
		extern static Int32 GetThemePartSize (IntPtr hTheme, IntPtr hdc, int part, int state, ref RECT pRect, int eSize, out SIZE size);