11 Commits
r266 ... r277

Author SHA1 Message Date
andreja6
b18ebfb56f Merge branch 'master' of https://github.com/andreja6/G3D-Fun 2018-10-22 12:16:53 -07:00
andreja6
eade3d8e93 Fixed deselect on rotate 2018-10-22 12:16:50 -07:00
MusicalProgrammer
ccf440a65e _redraw(HWND) is now just _redraw() 2018-10-22 15:02:44 -04:00
DirtPiper
551a0e4b9e more propertygrid testing 2018-10-22 14:50:23 -04:00
DirtPiper
4afe95ae26 Merge branch 'master' of https://github.com/andreja6/G3D-Fun 2018-10-22 14:25:26 -04:00
DirtPiper
c6151b58e2 zip 2018-10-22 14:25:25 -04:00
andreja6
6f91ad5881 Added required H and CPP files to VCProj 2018-10-22 11:24:42 -07:00
MusicalProgrammer
09d9af492f PropertyGrid successfully implemented. 2018-10-22 14:19:51 -04:00
DirtPiper
bd37f8e22d tab 2018-10-22 14:00:31 -04:00
DirtPiper
c5485fbf55 Merge branch 'master' of https://github.com/andreja6/G3D-Fun 2018-10-22 13:07:07 -04:00
DirtPiper
f02272976a a bunch of nothing 2018-10-22 13:07:05 -04:00
7 changed files with 135 additions and 58 deletions

1
.gitignore vendored
View File

@@ -52,3 +52,4 @@ G3DTest.suo
G3DTest.suo
stderr.txt
desktop.ini
main.cpp

2
Demo.h
View File

@@ -1,6 +1,7 @@
#pragma once
#include <G3DAll.h>
#include "CameraController.h"
#include "PropertyWindow.h"
class Demo { // : public GApp {
public:
@@ -45,6 +46,7 @@ class Demo { // : public GApp {
HWND _hwndToolbox;
HWND _buttonTest;
HWND _hwndRenderer;
PropertyWindow* _propWindow;
protected:
Stopwatch m_graphicsWatch;
Stopwatch m_logicWatch;

View File

@@ -294,6 +294,10 @@
RelativePath=".\propertyGrid.cpp"
>
</File>
<File
RelativePath=".\PropertyWindow.cpp"
>
</File>
<File
RelativePath=".\WindowFunctions.cpp"
>
@@ -403,6 +407,10 @@
RelativePath=".\propertyGrid.h"
>
</File>
<File
RelativePath=".\PropertyWindow.h"
>
</File>
<File
RelativePath=".\resource.h"
>

109
PropertyWindow.cpp Normal file
View File

@@ -0,0 +1,109 @@
#include <windows.h>
#include "WindowFunctions.h"
#include "propertyGrid.h"
#include "resource.h"
#include "PropertyWindow.h"
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PropertyWindow *propWind = (PropertyWindow *)GetWindowLongPtr(hwnd, GWL_USERDATA);
if (propWind==NULL)
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
switch(msg)
{
case WM_SIZE:
{
propWind->onResize();
}
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance) {
if (!createWindowClass("propHWND",PropProc,hThisInstance))
return false;
_hwndProp = CreateWindowEx(
WS_EX_TOOLWINDOW,
"propHWND",
"Prop Test",
WS_VISIBLE | WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
CW_USEDEFAULT,
CW_USEDEFAULT,
300,
660,
NULL, // parent
NULL, // menu
hThisInstance,
NULL
);
_propGrid = New_PropertyGrid(_hwndProp,IDC_PROPERTYGRID);
PROPGRIDITEM pItem;
PropGrid_ItemInit(pItem);
pItem.lpszCatalog="Test";
pItem.lpszPropName="Offset";
pItem.lpszzCmbItems="What";
pItem.lpszPropDesc="Description";
pItem.lpCurValue=(LPARAM)"0, 0, 0";
pItem.iItemType=PIT_EDIT;
PROPGRIDITEM pItem2;
PropGrid_ItemInit(pItem2);
pItem2.lpszCatalog="Test";
pItem2.lpszPropName="s";
pItem2.lpszzCmbItems="itemlist\0itemlist2\0itemlist3";
pItem2.lpszPropDesc="";
pItem2.lpCurValue=0;
pItem2.iItemType=PIT_COMBO;
/*PROPGRIDITEM FauxExplorerItem;
PropGrid_ItemInit(FauxExplorerItem);
FauxExplorerItem.lpszCatalog="Test";
FauxExplorerItem.lpszPropName = "Editable Combo Field";
FauxExplorerItem.lpszzCmbItems = "Test1\0Test2\0Test3";
FauxExplorerItem.lpszPropDesc = "Press F4 to view drop down.";
FauxExplorerItem.iItemType = PIT_EDITCOMBO;
FauxExplorerItem.lpCurValue = 1;
PropGrid_AddItem(_propGrid, &FauxExplorerItem);*/
PropGrid_Enable(_propGrid,true);
ShowWindow(_propGrid,SW_SHOW);
PropGrid_AddItem(_propGrid,&pItem);
PropGrid_AddItem(_propGrid,&pItem2);
PropGrid_SetItemHeight(_propGrid,20);
PropGrid_ShowToolTips(_propGrid,TRUE);
PropGrid_ShowPropertyDescriptions(_propGrid,TRUE);
PropGrid_ExpandAllCatalogs(_propGrid);
SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
_redraw();
return true;
}
PropertyWindow::PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance) {
onCreate(x, y, sx, sy, hThisInstance);
}
void PropertyWindow::onResize()
{
_redraw();
}
void PropertyWindow::_redraw()
{
RECT rect;
GetClientRect(_hwndProp,&rect);
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
}

12
PropertyWindow.h Normal file
View File

@@ -0,0 +1,12 @@
#pragma once
class PropertyWindow {
public:
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
bool onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance);
void onResize();
private:
HWND _propGrid;
HWND _hwndProp;
void _redraw();
};

