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

📄 win_syssetsound.c~

📁 这是一个linux下基于MiniGUI的手机界面设计源码
💻 C~
字号:
/*win_sysSetSound.c*//***	COMPANY NAME:	国星**	FILE    NAME:	win_sysSetSound.c**	FILE	PATH:	Interface/win_sysSetSound.c**	WINDOWS NAME:	声音设置**	WINDOWS PATH:	系统 / 系统设置 / 声音设置**	OTHER INFORMATION;	无**	CREATER	NAME:	LiWencheng,JiangYuanqing**	MENDER	NAME:	LiWencheng**	CHANGE  TIME:	11/4/2007 */#include "sysSrcInfo.h"#ifndef _WIN_SYSSETSOUND_C_#define _WIN_SYSSETSOUND_C_#include <unistd.h>#include <pwd.h>#include <errno.h>#include <stdarg.h>#include <string.h>#include <sys/stat.h>#endif #define ID_SPINLEFT		234#define ID_SPINRIGHT	235#define ID_PROGRESSBAR	148static int sel ;static int currVolume;static HWND hIVMenusysSetSound; static HWND hWndMainsysSetSound;static HWND listBoxsysSetSound;static HWND hWndProgressbar ,hEditSetSound ,hWndCombox;static BITMAP bmpsysSetSound;//缓存中间状态栏图片static const char *bmp_name_sysSetSound[] = {	"./Pictures/b_windowsbackground_1.PNG",		"./Pictures/OK.PNG",				"./Pictures/menu.PNG",				"./Pictures/return.PNG",	"./Pictures/b_spinbox_0.PNG",                   	"./Pictures/b_spinbox_1.PNG" };static const char *labels_SetSound[] = {	"报警",	"有新邮件",	"电量低",	"新定位信息",};/* 定义皮肤元素数组 */static skin_item_t skinItemssysSetSound [] ={	{SIID_OK,           SI_TYPE_CHKBUTTON    | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,		 BUTTONLEFT_X,   BUTTON_Y, {},    1 ,"" },	{SIID_MENU,          SI_TYPE_CHKBUTTON   | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,		 BUTTONCENTER_X, BUTTON_Y, {},    2, "" },	{SIID_RETURN,        SI_TYPE_CHKBUTTON   | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,		 BUTTONRIGHT_X, BUTTON_Y, {},     3, "" },	{ID_SPINLEFT,        SI_TYPE_CHKBUTTON   | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,		 50,    ID_PROGRESSBAR+3, {},     4 ,"" },	{ID_SPINRIGHT,        SI_TYPE_CHKBUTTON  | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,		 144,  ID_PROGRESSBAR+3,  {},     5, "" }};/* 定义皮肤 */skin_head_t skinSysSetSound ={    "skinSysSetSound",  //const BITMAP* bmps;    SKIN_STYLE_TOOLTIP, NULL, NULL,     0, 5, skinItemssysSetSound, FALSE /** The number of the items in this skin. */  /* 定义皮肤元素数组 */ //注意上面数组的大小变了,则8变成多少};static int CloseWindow_sysSetSound (){	ShowWindow (hWndMainsysSetSound, SW_HIDE);	LoadSkinBmps (&skinSysSetSound, FALSE ,bmp_name_sysSetSound , (sizeof (bmp_name_sysSetSound))/sizeof (char *) );			UnloadBitmap ( &bmpsysSetSound );}/*static void ShowReturnPic_sysSetSound (int true){	int false;	if (true==TRUE){false=FALSE;}else{false=TRUE;}	skin_enable_item (&skinSysSetSound,SIID_CANCEL,false);       skin_show_item (&skinSysSetSound,SIID_CANCEL,false);	skin_enable_item (&skinSysSetSound,SIID_RETURN,true);       skin_show_item (&skinSysSetSound,SIID_RETURN,true);}*/static int main_event_cb_sysSetSound (HWND hwnd, skin_item_t* item, int event, void* data){	char buff[50];	int comboxSel;    if (event == SIE_BUTTON_CLICKED) {		switch (item->id) {  //按的那个图片				case SIID_OK:   				sel = SendMessage (listBoxsysSetSound, LB_GETCURSEL, 0, 0 );				SendMessage (listBoxsysSetSound,LB_GETTEXT,sel, (LPARAM)buff);				SetWindowText (hEditSetSound,buff);	//show it				comboxSel = SendMessage (hWndCombox, CB_GETCURSEL, 0, 0 );				switch (sel)				{					case 0:		    			SetSoundAlarm (buff);//sent to the database					break;					case 1:		    			SetSoundInfo (buff);					break;					case 2:		    			SetSoundCoulo (buff);					break;					case 3:		    			SetSoundLocInfo (buff);					break;				}				SetVolume (currVolume);				InvalidateRect (hEditSetSound, NULL,FALSE);            break;		case SIID_MENU:			     break;      		case SIID_RETURN:			win_SysSet (hWndMain );			CloseWindow_sysSetSound ();					break;		case ID_SPINLEFT:			SendMessage (hWndProgressbar,PBM_DELTAPOS, -10,0);			currVolume = currVolume - 10;		break;		case ID_SPINRIGHT:			SendMessage (hWndProgressbar, PBM_DELTAPOS, 10,0);			currVolume = currVolume + 10;	     break;        }    }    return 1;}static void fill_boxes (HWND hwnd, const char* path){    struct dirent* dir_ent;    DIR*   dir;    struct stat ftype;    char   fullpath [PATH_MAX + 6];//6 is "/Songs" length 	sprintf (fullpath,"%s/Songs",path);     	if ( (dir = opendir (fullpath)) == NULL)      			return;	while ( (dir_ent = readdir (dir )) != NULL ) {		if ( (strcmp (dir_ent->d_name, ".") && strcmp (dir_ent->d_name, ".."))!=0)		{         		SendMessage (listBoxsysSetSound, LB_ADDSTRING, 0, (LPARAM)&dir_ent->d_name);		}    }    closedir (dir);}static void ComboxInfo (HWND hwnd ,int id, int nc, DWORD add_data){	char buff[50];	if (nc == CBN_SELCHANGE)	{		int comboxSel = SendMessage (hWndCombox, CB_GETCURSEL, 0, 0 );		printf ("comboxSel==%d\n",comboxSel);		switch (comboxSel)		{		    case 0:			sprintf (buff ,"%s",GetSoundAlarm ());			break;		    case 1:			sprintf (buff ,"%s",GetSoundInfo ());			break;		    case 2:			sprintf (buff ,"%s",GetSoundCoulo ());			break;		    case 3:			sprintf (buff ,"%s",GetSoundLocInfo ());			break;		}		SetWindowText (hEditSetSound,buff);	}	}static int msg_event_cb_sysSetSound (HWND hwnd, int message, WPARAM wparam, LPARAM lparam, int* result){	HDC hdc;	HDC hdc1;	IVITEMINFO ivii; 	int j,i,k;       char cwd [MAX_PATH + 1];	char string[50];        switch (message) {        	case MSG_CREATE:		    LoadBitmap (HDC_SCREEN, &bmpsysSetSound, "./Pictures/a_sysSysset_2.PNG");                  gal_pixel pixel = RGB2Pixel (HDC_SCREEN, 0xFF, 0xFF, 0xFF);		    listBoxsysSetSound = CreateWindow (CTRL_LISTBOX ,NULL,WS_VISIBLE | WS_VSCROLL | WS_BORDER | LBS_SORT | LBS_NOTIFY,									2355,  0,60, 160, 85, hwnd, 0);			fill_boxes (listBoxsysSetSound, getcwd (cwd, MAX_PATH));		    SendMessage (listBoxsysSetSound,LB_SETCURSEL,0 ,0);			hWndProgressbar = CreateWindowEx ("progressbar",NULL,WS_VISIBLE ,WS_EX_USEPARENTCURSOR,2345, 58, ID_PROGRESSBAR , 85, 18, hwnd, 0);			SendMessage (hWndProgressbar,PBM_SETRANGE,0 ,1000);			SetWindowBkColor (hWndProgressbar, pixel);			currVolume = GetVolume ();				SendMessage (hWndProgressbar, PBM_SETPOS, currVolume ,0);			//SendMessage (hWndSetDisplay,PBM_SETSTEP,1 ,0);			UpdateWindow (hWndProgressbar ,TRUE);			hWndCombox = CreateWindow (CTRL_COMBOBOX, "", WS_CHILD | WS_VISIBLE | CBS_READONLY|CBS_SPINARROW_LEFTRIGHT |CBS_NOTIFY|CBS_SPINLIST,//WS_BORDER|									///CBS_AUTOSPIN|CBS_AUTOLOOP|		 							2343, 66, 20 , 90, 22, hwnd, 0);			SetWindowBkColor (hWndCombox, pixel);			SetNotificationCallback (hWndCombox,ComboxInfo );			for (i=0;i<TABLESIZE (labels_SetSound);i++)			{				SendMessage (hWndCombox, CB_ADDSTRING, 0, (LPARAM)labels_SetSound[i]);//(LPARAM)			}			SendMessage (hWndCombox, CB_SETCURSEL, 0, 0 );//(LPARAM)					hEditSetSound = CreateWindow (CTRL_SLEDIT, "",							//WS_VISIBLE  | ES_TIP| WS_BORDER  ,// | ES_AUTOWRAP,							WS_VISIBLE  | WS_CHILD | WS_BORDER ,//|ES_READONLY ,// | ES_AUTOWRAP,                           4543,66, 42, 90 , 18, hwnd, 0);			sprintf (string ,"%s",GetSoundAlarm ());			SetWindowText (hEditSetSound ,string);//GetSoundAlarm ());	  case MSG_PAINT :		    hdc=BeginPaint (hwnd); 				SetBkMode (hdc, BM_TRANSPARENT); 				FillBoxWithBitmap (hdc, ZTL_PIC_X,ZTL_PIC_Y, ZTL_PIC_W,ZTL_PIC_H, &bmpsysSetSound);				TextOut (hdc, RJ_X,	22, "声音类型" ); 				TextOut (hdc, RJ_X, 42, "声音文件" ); 				TextOut (hdc, RJ_X,148, "音量" ); 				TextOut (hdc, WZ_ZTL_X4, WZ_ZTL_Y, "声音设置" );             EndPaint (hwnd,hdc);	      break;    }        return 1;}void win_sysSetSound (HWND hwndmain){	MSG msg;	LoadSkinBmps (&skinSysSetSound, TRUE ,bmp_name_sysSetSound , (sizeof (bmp_name_sysSetSound))/sizeof (char *) );	if (skinSysSetSound.bmps == NULL) {      	  	printf ("Could not load skin bitmaps!\n");	}	if (!skin_init (&skinSysSetSound, main_event_cb_sysSetSound, msg_event_cb_sysSetSound) ){    /* 初始化皮肤 */			printf ("skin init fail!\n");	}	else{ 			hWndMainsysSetSound=  create_skin_control (&skinSysSetSound, hwndmain,143,DEF_X_, DEF_Y_,DEF_WIDTH, DEF_HEIGHT);			currShowWindowHwnd = &hWndMainsysSetSound;			SetFocusChild (listBoxsysSetSound);	}}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif

⌨️ 快捷键说明

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