⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 widget.h

📁 多媒体电话记录程序
💻 H
字号:
/////////////////////////////////////////////////////////////////////////////
//  Name: Widget.h
//  Copyright: wellgain
//  Author: bet
//  Date: 2003-10-17
//  Description:  interface for the CWin class.
/////////////////////////////////////////////////////////////////////////////
#ifndef _WG_WIDGET_H_
#define _WG_WIDGET_H_


#include <gtk/gtk.h>



class CWidget  
{
public:
	CWidget(CWidget* parent=(CWidget*)NULL);
	virtual ~CWidget();
	virtual GtkWidget* Create() {  return (GtkWidget*)NULL; }

	inline GtkWidget* GetHandle() const  { return m_hHandle; }
	inline CWidget* GetParent()	{ return m_hParent; } 
	inline void Hide()	{ if(m_hHandle) gtk_widget_hide(m_hHandle); }
	inline void Show() { if(m_hHandle) gtk_widget_show(m_hHandle); }

	inline void SetStyle(GtkStyle* style)	
		{ if(m_hHandle && style) gtk_widget_set_style(m_hHandle, style); }

	inline void SetSize(int w, int h)
	{ gtk_widget_set_usize(m_hHandle, w, h); }
	
	inline void SetPosition(int x, int y)
	{ gtk_widget_set_uposition(m_hHandle, x, y); }

	gpointer GetData (const gchar *key) const 
	{ if(m_hHandle) return gtk_object_get_data (GTK_OBJECT(m_hHandle), key); return NULL;}

	void SetData(const gchar *key, gpointer data)
	{ gtk_object_set_data(GTK_OBJECT(m_hHandle), key, data); }
	
	void Focus()	{ gtk_widget_grab_focus(m_hHandle); }
	void SetDefault()	{ gtk_widget_grab_default(m_hHandle); }
	void SetSensitive(bool issens)
	{ gtk_widget_set_sensitive(m_hHandle, issens); }

	void Destroy()	
	{ 
		if(m_hHandle && GTK_IS_WIDGET(m_hHandle) && GTK_OBJECT_CONSTRUCTED(m_hHandle)) 
			gtk_widget_destroy(m_hHandle); 
	}
	

public:
	int tag;

protected:
	GtkWidget* m_hHandle;
	CWidget* m_hParent;

	static void on_widget_destroy(GtkObject *object, gpointer user_data);
};


#endif //_WG_WIDGET_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -