Exemple #1
0
/* ---------------------------------------------------------------------
 * ShellDlgCreateHook
 * Create dialog controls
 * ---------------------------------------------------------------------
 */
static void
ShellDlgCreateHook(void* w)
{
	CUIWINDOW* win = (CUIWINDOW*) w;
	CUIWINDOW* ctrl;
	SHELLDLGDATA* data = (SHELLDLGDATA*) win->InstData;
	CUIRECT rc;

	WindowGetClientRect(win, &rc);

	ctrl = TerminalNew(win,
		data->pTitle ? data->pTitle : L"",
		rc.X, rc.Y, rc.W, rc.H,
		IDC_TERMINAL,
		CWS_NONE, CWS_NONE);
	WindowCreate(ctrl);
	TerminalSetCoProcExitHook(ctrl, ShellDlgCoProcExitHook, win);

	if (data->pCommand)
	{
		TerminalWrite(ctrl, _T("\033[32m"), wcslen(_T("\033[32m")));
		TerminalWrite(ctrl, data->pCommand, wcslen(data->pCommand));
		TerminalWrite(ctrl, _T("\033[0m\n"), wcslen(_T("\033[0m\n")));
		TerminalRun(ctrl, data->pCommand);
	}
}
Exemple #2
0
//create that funky scroll bar white boy
//create that funky scroll bar right
HSCROLLBAR ScrollBarCreate ( int nId, int nX, int nY, int nWidth, int nHeight, int nButtonHeight, int nBitmap ) {

	HSCROLLBAR hScroll;

	if ( MemAlloc ( (void**) &hScroll, sizeof ( *hScroll ), 0 ) == RETCODE_FAILURE ) {

		return 0;
	}

	//fill out the standard info
	hScroll->mc.nId = nId;
	hScroll->mc.x = nX;
	hScroll->mc.y = nY;
	hScroll->mc.nWidth = nWidth;
	hScroll->mc.nHeight = nHeight;
	hScroll->mc.psFuncTable = &gsScrollBarFuncTable;

	//scroll bar specific info
	hScroll->nTopItem = 0;
	hScroll->nMaxItems = 0;
	hScroll->nSliderPos = 0;
	hScroll->nVisibleItems = 1;
	hScroll->nButtonHeight = nButtonHeight;
	hScroll->nWindowHeight = nHeight - ( 2 * nButtonHeight );
	hScroll->nSliderHeight = hScroll->nWindowHeight;

	//create the window
	hScroll->hWin = WindowCreate ( nId + 1, ScrollBarWindowFunc, nBitmap, 0, nButtonHeight, nWidth, hScroll->nWindowHeight );

	MenuCreateItem ( (HMC) hScroll );

	return hScroll;
}
Exemple #3
0
void OutboundThread(void)
{
  WINDOW *local ;
  
  /* INITIALIZATION: Paint the local window. Create a	*/
  /* mailbox object to receive keystroke codes from the	*/
  /* keyboard ISR. Initialize the keyboard hardware.	*/
  /* Point interrupt vector 33 at the keyboard ISR.	*/
  /* Unmask the IRQ line in the 8259 PIC.			*/
  
  local = WindowCreate("Local", 0, 10, 0, 79) ;
  KeyboardInit() ;
  /* SerialInit have a guard inside to prevent multiple initializations */
  SerialInit() ;
 
  for (;;)
  {
    BYTE8 err, scan_code ;
    char ascii ;
    
    /* Suspend this thread (let it "sleep") until a	*/
    /* keyboard interrupt posts something to our	*/
    /* mailbox.  But first position the cursor 	*/
    /* at the next character position as a prompt.	*/
    
    WindowSelect(local) ;
    scan_code = ((unsigned) OSQPend(kybd_queue, 0, &err)) & 0xFF ;
    if (scan_code & 0x80)
      continue ; /* Key up */
    
    /* The keyboard ISR just woke us up. scan_code	*/
    /* is the keystroke that occurred. First check	*/
    /* to see if it simply changes state, like caps	*/
    /* lock, shift, ctrl, or alt.  Then convert the	*/
    /* scancode to ascii using the current state.	*/
    
    if (SetsKybdState(scan_code))
      continue ;
    
    ascii = ScanCode2Ascii(scan_code) & 0xFF ;
    if (!isprint(ascii) && !iscntrl(ascii))
      continue ;

    /* Display the character in the local window.	*/
    
    WindowPutChar(local, ascii) ;
    
    SendPacket(1, &ascii, 1) ;
    if (ascii == '\r')
    {
      static char linefeed = '\n' ;
      WindowPutChar(local, linefeed) ;
      SendPacket(1, &linefeed, 1) ;
    }
  }
}
Exemple #4
0
/* ---------------------------------------------------------------------
 * PasswddlgCreateHook
 * Create dialog controls
 * ---------------------------------------------------------------------
 */
