예제 #1
0
//Entry point of the program
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow)
{
    //Create a window
    cWindow = Window(WindowProcedure, hThisInstance, "MealTrackApp", nCmdShow);
    cWindow.Create("MealTrack - Untitled", 462, 375);

    //Actually create the button with the window as its parent
    RECT rEditBox = {16, 280, 272, 24};
    cEditBox = EditBox(cWindow, rEditBox, "Disconnected");
    cEditBox.SetReadOnly(1);

    //Create the Button
    RECT rButton = {304, 280, 128, 24};
    cButton = Button(cWindow, rButton, "Start Meal", IDR_START_BUTTON);
    cButton.SetEnabled(0);

    //Create the listbox
    RECT rListBox = {16, 16, 272, 272};
    cListBox = ListBox(cWindow, rListBox, "MealListBox");

    //Meal wait box
    RECT rLabelDelay = {304, 16, 128, 16};
    RECT rEditDelay = {304, 32, 128, 24};
    cLabelDelay = Label(cWindow, rLabelDelay, "Meal wait (seconds)");
    cEditDelay = EditBox(cWindow, rEditDelay, "10");

    //Create Date format box
    RECT rLabelDate = {304, 64, 128, 16};
    RECT rComboDate = {304, 80, 128, 24};
    cLabelDate = Label(cWindow, rLabelDate, "Date format");
    cComboDate = ComboBox(cWindow, rComboDate, "ComboBoxDate");
    cComboDate.AddItem("12 Hour AM/PM");
    cComboDate.AddItem("24 Hour");
    cComboDate.SetDefaultItem(1);

    //Record format box
    RECT rLabelRecord = {304, 112, 128, 16};
    RECT rComboRecord = {304, 128, 128, 24};
    cLabelRecord = Label(cWindow, rLabelRecord, "Record change type");
    cComboRecord = ComboBox(cWindow, rComboRecord, "ComboBoxRecord");
    cComboRecord.AddItem("Increases");
    cComboRecord.AddItem("Decreases");
    cComboRecord.AddItem("Both");
    cComboRecord.SetDefaultItem(1);

    //Record format box
    RECT rLabelSensitivity = {304, 160, 128, 16};
    RECT rComboSensitivity = {304, 176, 128, 24};
    cLabelSensitivity = Label(cWindow, rLabelSensitivity, "Sensitivity");
    cComboSensitivity = ComboBox(cWindow, rComboSensitivity, "ComboBoxSensitivity");
    cComboSensitivity.AddItem("0.01 g");
    cComboSensitivity.AddItem("0.02 g");
    cComboSensitivity.AddItem("0.03 g");
    cComboSensitivity.AddItem("0.04 g");
    cComboSensitivity.AddItem("0.05 g");
    cComboSensitivity.AddItem("0.06 g");
    cComboSensitivity.AddItem("0.07 g");
    cComboSensitivity.AddItem("0.08 g");
    cComboSensitivity.AddItem("0.09 g");
    cComboSensitivity.SetDefaultItem(2);

    //Custom function to creeate window
    CreateWindowMenu(cWindow);

    //Message loop
    MSG msg;
    while (cWindow.GetMessage(&msg))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    // The program return-value is 0 - The value that PostQuitMessage() gave
    return msg.wParam;
}
예제 #2
0
파일: Main.cpp 프로젝트: k1lowM/Mul-light
/*******************************************************************************
	概要	:	メイン関数です。
	説明	:
	Include	:
	引数	:	ui ui_AppliID		アプリケーションのID
	戻り値	:	void
*******************************************************************************/
void	ML_Main( ui ui_AppliID )
{
	Window	MainWindow;			//ウィンドウ
	Pack	HPack;				//水平パック

	Text	Text1;				//テキスト1
	Text	Text2;				//テキスト2

	Button	Button1;			//ボタン1
	Text	Button1Text;		//ボタン1テキスト
	Button	Button2;			//ボタン2
	Text	Button2Text;		//ボタン2テキスト

	Msg		Msg;			//メッセージ受け取り変数

	//オブジェクト初期化
	{
		MainWindow.Init();				//ウィンドウ初期化
		HPack.Init( Pack::HORIZONTAL );	//水平パック初期化
		Text1.Init();					//テキスト1初期化
		Text2.Init();					//テキスト2初期化
		Button1.Init();					//ボタン1初期化
		Button1Text.Init();				//ボタン1テキスト初期化
		Button2.Init();					//ボタン2初期化
		Button2Text.Init();				//ボタン2テキスト初期化
	}

	//オブジェクト初期設定
	{
		//メインウィンドウ
		MainWindow.SetOffset( 0x10, 0x10, Object::H_LEFT, Object::V_TOP );
		MainWindow.SetSize( 0x200, 0x80, Object::WIDTH_PIXEL, Object::HEIGHT_PIXEL );
		MainWindow.SetChild( &HPack );	//子オブジェクト設定

		//水平パック
		HPack.AddChild( &Button1 );
		HPack.AddChild( &Text1 );
		HPack.AddChild( &Button2 );
		HPack.AddChild( &Text2 );

		//ボタン
		Button1.SetSize( 0, 0, Object::WIDTH_MIN, Object::HEIGHT_MIN );
		Button1.SetChild( &Button1Text );
		Button2.SetChild( &Button2Text );

		//ラベル
		Text1.SetText( "TextColor\nR-0xff, G-0x7f, B-0x00" );		//ラベル設定
		Text1.SetTextColor( 0xffff7f00 );
		Text2.SetText( "Text2\nSample3\nline feed sample." );		//ラベル設定
		Text2.SetTextColor( 0xff003fff );
		Button1Text.SetText( "Button1" );
		Button1Text.SetTextColor( 0xffffffff );
		Button2Text.SetText( "Button2" );
		Button2Text.SetTextColor( 0xffffffff );
	}


	//ウィンドウ登録
	MainWindow.RegiWindow( ui_AppliID );


	//メインループ
	while( true )
	{
		Msg = MainWindow.GetMessage();		//メッセージ取得
		switch( Msg.M_Message )
		{
		case Msg::MOUSE_MOVE:
			break;
		default:
			MainWindow.MsgDefProc( Msg );
			break;
		}
	}
}