/*
    Robot Interface Remote Client
    (C) 2006 Jason Hunt
    nulluser@gmail.com

    file: window.cpp
*/


#include <windows.h>
#include <stdio.h>

#include "display.h"
#include "window.h"
#include "main.h"
#include "types.h"

extern unsigned int display_x;
extern unsigned int display_y;

HWND main_win = NULL;              // Keep track of the main window

static char c_name[] = program_name ;     // Setclass name


/* Create the main window */
int setup_window(HINSTANCE hThisInstance, int nCmdShow)
{
    WNDCLASSEX wincl;  

    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = c_name;
    wincl.lpfnWndProc = WinProc;      
    wincl.style = CS_DBLCLKS | CS_OWNDC;         
    wincl.cbSize = sizeof (WNDCLASSEX);

    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;               
    wincl.cbClsExtra = 0;                    
    wincl.cbWndExtra = 0;                    
    wincl.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); 

    if (!RegisterClassEx (&wincl)) return(1);

    HWND hwnd = CreateWindowEx (WS_EX_OVERLAPPEDWINDOW, c_name,
                               program_name , 
                                WS_CAPTION  | WS_SYSMENU | WS_MINIMIZEBOX,
//                               WS_OVERLAPPEDWINDOW  ,//WS_SYSMENU,
                               //WS_OVERLAPPEDWINDOW| WS_MINIMIZEBOX ,// | WS_MAXIMIZE, 

                               150, 150,   // pos
                               display_x + 7, // size
                               display_y + 27 + text_area_height+2,
                               HWND_DESKTOP, NULL,
                               hThisInstance, NULL);

    if (!hwnd) return(1); // Make sure it was made

    main_win = hwnd; // Save the handle
    
    ShowWindow (hwnd, nCmdShow); // Display the window

    return(0);
}
/* End of setup window */


/* Resize the windows to the size in the parmeters */
void resize_window(void)
{    
   /* int x_size = display_x + 7;
    int y_size = display_y + 27 + text_area_height + 2;
    
    WINDOWPLACEMENT p;                      // Hlds window data

    p.length = sizeof(WINDOWPLACEMENT);     // Setup struct
    GetWindowPlacement(main_win, &p);      // Get window information
        
    p.rcNormalPosition.right = p.rcNormalPosition.left + x_size;
    p.rcNormalPosition.bottom= p.rcNormalPosition.top + y_size;
        
    SetWindowPlacement(main_win, &p);
   
    display();*/
}
/* End of resize window */