static void
PasswddlgCreateHook(void* w)
{
	CUIWINDOW* win = (CUIWINDOW*) w;
	CUIWINDOW* ctrl;
	PASSWDDLGDATA* data = (PASSWDDLGDATA*) win->InstData;

	ctrl = LabelNew(win, _T("Enter Password:"******"Retype Password:"******"&OK"), 14, 6, 10, 1, IDOK, CWS_DEFOK, CWS_NONE);
	ButtonSetClickedHook(ctrl, PasswddlgButtonHook, win);
	WindowCreate(ctrl);

	ctrl = ButtonNew(win, _T("&Cancel"), 27, 6, 10, 1, IDCANCEL, CWS_DEFCANCEL, CWS_NONE);
	ButtonSetClickedHook(ctrl, PasswddlgButtonHook, win);
	WindowCreate(ctrl);
}
Exemple #5
0
/*-------------------------------------------------------------------------
	ウインドウズプログラムのメイン部分
---------------------------------------------------------------------------*/
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
	/*--------------------------
		変数の宣言
	----------------------------*/
	static char psAppName[] = "WndApp";
	MSG			msg;							// メッセージ
	WNDCLASS	wc;								// ウインドウクラス
	HWND		hwnd;							// ウインドウハンドル

	//	ウィンドウクラスの設定
	wc.lpszClassName = psAppName;				// ウインドウクラスネーム(詳細不明)
	wc.lpfnWndProc   = WndProc;					// ウインドウプロシージャ名(WndProcにする)
	wc.style         = NULL;		
	wc.cbClsExtra    = 0;						// 未使用。0 にする。
	wc.cbWndExtra    = 0;						// 未使用。0 にする。
	wc.lpszMenuName  = "ICON_MENU";				// 未使用。NULL でもOK
	wc.hbrBackground = ( HBRUSH)GetStockObject( BLACK_BRUSH );				// <-背景色
	wc.hInstance     = hInstance;											// インスタンスハンドル
	wc.hIcon         = LoadIcon( 0, IDI_APPLICATION );						// アイコン
	wc.hCursor       = LoadCursor( 0, IDC_ARROW );							// カーソルタイプ

	// ウインドウクラスを登録
	RegisterClass( &wc );

	// ウインドウの作成
	hwnd = WindowCreate( psAppName, GAME_NAME_, 1, WINDOW_SIZE_X_, WINDOW_SIZE_Y_, hInstance );

	// ウィンドウを表示
	ShowWindow ( hwnd, nCmdShow );			// ウインドウを表示
	UpdateWindow( hwnd );					// ウインドウの更新

	/*----------------------------------------------------
		ゲームのメイン部分
	------------------------------------------------------*/
	// メッセージループ	ゲーム終了まで永久ループ
  	while( TRUE ){	
		// メッセージの有りの場合
		if( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) ){	
			// プログラム終了要求
			if( msg.message == WM_QUIT )	break;
			// メッセージの解析
			TranslateMessage( &msg );
			DispatchMessage( &msg );
		}
	}

	// アプリ終了
	return	0;
}
long FAR PASCAL _export _EasyWinProc(HWND Window, UINT Message,
                                   WPARAM WParam, LONG LParam)
{
    CrtWindow = Window;
    switch (Message)
        {
        case WM_CREATE:
            WindowCreate();
            break;
        case WM_PAINT:
            WindowPaint();
            break;
        case WM_VSCROLL:
            WindowScroll(SB_VERT, WParam, LoVal(LParam));
            break;
        case WM_HSCROLL:
            WindowScroll(SB_HORZ, WParam, LoVal(LParam));
            break;
        case WM_SIZE:
            WindowResize(LoVal(LParam), HiVal(LParam));
            break;
        case WM_GETMINMAXINFO:
            WindowMinMaxInfo((TMinMaxInfo far *) LParam);
            break;
        case WM_CHAR:
            WindowChar((char)WParam);
            break;
        case WM_KEYDOWN:
            WindowKeyDown((BYTE)WParam);
            break;
        case WM_SETFOCUS:
            WindowSetFocus();
            break;

        case WM_KILLFOCUS:
            WindowKillFocus();
            break;
        case WM_DESTROY:
            WindowDestroy();
            break;
        default:
            return DefWindowProc(Window, Message, WParam, LParam);
        }
    return NULL;
}
Exemple #7
0
void OutBound(void)
{
  WINDOW *w ;
  
  w = WindowCreate("Local", 0, 10, 0, 79) ;
  if (!w)
    return ;
  
  for (;;)
  {
    BYTE8 code ;
    char ascii ;
    
    MtCYield() ;
    
    WindowSelect(w) ;
    
    if (!ScanCodeRdy())
      continue ;
    
    code = GetScanCode() ;
    
    if (code & 0x80)
      continue ;
    
    if (SetsKybdState(code))
      continue ;
    
    ascii = ScanCode2Ascii(code) & 0xFF ;
    if (!isprint(ascii) && !iscntrl(ascii))
      continue ;
    
    WindowPutChar(w, ascii) ;
    
    SerialPut(ascii) ;
    if (ascii == '\r')
    {
      WindowPutChar(w, '\n') ;
      SerialPut('\n') ;
    }
  }
}
Exemple #8
0
bool SysInit(HINSTANCE hInst)
{
	assert(hInst != NULL);
	
	appInst = hInst;

	bool fullscr = true;
	if(Message(MB_YESNO,"Run windowed ?") == IDYES)
		fullscr = false;

	if(!WindowCreate(START_RES_X, START_RES_Y, 16,fullscr))
		return false;
	
	if(!buffer.Init(dispDC, START_RES_X, START_RES_Y))
	{
		WindowDestroy();
		return false;
	}

	return true;
}
Exemple #9
0
void UI::Control()
{
	m_pTaskBar->Control();
	m_pMenuicon->Control();

	// ウィンドウがあるのならコントロール関数を呼ぶ
	if (m_pWindow != NULL)
	{
		if (m_pWindow->Control())
		{
			delete m_pWindow;
			m_pWindow = NULL;
		}
	}
	else
	{
		// クリックされたら対応するウィンドウを作成
		if (m_pIdf->MouseLeftPush())
		{
			WindowCreate();
		}
	}
}
Exemple #10
0
void wxOwnerDrawFrame::OnWindowCreate(wxWindowCreateEvent& event)
{
	WindowCreate(event);
}
Exemple #11
0
/* ---------------------------------------------------------------------
 * ComboboxShowDropdown
 * Display dropdown window
 * ---------------------------------------------------------------------
 */
