/*
    ORPP Client

    (C) 2005 Jason Hunt

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

    Contact: huntjas2@msu.edu

    Compile with -lwsock32

    FILE: window.cpp
*/


#include <windows.h>

#pragma hdrstop

#include "window.h"
#include "display.h"
#include "version.h"


char c_name[] = "Robot Client"; //the class 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;         
    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);

    /* The class is registered, let's create the program*/
    HWND hwnd = CreateWindowEx (WS_EX_TOPMOST, c_name,
                                VERSION,  
                                WS_OVERLAPPEDWINDOW,
                                160,0,   // pos
                                display_x + 8, // x_ size
                                font_y_size * text_y_size + display_y + 44,

                               HWND_DESKTOP, NULL,
                               hThisInstance, NULL);

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

    main_win = hwnd; // save the handle

    // load the menu
    HMENU hMenu = LoadMenu (hThisInstance, "MAINMENU");
    SetMenu (hwnd, hMenu);

    ShowWindow (hwnd, nCmdShow); // display the window

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


