00001 #ifndef BASIC_WINDOW_CLASS 00002 #define BASIC_WINDOW_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : basic_window * 00007 * Author : Chris Koeritz * 00008 * * 00009 * Purpose: * 00010 * * 00011 * A simple class for a window based on the Win32 API. * 00012 * * 00013 ******************************************************************************* 00014 * Copyright (c) 2000-$now By Author. This program is free software; you can * 00015 * redistribute it and/or modify it under the terms of the GNU General Public * 00016 * License as published by the Free Software Foundation; either version 2 of * 00017 * the License or (at your option) any later version. This is online at: * 00018 * http://www.fsf.org/copyleft/gpl.html * 00019 * Please send any updates to: fred@gruntose.com * 00020 \*****************************************************************************/ 00021 00022 // Note: See basic_window.rh for macros that can be used in resource files. 00023 00024 #include "winexdll.h" 00025 00026 #include <basis/object_base.h> 00027 #include <basis/portable.h> 00028 00029 class WINDOWS_EXTENSIONS_CLASS_STYLE basic_window : public virtual object_base 00030 { 00031 public: 00032 basic_window(application_instance instance_handle, const istring &title, 00033 const istring &window_class); 00034 // a new window will be created with this program's instance handle and 00035 // the title and class names provided. 00036 00037 ~basic_window(); 00038 00039 IMPLEMENT_CLASS_NAME("basic_window"); 00040 00041 ATOM register_class(u_int *icon_id, u_int *menu_id, u_int *small_icon_id = 0); 00042 // registers the windows class and returns the API result. 00043 00044 bool create(int how_to_show); 00045 // invokes the underlying OS window initialization functions to create 00046 // the window. until this is called, the window doesn't really exist. 00047 // true is returned if the creation was successful. 00048 00049 // virtual LRESULT wnd_proc(HWND wind, UINT msg, WPARAM wp, LPARAM lp); 00050 00051 private: 00052 application_instance _instance; // current instance. 00053 istring *_window_title; // the text for the title bar. 00054 istring *_window_class; // the class this window gets registered under. 00055 00056 static LRESULT CALLBACK WndProc(HWND wind, UINT msg, WPARAM wp, LPARAM lp); 00057 // called back to deliver events sent by the OS. 00058 }; 00059 00060 #endif 00061
1.5.1