static void
ComboboxShowDropdown(CUIWINDOW* win, COMBOBOXDATA* data, int capture)
{
	CUIWINDOW* listbox;
	CUIRECT rc;
	int height;

	WindowGetWindowRect(win, &rc);

	height = ((data->NumItems + 2) > data->Height) ? data->Height : (data->NumItems + 2);
	if ((LINES - rc.Y) > height)
	{
		listbox = WindowNew(win, rc.X, rc.Y + 1, rc.W, height, 
			CWS_POPUP | CWS_BORDER | CWS_TABSTOP);
	}
	else if (rc.Y > (LINES / 2))
	{
		if (height > (rc.Y - 1))
		{
			height = rc.Y - 1;
		}
		listbox = WindowNew(win, rc.X, rc.Y - height - 1, rc.W, height, 
			CWS_POPUP | CWS_BORDER | CWS_TABSTOP);
	}
	else
	{
		if (height > (LINES - rc.Y - 1))
		{
			height = LINES - rc.Y - 1;
		}
		listbox = WindowNew(win, rc.X, rc.Y + 1, rc.W, height, 
			CWS_POPUP | CWS_BORDER | CWS_TABSTOP);
	}

	listbox->Class = _T("CBDROPDOWN");
	WindowSetPaintHook(listbox, CbDropdownPaintHook);
	WindowSetKeyHook(listbox, CbDropdownKeyHook);
	WindowSetMButtonHook(listbox, CbDropdownMButtonHook);
	WindowSetVScrollHook(listbox, CbDropdownVScrollHook);
	WindowSetSizeHook(listbox, CbDropdownSizeHook);
	WindowSetSetFocusHook(listbox, CbDropdownSetFocusHook);
	WindowSetKillFocusHook(listbox, CbDropdownKillFocusHook);
	WindowEnableVScroll(listbox, TRUE);

	listbox->InstData = (void*) data;
	data->SelIndex = data->CtrlSelIndex;
	data->MouseDown = capture;
	data->DropdownState = TRUE;
	data->CloseKey = 0;

	if (height > 0)
	{
		WindowCreate(listbox);
		if (capture)
		{
			WindowSetCapture(listbox);
		}
		WindowModal(listbox);
		WindowReleaseCapture();
	}
	WindowDestroy(listbox);

	data->DropdownState = FALSE;
	ComboboxUpdate(win);

	switch(data->CloseKey)
	{
	case KEY_TAB:
	case KEY_RIGHT:
		WindowFocusNext(win->Parent);
		break;
	case KEY_LEFT:
		WindowFocusPrevious(win->Parent);
		break;
	}
}
Exemple #12
0
	Window::Window()
	{
		WindowCreate(mHandle, mProcess, this);
	}
