use glib::translate::*;
use glib::types;
use display::Display;
use object::Object;
use window::Window;
use ffi;
pub type GLContext = Object<ffi::GdkGLContext>;
impl types::StaticType for GLContext {
fn static_type() -> types::Type { unsafe { from_glib(ffi::gdk_gl_context_get_type()) } }
}
impl GLContext {
pub fn get_display(&self) -> Option<Display> {
unsafe { from_glib_none(ffi::gdk_gl_context_get_display(self.to_glib_none().0)) }
}
pub fn get_window(&self) -> Option<Window> {
unsafe { from_glib_none(ffi::gdk_gl_context_get_window(self.to_glib_none().0)) }
}
pub fn get_shared_context(&self) -> Option<GLContext> {
unsafe { from_glib_none(ffi::gdk_gl_context_get_shared_context(self.to_glib_none().0)) }
}
pub fn get_version(&self) -> (i32, i32) {
let mut major = 0;
let mut minor = 0;
unsafe { ffi::gdk_gl_context_get_version(self.to_glib_none().0, &mut major, &mut minor) };
(major, minor)
}
pub fn set_required_version(&self, major: i32, minor: i32) {
unsafe { ffi::gdk_gl_context_set_required_version(self.to_glib_none().0, major, minor) }
}
pub fn set_debug_enabled(&self, enabled: bool) {
unsafe { ffi::gdk_gl_context_set_debug_enabled(self.to_glib_none().0, enabled.to_glib()) }
}
pub fn get_debug_enabled(&self) -> bool {
unsafe { from_glib(ffi::gdk_gl_context_get_debug_enabled(self.to_glib_none().0)) }
}
pub fn set_forward_compatible(&self, compatible: bool) {
unsafe { ffi::gdk_gl_context_set_forward_compatible(self.to_glib_none().0, compatible.to_glib()) }
}
pub fn get_forward_compatible(&self) -> bool {
unsafe { from_glib(ffi::gdk_gl_context_get_forward_compatible(self.to_glib_none().0)) }
}
pub fn make_current(&self) {
unsafe { ffi::gdk_gl_context_make_current(self.to_glib_none().0) }
}
pub fn get_current() -> Option<GLContext> {
unsafe { from_glib_none(ffi::gdk_gl_context_get_current()) }
}
pub fn clear_current() {
unsafe { ffi::gdk_gl_context_clear_current() }
}
}