Added a public API for creating raw Windows controls. Removed include guards from uipriv_*.h.

This commit is contained in:
Pietro Gagliardi 2015-04-07 00:56:06 -04:00
parent 1d76d53593
commit ab936d304f
4 changed files with 29 additions and 15 deletions

29
new/ui_windows.h Normal file
View File

@ -0,0 +1,29 @@
// 7 april 2015
/*
This file assumes that you have included <windows.h> and "ui.h" beforehand. It provides API-specific functions for interfacing with foreign controls in Windows.
*/
#ifndef __UI_UI_WINDOWS_H__
#define __UI_UI_WINDOWS_H__
// uiWindowsNewControl() creates a new uiControl with the given Windows API control inside.
typedef struct uiWindowsNewControlParams uiWindowsNewControlParams;
struct uiWindowsNewControlParams {
// These match the CreateWindowExW() function.
DWORD dwExStyle;
LPCWSTR lpClassName;
//TODO? LPCWSTR lpWindowName;
DWORD dwStyle; // WS_CHILD and WS_VISIBLE are automatically applied.
HINSTANCE hInstance;
// These are called when the control sends a WM_COMMAND or WM_NOTIFY (respectively) to its parent.
// ui redirects the message back and calls these functions.
// Store the result in the LRESULT pointer and return TRUE to return the given result; return FALSE to pass the notification up to your window procedure.
// Note that these are only issued if they come from the uiControl itself; notifications from children of the uiControl (such as a header control) will be received normally.
BOOL (*onWM_COMMAND)(uiControl *, WPARAM, LPARAM, LRESULT *);
BOOL (*onWM_NOTIFY)(uiControl *, WPARAM, LPARAM, LRESULT *);
};
uiControl *uiWindowsNewControl(uiWindowsNewControlParams *);
#endif

View File

@ -1,8 +1,5 @@
// 6 january 2015 // 6 january 2015
#ifndef __UI_UI_DARWIN_H__
#define __UI_UI_DARWIN_H__
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7 #define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7 #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
@ -14,5 +11,3 @@
extern void *uiAlloc(size_t); extern void *uiAlloc(size_t);
extern void *uiRealloc(void *, size_t); extern void *uiRealloc(void *, size_t);
extern void uiFree(void *); extern void uiFree(void *);
#endif

View File

@ -1,13 +1,8 @@
// 6 april 2015 // 6 april 2015
#ifndef __UI_UI_UNIX_H__
#define __UI_UI_UNIX_H__
#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_32 #define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_32
#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_32 #define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_32
#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_4 #define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_4
#define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_4 #define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_4
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "uipriv.h" #include "uipriv.h"
#endif

View File

@ -1,8 +1,5 @@
// 6 january 2015 // 6 january 2015
#ifndef __UI_UI_WINDOWS_H__
#define __UI_UI_WINDOWS_H__
#define UNICODE #define UNICODE
#define _UNICODE #define _UNICODE
#define STRICT #define STRICT
@ -64,5 +61,3 @@ struct uiSingleHWNDControl {
void *voidEventData; void *voidEventData;
}; };
extern uiSingleHWNDControl *newSingleHWNDControl(DWORD, const WCHAR *, DWORD, HINSTANCE); extern uiSingleHWNDControl *newSingleHWNDControl(DWORD, const WCHAR *, DWORD, HINSTANCE);
#endif