Exemple #13
0
void AutoIt_App::Run(void)
{
	char	szOldWorkingDir[_MAX_PATH+1];
	char	szTempFileName[_MAX_PATH+1];


	// Parse the command line options (get scriptname, reveal mode, single cmd, etc.)
	ParseCmdLine();

	// If we are in single command mode (/c) then manually add a line of script, otherwise
	// load a script
	if (m_bSingleCmdMode == true)
	{
		// Create a "loaded" script that contains a single line - cunning eh? :)
		//MessageBox(NULL, m_sSingleLine.c_str(), "", MB_OK);

		g_oScriptFile.AddLine(1, m_sSingleLine.c_str(), -1);
	}
	else
	{
		// Check that we can load the script file.  Returns the FULLPATH of the script loaded
		if (g_oScriptFile.LoadScript(m_szScriptFileName) == false)
		{
			g_nExitCode = 1;						// Main exit code
			return;									// Error loading script
		}
		else
			GetFullPathName(m_szScriptFileName, _MAX_PATH, szTempFileName, &m_szScriptFilePart);
	}

	// Prepare the script for use
	g_oScriptFile.PrepareScript();

	// Perform initial check of the script (check userfunctions, etc)
	if (g_oScript.InitScript(m_szScriptFileName) != AUT_OK)
	{
		g_oScriptFile.UnloadScript();
		g_nExitCode = 1;						// Main exit code
		return;									// Error initialising script
	}

	// Save the current working directory
	GetCurrentDirectory(_MAX_PATH, szOldWorkingDir);

	// Register our classes (including the GUI class) and create the main windows
	RegisterClass();
	WindowCreate();

	// Show the tray icon if required
	if (g_bTrayIconInitial == true)
		CreateTrayIcon();


	// Run the script from line 1, the Execute() function will run the windows message queue
	g_oScript.Execute(1);

	// Unload the script (even if one wasn't loaded - this is OK)
	g_oScriptFile.UnloadScript();

	// Restore the old working directory
	SetCurrentDirectory(szOldWorkingDir);

} // Run()