View File

@@ -38,7 +38,7 @@
#include "ax.h"
#include <cguid.h>
#include "IEBrowser.h"
#include "propertyGrid.h"
#include "PropertyWindow.h"
#include <commctrl.h>
#if G3D_VER < 61000
@@ -141,7 +141,7 @@ Demo::Demo(const GAppSettings& settings,HWND parentWindow) { //: GApp(settings,w
SetWindowLongPtr(_hWndMain,GWL_USERDATA,(LONG)this);
SetWindowLongPtr(_hwndRenderer,GWL_USERDATA,(LONG)this);
_propWindow = new PropertyWindow(0, 0, 200, 640, hThisInstance);
IEBrowser* webBrowser = new IEBrowser(_hwndToolbox);
webBrowser->navigateSyncURL(L"http://scottbeebiwan.tk/g3d/toolbox/");
}
@@ -279,7 +279,6 @@ void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
else if(button->name == "Rotate")
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,toRadians(90),0));
}
selectedInstances.erase(selectedInstances.begin());
}
}
@@ -1349,8 +1348,6 @@ void Boop()
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
@@ -1611,8 +1608,6 @@ int main(int argc, char** argv) {
settings.window.center = true;
HMODULE hThisInstance = GetModuleHandle(NULL);
if (!createWindowClass("propHWND",WndProc,hThisInstance))
return false;
if (!createWindowClass("mainHWND",WndProc,hThisInstance))
return false;
if (!createWindowClass("toolboxHWND",ToolboxProc,hThisInstance))
@@ -1620,55 +1615,6 @@ int main(int argc, char** argv) {
if (!createWindowClass("G3DWindow",G3DProc,hThisInstance))
return false;
HWND hwndProp = CreateWindowEx(
WS_EX_TOOLWINDOW,
"propHWND",
"PropertyGrid",
WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX & ~WS_MINIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT,
300,
660,
NULL, // parent
NULL, // menu
hThisInstance,
NULL
);
ShowWindow(hwndProp,SW_SHOW);
HWND propGrid = New_PropertyGrid(hwndProp, 1000);
//InitPropertyGrid(GetModuleHandle(NULL));
PROPGRIDITEM pItem;
PropGrid_ItemInit(pItem);
pItem.lpszCatalog="Test";
pItem.lpszPropName="Test2";
pItem.lpszzCmbItems="What\0\0";
pItem.lpszPropDesc="Description";
pItem.iItemType = PIT_EDITCOMBO;
pItem.lpCurValue=0;
//PROPGRIDITEM FauxExplorerItem;
//PropGrid_ItemInit(FauxExplorerItem);
//FauxExplorerItem.lpszCatalog="Test";
//FauxExplorerItem.lpszPropName = "Editable Combo Field";
//FauxExplorerItem.lpszzCmbItems = "Test1\0Test2\0Test3";
//FauxExplorerItem.lpszPropDesc = "Press F4 to view drop down.";
//FauxExplorerItem.iItemType = PIT_EDITCOMBO;
//FauxExplorerItem.lpCurValue = 1;
//PropGrid_AddItem(propGrid, &FauxExplorerItem);
pItem.iItemType=PIT_EDIT;
PropGrid_Enable(propGrid,true);
ShowWindow(propGrid,SW_SHOW);
PropGrid_AddItem(propGrid,&pItem);
PropGrid_SetItemHeight(propGrid, 20);
PropGrid_ShowToolTips(propGrid, TRUE);
PropGrid_ShowPropertyDescriptions(propGrid, TRUE);
PropGrid_ExpandAllCatalogs(propGrid);
HWND hwndMain = CreateWindowEx(
WS_EX_ACCEPTFILES,
"mainHWND",
@@ -1689,11 +1635,9 @@ int main(int argc, char** argv) {
MessageBox(NULL, "Failed to create HWND", (PlaceholderName + " Crash").c_str() , MB_OK);
return 0;
}
SendMessage(hwndMain, WM_SETICON, ICON_BIG,(LPARAM)LoadImage(GetModuleHandle(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE));
Demo demo = Demo(settings,hwndMain);
demo.run();
}

View File

@@ -3,6 +3,7 @@
// Used by Dialogs.rc
//
#define IDI_ICON1 102
#define IDC_PROPERTYGRID 2000
// Next default values for new objects
//