commit b26be968a985c75278bd1c184450439cb01d75d4 Author: Vladan Popovic Date: Thu Jul 25 01:22:02 2019 +0200 Prvo crtanje vo zivot diff --git a/crtanjeOOP/UpgradeLog.XML b/crtanjeOOP/UpgradeLog.XML new file mode 100755 index 0000000..ea24d86 --- /dev/null +++ b/crtanjeOOP/UpgradeLog.XML @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/crtanjeOOP/_UpgradeReport_Files/UpgradeReport.css b/crtanjeOOP/_UpgradeReport_Files/UpgradeReport.css new file mode 100755 index 0000000..3411f63 --- /dev/null +++ b/crtanjeOOP/_UpgradeReport_Files/UpgradeReport.css @@ -0,0 +1,207 @@ +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 100%; + MARGIN-LEFT: 0px; + MARGIN-TOP: 0px +} +P +{ + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 70%; + LINE-HEIGHT: 12pt; + MARGIN-BOTTOM: 0px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 10px +} +.note +{ + BACKGROUND-COLOR: #ffffff; + COLOR: #336699; + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 100%; + MARGIN-BOTTOM: 0px; + MARGIN-LEFT: 0px; + MARGIN-TOP: 0px; + PADDING-RIGHT: 10px +} +.infotable +{ + BACKGROUND-COLOR: #f0f0e0; + BORDER-BOTTOM: #ffffff 0px solid; + BORDER-COLLAPSE: collapse; + BORDER-LEFT: #ffffff 0px solid; + BORDER-RIGHT: #ffffff 0px solid; + BORDER-TOP: #ffffff 0px solid; + FONT-SIZE: 70%; + MARGIN-LEFT: 10px +} +.issuetable +{ + BACKGROUND-COLOR: #ffffe8; + BORDER-COLLAPSE: collapse; + COLOR: #000000; + FONT-SIZE: 100%; + MARGIN-BOTTOM: 10px; + MARGIN-LEFT: 13px; + MARGIN-TOP: 0px +} +.issuetitle +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px; + COLOR: #003366; + FONT-WEIGHT: normal +} +.header +{ + BACKGROUND-COLOR: #cecf9c; + BORDER-BOTTOM: #ffffff 1px solid; + BORDER-LEFT: #ffffff 1px solid; + BORDER-RIGHT: #ffffff 1px solid; + BORDER-TOP: #ffffff 1px solid; + COLOR: #000000; + FONT-WEIGHT: bold +} +.issuehdr +{ + BACKGROUND-COLOR: #E0EBF5; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px solid; + COLOR: #000000; + FONT-WEIGHT: normal +} +.issuenone +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: 0px; + BORDER-LEFT: 0px; + BORDER-RIGHT: 0px; + BORDER-TOP: 0px; + COLOR: #000000; + FONT-WEIGHT: normal +} +.content +{ + BACKGROUND-COLOR: #e7e7ce; + BORDER-BOTTOM: #ffffff 1px solid; + BORDER-LEFT: #ffffff 1px solid; + BORDER-RIGHT: #ffffff 1px solid; + BORDER-TOP: #ffffff 1px solid; + PADDING-LEFT: 3px +} +.issuecontent +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px solid; + PADDING-LEFT: 3px +} +A:link +{ + COLOR: #cc6633; + TEXT-DECORATION: underline +} +A:visited +{ + COLOR: #cc6633; +} +A:active +{ + COLOR: #cc6633; +} +A:hover +{ + COLOR: #cc3300; + TEXT-DECORATION: underline +} +H1 +{ + BACKGROUND-COLOR: #003366; + BORDER-BOTTOM: #336699 6px solid; + COLOR: #ffffff; + FONT-SIZE: 130%; + FONT-WEIGHT: normal; + MARGIN: 0em 0em 0em -20px; + PADDING-BOTTOM: 8px; + PADDING-LEFT: 30px; + PADDING-TOP: 16px +} +H2 +{ + COLOR: #000000; + FONT-SIZE: 80%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: 3px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 20px; + PADDING-LEFT: 0px +} +H3 +{ + COLOR: #000000; + FONT-SIZE: 80%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: -5px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 20px +} +H4 +{ + COLOR: #000000; + FONT-SIZE: 70%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: 0px; + MARGIN-TOP: 15px; + PADDING-BOTTOM: 0px +} +UL +{ + COLOR: #000000; + FONT-SIZE: 70%; + LIST-STYLE: square; + MARGIN-BOTTOM: 0pt; + MARGIN-TOP: 0pt +} +OL +{ + COLOR: #000000; + FONT-SIZE: 70%; + LIST-STYLE: square; + MARGIN-BOTTOM: 0pt; + MARGIN-TOP: 0pt +} +LI +{ + LIST-STYLE: square; + MARGIN-LEFT: 0px +} +.expandable +{ + CURSOR: hand +} +.expanded +{ + color: black +} +.collapsed +{ + DISPLAY: none +} +.foot +{ +BACKGROUND-COLOR: #ffffff; +BORDER-BOTTOM: #cecf9c 1px solid; +BORDER-TOP: #cecf9c 2px solid +} +.settings +{ +MARGIN-LEFT: 25PX; +} +.help +{ +TEXT-ALIGN: right; +margin-right: 10px; +} diff --git a/crtanjeOOP/_UpgradeReport_Files/UpgradeReport.xslt b/crtanjeOOP/_UpgradeReport_Files/UpgradeReport.xslt new file mode 100755 index 0000000..ccdfad9 --- /dev/null +++ b/crtanjeOOP/_UpgradeReport_Files/UpgradeReport.xslt @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ Solution: + Project: + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + src + + + + + + + + + + + + +
FilenameStatusErrorsWarnings
+ javascript:document.images[''].click()src + + + + Converted + + + + Converted + +
+ + files + + + 1 file + + + Converted:
+ Not converted +
+
+
+ + + + : + + + + + + + + + Conversion Report + <xsl:if test="Properties/Property[@Name='LogNumber']"> + <xsl:value-of select="Properties/Property[@Name='LogNumber']/@Value"/> + </xsl:if> + + + + +

Conversion Report -

+ +

+ Time of Conversion:
+

+ + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + +
+ Conversion Settings +

+ + +
+
diff --git a/crtanjeOOP/_UpgradeReport_Files/UpgradeReport_Minus.gif b/crtanjeOOP/_UpgradeReport_Files/UpgradeReport_Minus.gif new file mode 100755 index 0000000..17751cb Binary files /dev/null and b/crtanjeOOP/_UpgradeReport_Files/UpgradeReport_Minus.gif differ diff --git a/crtanjeOOP/_UpgradeReport_Files/UpgradeReport_Plus.gif b/crtanjeOOP/_UpgradeReport_Files/UpgradeReport_Plus.gif new file mode 100755 index 0000000..f6009ca Binary files /dev/null and b/crtanjeOOP/_UpgradeReport_Files/UpgradeReport_Plus.gif differ diff --git a/crtanjeOOP/crtanjeOOP.ncb b/crtanjeOOP/crtanjeOOP.ncb new file mode 100755 index 0000000..00374df Binary files /dev/null and b/crtanjeOOP/crtanjeOOP.ncb differ diff --git a/crtanjeOOP/crtanjeOOP.sln b/crtanjeOOP/crtanjeOOP.sln new file mode 100755 index 0000000..edd8f08 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "crtanjeOOP", "crtanjeOOP\crtanjeOOP.vcproj", "{C4425E09-9576-42ED-B986-0337C69BC434}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C4425E09-9576-42ED-B986-0337C69BC434}.Debug|Win32.ActiveCfg = Debug|Win32 + {C4425E09-9576-42ED-B986-0337C69BC434}.Debug|Win32.Build.0 = Debug|Win32 + {C4425E09-9576-42ED-B986-0337C69BC434}.Release|Win32.ActiveCfg = Release|Win32 + {C4425E09-9576-42ED-B986-0337C69BC434}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/crtanjeOOP/crtanjeOOP.sln.old b/crtanjeOOP/crtanjeOOP.sln.old new file mode 100755 index 0000000..d606019 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "crtanjeOOP", "crtanjeOOP\crtanjeOOP.vcproj", "{C4425E09-9576-42ED-B986-0337C69BC434}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {C4425E09-9576-42ED-B986-0337C69BC434}.Debug.ActiveCfg = Debug|Win32 + {C4425E09-9576-42ED-B986-0337C69BC434}.Debug.Build.0 = Debug|Win32 + {C4425E09-9576-42ED-B986-0337C69BC434}.Release.ActiveCfg = Release|Win32 + {C4425E09-9576-42ED-B986-0337C69BC434}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/crtanjeOOP/crtanjeOOP.suo b/crtanjeOOP/crtanjeOOP.suo new file mode 100755 index 0000000..7b30169 Binary files /dev/null and b/crtanjeOOP/crtanjeOOP.suo differ diff --git a/crtanjeOOP/crtanjeOOP.suo.old b/crtanjeOOP/crtanjeOOP.suo.old new file mode 100755 index 0000000..d531af3 Binary files /dev/null and b/crtanjeOOP/crtanjeOOP.suo.old differ diff --git a/crtanjeOOP/crtanjeOOP/ReadMe.txt b/crtanjeOOP/crtanjeOOP/ReadMe.txt new file mode 100755 index 0000000..9a41578 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/ReadMe.txt @@ -0,0 +1,53 @@ +======================================================================== + WIN32 APPLICATION : crtanjeOOP Project Overview +======================================================================== + +AppWizard has created this crtanjeOOP application for you. +This file contains a summary of what you will find in each of the files that +make up your crtanjeOOP application. + + +crtanjeOOP.vcproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +crtanjeOOP.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +AppWizard has created the following resources: + +crtanjeOOP.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. +crtanjeOOP.ico + This is an icon file, which is used as the application's icon (32x32). + This icon is included by the main resource file crtanjeOOP.rc. + +small.ico + This is an icon file, which contains a smaller version (16x16) + of the application's icon. This icon is included by the main resource + file crtanjeOOP.rc. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named crtanjeOOP.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/crtanjeOOP/crtanjeOOP/crtanjeOOP.aps b/crtanjeOOP/crtanjeOOP/crtanjeOOP.aps new file mode 100755 index 0000000..17d6336 Binary files /dev/null and b/crtanjeOOP/crtanjeOOP/crtanjeOOP.aps differ diff --git a/crtanjeOOP/crtanjeOOP/crtanjeOOP.cpp b/crtanjeOOP/crtanjeOOP/crtanjeOOP.cpp new file mode 100755 index 0000000..8712668 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/crtanjeOOP.cpp @@ -0,0 +1,32 @@ +#include "stdafx.h" + +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); + +int APIENTRY _tWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + HACCEL hAccelTable; + + Win::Class wClass((WNDPROC)WndProc, "MainWinClass", hInstance); + wClass.Register(); + + Win::Maker wMaker("MainWinClass", 100, 100, CW_USEDEFAULT, + CW_USEDEFAULT, 0, 0, hInstance); + wMaker.Create("Crtanje", WS_OVERLAPPEDWINDOW); + wMaker.Show(); + + hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_CRTANJEOOP); + + while (GetMessage(&msg, NULL, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + return (int) msg.wParam; +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/crtanjeOOP.h b/crtanjeOOP/crtanjeOOP/crtanjeOOP.h new file mode 100755 index 0000000..e60f2eb --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/crtanjeOOP.h @@ -0,0 +1,3 @@ +#pragma once + +#include "resource.h" diff --git a/crtanjeOOP/crtanjeOOP/crtanjeOOP.ico b/crtanjeOOP/crtanjeOOP/crtanjeOOP.ico new file mode 100755 index 0000000..d551aa3 Binary files /dev/null and b/crtanjeOOP/crtanjeOOP/crtanjeOOP.ico differ diff --git a/crtanjeOOP/crtanjeOOP/crtanjeOOP.rc b/crtanjeOOP/crtanjeOOP/crtanjeOOP.rc new file mode 100755 index 0000000..2a8bb26 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/crtanjeOOP.rc @@ -0,0 +1,174 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_CRTANJEOOP ICON "crtanjeOOP.ico" +IDI_SMALL ICON "small.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_CRTANJEOOP MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END + POPUP "&Brush Size" + BEGIN + MENUITEM "Thi&n", ID_BRUSHSIZE_THIN + MENUITEM "Thic&k", ID_BRUSHSIZE_THICK + MENUITEM "&Custom", ID_BRUSHSIZE_CUSTOM + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_CRTANJEOOP ACCELERATORS +BEGIN + "?", IDM_ABOUT, ASCII, ALT + "/", IDM_ABOUT, ASCII, ALT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG 22, 17, 230, 75 +STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System" +BEGIN + ICON IDI_CRTANJEOOP,IDC_MYICON,14,9,16,16 + LTEXT "crtanjeOOP Version 1.0",IDC_STATIC,49,10,119,8, + SS_NOPREFIX + LTEXT "Copyright (C) 2005",IDC_STATIC,49,20,119,8 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP +END + +IDD_PROPPAGE_SMALL DIALOGEX 0, 0, 120, 62 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_BORDER +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "OK",ID_TBUTTON,34,38,52,17 + EDITTEXT IDC_EDIT_THICKNESS,7,14,106,15,ES_AUTOHSCROLL | + ES_NUMBER + LTEXT "Enter Size (1..500 pt) : ",IDC_STATIC,7,4,79,8 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_PROPPAGE_SMALL, DIALOG + BEGIN + RIGHTMARGIN, 119 + VERTGUIDE, 7 + VERTGUIDE, 34 + VERTGUIDE, 86 + VERTGUIDE, 113 + HORZGUIDE, 55 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_APP_TITLE "crtanjeOOP" + IDC_CRTANJEOOP "CRTANJEOOP" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/crtanjeOOP/crtanjeOOP/crtanjeOOP.vcproj b/crtanjeOOP/crtanjeOOP/crtanjeOOP.vcproj new file mode 100755 index 0000000..37969a8 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/crtanjeOOP.vcproj @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/crtanjeOOP/crtanjeOOP/crtanjeOOP.vcproj.7.10.old b/crtanjeOOP/crtanjeOOP/crtanjeOOP.vcproj.7.10.old new file mode 100755 index 0000000..2d63892 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/crtanjeOOP.vcproj.7.10.old @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/crtanjeOOP/crtanjeOOP/crtanjeOOP.vcproj.VLADAN-E438F675.Administrator.user b/crtanjeOOP/crtanjeOOP/crtanjeOOP.vcproj.VLADAN-E438F675.Administrator.user new file mode 100755 index 0000000..bb8b6a0 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/crtanjeOOP.vcproj.VLADAN-E438F675.Administrator.user @@ -0,0 +1,65 @@ + + + + + + + + + + + diff --git a/crtanjeOOP/crtanjeOOP/customDgl_proc.cpp b/crtanjeOOP/crtanjeOOP/customDgl_proc.cpp new file mode 100755 index 0000000..9c9a48c --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/customDgl_proc.cpp @@ -0,0 +1,39 @@ +#include "stdafx.h" + +using namespace Win; + +LRESULT CALLBACK CustomDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + int nSize; + switch (message) + { + case WM_INITDIALOG: + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == ID_TBUTTON || LOWORD(wParam) == IDCANCEL) + { + char cValue[100]; + GetDlgItemText(hDlg, IDC_EDIT_THICKNESS, cValue, 100); + + if (cValue == "") + nSize = 1; + else + nSize = GetDlgItemInt(hDlg, IDC_EDIT_THICKNESS, NULL, NULL); + + if (nSize > 500) + { + MessageBox(hDlg, "Cannot take value > 500", "Alert!", MB_OK); + SetDlgItemText(hDlg, IDC_EDIT_THICKNESS, ""); + } + else + { + EndDialog(hDlg, nSize); + SetWindowLong(hDlg, DWL_MSGRESULT, static_cast(nSize)); + return TRUE; + } + } + break; + } + return FALSE; +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/dateclock.cpp b/crtanjeOOP/crtanjeOOP/dateclock.cpp new file mode 100755 index 0000000..0521592 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/dateclock.cpp @@ -0,0 +1,14 @@ +#include "stdafx.h" + +using namespace Win; + +char * const CDtClock::ConvertToTxt() const +{ + char* cDateTime = new char[100]; + + sprintf(cDateTime, "Date : %d.%d.%d , Time : %d:%d:%d", + m_sysTime.wDay, m_sysTime.wMonth, m_sysTime.wYear, m_sysTime.wHour, + m_sysTime.wMinute, m_sysTime.wSecond); + + return cDateTime; +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/dateclock.h b/crtanjeOOP/crtanjeOOP/dateclock.h new file mode 100755 index 0000000..f37f849 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/dateclock.h @@ -0,0 +1,23 @@ +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifndef _DATECLOCK_H_98C02EFF_AB0F_48fe_928A_6A4F4E96858B +#define _DATECLOCK_H_98C02EFF_AB0F_48fe_928A_6A4F4E96858B + +namespace Win +{ + class CDtClock + { + public: + CDtClock() : m_sysTime(), m_interval(100) + { GetLocalTime(&m_sysTime); } + char * const ConvertToTxt() const; + int GetInterval() const { return m_interval; } + private: + SYSTEMTIME m_sysTime; + int m_interval; + }; +}; + +#endif \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/dlgbox_proc.cpp b/crtanjeOOP/crtanjeOOP/dlgbox_proc.cpp new file mode 100755 index 0000000..ade8790 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/dlgbox_proc.cpp @@ -0,0 +1,19 @@ +#include "stdafx.h" + +LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + } + break; + } + return FALSE; +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/lndrawer.cpp b/crtanjeOOP/crtanjeOOP/lndrawer.cpp new file mode 100755 index 0000000..7b1c441 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/lndrawer.cpp @@ -0,0 +1,12 @@ +#include "stdafx.h" + +using namespace Win; + +void CLineDrawer::DrawLine(HWND hWnd) const +{ + HDC hdc = GetDC(hWnd); + SelectObject(hdc, m_hPen); + ::MoveToEx(hdc, m_begin.x, m_begin.y, 0); + ::LineTo(hdc, m_end.x, m_end.y); + DeleteObject(m_hPen); +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/lndrawer.h b/crtanjeOOP/crtanjeOOP/lndrawer.h new file mode 100755 index 0000000..37e0dfe --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/lndrawer.h @@ -0,0 +1,32 @@ +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifndef _LNDRAWER_H_9022FC04_7CE7_4e40_8F1E_6A7B7720E390 +#define _LNDRAWER_H_9022FC04_7CE7_4e40_8F1E_6A7B7720E390 + +// klasa za crtanje linii, se inicijalizira PEN so debelina 1 +// vo crna boja , i dvete tocki (pocetnata i krajnata na linijata) +// se inicijaliziraat na 0 + +namespace Win +{ + class CLineDrawer + { + public: + CLineDrawer() : m_hPen(CreatePen(PS_SOLID, 1, RGB(0,0,0))), + m_begin(), m_end() {} + + void DrawLine(HWND hWnd) const; + void SetBegin(LPARAM const lParam) { m_begin = MAKEPOINTS(lParam); } + void SetEnd() { m_end = m_begin; } + void UpdatePen(const HPEN hPen) { m_hPen = hPen; } + + private: + HPEN m_hPen; + POINTS m_begin; + POINTS m_end; + }; +}; + +#endif diff --git a/crtanjeOOP/crtanjeOOP/resource.h b/crtanjeOOP/crtanjeOOP/resource.h new file mode 100755 index 0000000..6297f0e --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/resource.h @@ -0,0 +1,34 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by crtanjeOOP.rc +// +#define IDC_MYICON 2 +#define IDD_CRTANJEOOP_DIALOG 102 +#define IDD_PROPPAGE_SMALL 102 +#define IDS_APP_TITLE 103 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDI_CRTANJEOOP 107 +#define IDI_SMALL 108 +#define IDC_CRTANJEOOP 109 +#define ID_TIMER 110 +#define IDR_MAINFRAME 128 +#define ID_TBUTTON 1001 +#define IDC_EDIT_THICKNESS 1002 +#define ID_BRUSHSIZE_THIN 32771 +#define ID_BRUSHSIZE_THICK 32772 +#define ID_BRUSHSIZE_CUSTOM 32773 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32774 +#define _APS_NEXT_CONTROL_VALUE 1003 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/crtanjeOOP/crtanjeOOP/saveline.cpp b/crtanjeOOP/crtanjeOOP/saveline.cpp new file mode 100755 index 0000000..6c43b06 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/saveline.cpp @@ -0,0 +1,25 @@ +#include "stdafx.h" + +using namespace Win; + +void CSaveLine::SavePoint(POINTS point) +{ + m_pts[m_counter] = point; + ++m_counter; +} + +void CSaveLine::DrawLines(HDC hdc) +{ + ::SelectObject(hdc, m_hpen); + + ::MoveToEx(hdc, m_pts[0].x, m_pts[0].y, NULL); + ::LineTo(hdc, m_pts[0].x, m_pts[0].y); + + for (int i = 1; i < m_counter; ++i) + { + ::MoveToEx(hdc, m_pts[i].x, m_pts[i].y, NULL); + ::LineTo(hdc, m_pts[i].x, m_pts[i].y); + } + + ::DeleteObject(m_hpen); +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/saveline.h b/crtanjeOOP/crtanjeOOP/saveline.h new file mode 100755 index 0000000..85cf96f --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/saveline.h @@ -0,0 +1,26 @@ +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifndef _SAVELINE_H_008F089E_22D5_436f_A8BF_1F425CA40F38 +#define _SAVELINE_H_008F089E_22D5_436f_A8BF_1F425CA40F38 + +namespace Win +{ + class CSaveLine + { + public: + CSaveLine() : m_counter(0), m_pts(), + m_hpen(CreatePen(PS_SOLID, 1, RGB(0,0,0))) {} + + void SavePoint(POINTS); + void DrawLines(HDC); + + private: + int m_counter; + POINTS m_pts[10000]; + HPEN m_hpen; + }; +}; + +#endif \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/screen.cpp b/crtanjeOOP/crtanjeOOP/screen.cpp new file mode 100755 index 0000000..d42c7cd --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/screen.cpp @@ -0,0 +1,88 @@ +#include "stdafx.h" + +using namespace Win; + +RECT CScreen::GetRect() const +{ + RECT rc; + GetClientRect(m_hWnd, &rc); + return rc; +} + +void CScreen::DrawRectangle() const +{ + HDC hdc = GetDC(m_hWnd); + RECT rc = GetRect(); + HBRUSH hBrush = CreateSolidBrush(RGB(200,0,0)); + + SelectObject(hdc, hBrush); + Rectangle(hdc, 110, 17, rc.right, 0); + DeleteObject(hBrush); + ReleaseDC(m_hWnd, hdc); +} + +void CScreen::SetColors() const +{ + HDC hdc = GetDC(m_hWnd); + RECT rc = GetRect(); + + HBRUSH hBrush = CreateSolidBrush(RGB(0, 0, 0)); // crna + SelectObject(hdc, hBrush); + Rectangle(hdc, rc.left + 10, rc.bottom - 50, rc.left + 30, rc.bottom - 10); + DeleteObject(hBrush); + + hBrush = CreateSolidBrush(RGB(255, 0, 0)); // crvena + SelectObject(hdc, hBrush); + Rectangle(hdc, rc.left + 30, rc.bottom - 50, rc.left + 50, rc.bottom - 10); + DeleteObject(hBrush); + + hBrush = CreateSolidBrush(RGB(255, 255, 0)); // zolta + SelectObject(hdc, hBrush); + Rectangle(hdc, rc.left + 50, rc.bottom - 50, rc.left + 70, rc.bottom - 10); + DeleteObject(hBrush); + + hBrush = CreateSolidBrush(RGB(0, 255, 0)); // zelena + SelectObject(hdc, hBrush); + Rectangle(hdc, rc.left + 70, rc.bottom - 50, rc.left + 90, rc.bottom - 10); + DeleteObject(hBrush); + + hBrush = CreateSolidBrush(RGB(0, 0, 255)); // plava + SelectObject(hdc, hBrush); + Rectangle(hdc, rc.left + 90, rc.bottom - 50, rc.left + 110, rc.bottom - 10); + DeleteObject(hBrush); + +// ------------------------------- vtor red ------------------------------------ + + hBrush = CreateSolidBrush(RGB(255, 255, 255)); // bela + SelectObject(hdc, hBrush); + Rectangle(hdc, rc.left + 10, rc.bottom - 30, rc.left + 30, rc.bottom - 10); + DeleteObject(hBrush); + + hBrush = CreateSolidBrush(RGB(255, 0, 255)); // magenta + SelectObject(hdc, hBrush); + Rectangle(hdc, rc.left + 30, rc.bottom - 30, rc.left + 50, rc.bottom - 10); + DeleteObject(hBrush); + + hBrush = CreateSolidBrush(RGB(255, 150, 0)); // portokalova + SelectObject(hdc, hBrush); + Rectangle(hdc, rc.left + 50, rc.bottom - 30, rc.left + 70, rc.bottom - 10); + DeleteObject(hBrush); + + hBrush = CreateSolidBrush(RGB(0, 255, 255)); // tirkizna + SelectObject(hdc, hBrush); + Rectangle(hdc, rc.left + 70, rc.bottom - 30, rc.left + 90, rc.bottom - 10); + DeleteObject(hBrush); + + hBrush = CreateSolidBrush(RGB(150, 0, 255)); // lilana + SelectObject(hdc, hBrush); + Rectangle(hdc, rc.left + 90, rc.bottom - 30, rc.left + 110, rc.bottom - 10); + DeleteObject(hBrush); + + ReleaseDC(m_hWnd, hdc); +} + +void CScreen::SetScreen() const +{ + DrawRectangle(); + SetColors(); +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/screen.h b/crtanjeOOP/crtanjeOOP/screen.h new file mode 100755 index 0000000..2493456 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/screen.h @@ -0,0 +1,23 @@ +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifndef _SCREEN_H_27C0DE4D_C111_4e0f_A133_B73A0B68934C +#define _SCREEN_H_27C0DE4D_C111_4e0f_A133_B73A0B68934C + +namespace Win +{ + class CScreen + { + public: + CScreen(HWND hwnd) : m_hWnd(hwnd) {} + void SetScreen() const; + private: + RECT GetRect() const; + void DrawRectangle() const; + void SetColors() const; + HWND m_hWnd; + }; +}; + +#endif \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/small.ico b/crtanjeOOP/crtanjeOOP/small.ico new file mode 100755 index 0000000..d551aa3 Binary files /dev/null and b/crtanjeOOP/crtanjeOOP/small.ico differ diff --git a/crtanjeOOP/crtanjeOOP/stdafx.cpp b/crtanjeOOP/crtanjeOOP/stdafx.cpp new file mode 100755 index 0000000..0207001 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// crtanjeOOP.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/crtanjeOOP/crtanjeOOP/stdafx.h b/crtanjeOOP/crtanjeOOP/stdafx.h new file mode 100755 index 0000000..c49fb6b --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/stdafx.h @@ -0,0 +1,28 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include +// C RunTime Header Files +#include +#include +#include +#include +#include "stdio.h" +// TODO: reference additional headers your program requires here + +#include "resource.h" +#include "crtanjeOOP.h" +#include "wndclass.h" +#include "wndMaker.h" +#include "lndrawer.h" +#include "wndcontrol.h" +#include "dateclock.h" +#include "screen.h" +#include "saveline.h" diff --git a/crtanjeOOP/crtanjeOOP/timer_proc.cpp b/crtanjeOOP/crtanjeOOP/timer_proc.cpp new file mode 100755 index 0000000..5c00a7c --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/timer_proc.cpp @@ -0,0 +1,24 @@ +#include "stdafx.h" + +using namespace Win; + +VOID CALLBACK TimerProc(HWND hWnd, UINT message, UINT iTimerID, DWORD dwTime) +{ + Win::CDtClock dtClock; + Win::CScreen Scr(hWnd); + char* dt = dtClock.ConvertToTxt(); + RECT rc; + + HDC hdc = GetDC (hWnd); + + Scr.SetScreen(); + + GetClientRect (hWnd, &rc); + SetBkColor(hdc, RGB(200, 0, 0)); + SetTextColor(hdc, RGB(255, 255, 255)); + + int len = static_cast(strlen(dt)); + DrawText(hdc, dt, len, &rc, DT_RIGHT); + + ReleaseDC (hWnd, hdc) ; +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/win_procedure.cpp b/crtanjeOOP/crtanjeOOP/win_procedure.cpp new file mode 100755 index 0000000..819137e --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/win_procedure.cpp @@ -0,0 +1,72 @@ +#include "stdafx.h" + +using namespace Win; + +LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +LRESULT CALLBACK CustomDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + + INT_PTR size; + static Win::CWndCtrl Control(hWnd); + + LONG h_InstL = GetWindowLong(hWnd, GWL_HINSTANCE); + HINSTANCE hInst = reinterpret_cast(h_InstL); + + switch (message) + { + case WM_CREATE: + Control.OnCreate(); + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) + { + case IDM_ABOUT: + DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); + break; + + case ID_BRUSHSIZE_THIN: + Control.UpdatePen(1); + break; + + case ID_BRUSHSIZE_THICK: + Control.UpdatePen(10); + break; + + case ID_BRUSHSIZE_CUSTOM: + size = DialogBox(hInst, (LPCTSTR)IDD_PROPPAGE_SMALL, hWnd, (DLGPROC)CustomDlg); + Control.UpdatePen(static_cast(size)); + break; + + case IDM_EXIT: + DestroyWindow(hWnd); + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + case WM_LBUTTONDOWN: + Control.OnLButtonDown(lParam); + break; + case WM_MOUSEMOVE: + Control.OnMouseMove(lParam); + break; + case WM_LBUTTONUP: + Control.OnLButtonUp(); + break; + case WM_PAINT: + Control.OnPaint(); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} diff --git a/crtanjeOOP/crtanjeOOP/wndMaker.cpp b/crtanjeOOP/crtanjeOOP/wndMaker.cpp new file mode 100755 index 0000000..04a942a --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/wndMaker.cpp @@ -0,0 +1,64 @@ +#include "stdafx.h" + +using namespace Win; + +Maker::Maker(char const * className, + HINSTANCE hInstance) : + + m_hInst(hInstance), + m_ClassName(className), + m_Style(0), + m_x(50), + m_y(50), + m_width(CW_USEDEFAULT), + m_height(CW_USEDEFAULT), + m_pWnd(0), + m_hMenu(0), + m_data(0) +{ +} + +Maker::Maker(char const * className, + int x, int y, int width, int height, + HWND hPwin, + HMENU hMen, + HINSTANCE hInstance) : + + m_hInst(hInstance), + m_ClassName(className), + m_Style(NULL), + m_x(x), + m_y(y), + m_width(width), + m_height(height), + m_pWnd(hPwin), + m_hMenu(hMen), + m_data(NULL) +{ +} + +void Maker::Create(char * Title, DWORD style) +{ + m_hWnd = CreateWindow( + m_ClassName, + Title, + style, + m_x, + m_y, + m_width, + m_height, + m_pWnd, + m_hMenu, + m_hInst, + 0 ); + + if (m_hWnd == 0) + //throw("Internal Error! Creation Failed."); + MessageBox(m_hWnd, "hsdv", "s", MB_OK); +} + +void Maker::Show() +{ + ::ShowWindow(m_hWnd, SW_SHOW); + ::UpdateWindow(m_hWnd); +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/wndMaker.h b/crtanjeOOP/crtanjeOOP/wndMaker.h new file mode 100755 index 0000000..43ef279 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/wndMaker.h @@ -0,0 +1,46 @@ +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifndef _WNDMAKER_H_6C085702_C1FF_4965_9588_D0EE8DCD5FC6 +#define _WNDMAKER_H_6C085702_C1FF_4965_9588_D0EE8DCD5FC6 + +namespace Win +{ + class Maker + { + public: + Maker(char const * className, + HINSTANCE hInst); + Maker(char const * className, + int x, int y, int width, int height, + HWND hPwin, + HMENU hMen, + HINSTANCE hInst); + + void Create(char * Title, DWORD); + void Show(); + + HINSTANCE GetInstance() {return m_hInst;} + HWND GetWndHandle() {return m_hWnd;} + + private : + HINSTANCE m_hInst; + char const* m_ClassName; + DWORD m_Style; + int m_x; + int m_y; + int m_width; + int m_height; + HWND m_pWnd; + HMENU m_hMenu; + void * m_data; + + Maker() : m_hWnd(0) {} + + protected : + HWND m_hWnd; + }; +}; + +#endif \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/wndclass.cpp b/crtanjeOOP/crtanjeOOP/wndclass.cpp new file mode 100755 index 0000000..9747c03 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/wndclass.cpp @@ -0,0 +1,20 @@ +#include "stdafx.h" + +using namespace Win; + +Class::Class(WNDPROC winProc, char const * className, + HINSTANCE hInst) +{ + m_class.cbSize = sizeof(WNDCLASSEX); + m_class.style = CS_HREDRAW | CS_VREDRAW; + m_class.lpfnWndProc = winProc; + m_class.cbClsExtra = 0; + m_class.cbWndExtra = 0; + m_class.hInstance = hInst; + m_class.hIcon = LoadIcon(hInst, (LPCTSTR)IDI_CRTANJEOOP); + m_class.hCursor = LoadCursor(NULL, IDC_ARROW); + m_class.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); + m_class.lpszMenuName = (LPCTSTR)IDC_CRTANJEOOP; + m_class.lpszClassName = className; + m_class.hIconSm = LoadIcon(m_class.hInstance, (LPCTSTR)IDI_SMALL); +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/wndclass.h b/crtanjeOOP/crtanjeOOP/wndclass.h new file mode 100755 index 0000000..add3431 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/wndclass.h @@ -0,0 +1,21 @@ +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifndef _WNDCLASS_6DBD5B8E_C130_4e01_80DD_0ECB5B894D54 +#define _WNDCLASS_6DBD5B8E_C130_4e01_80DD_0ECB5B894D54 + +namespace Win +{ + class Class + { + public : + Class(WNDPROC winProc, char const * className, HINSTANCE hInst); + void Register() { ::RegisterClassEx(& m_class); } + + private : + WNDCLASSEX m_class; + }; +}; + +#endif \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/wndcontrol.cpp b/crtanjeOOP/crtanjeOOP/wndcontrol.cpp new file mode 100755 index 0000000..a881046 --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/wndcontrol.cpp @@ -0,0 +1,125 @@ +#include "stdafx.h" + +using namespace Win; + +VOID CALLBACK TimerProc(HWND, UINT, UINT, DWORD); + +void CWndCtrl::OnCreate() +{ + CDtClock dtClock; + SetTimer(m_hWnd, ID_TIMER, dtClock.GetInterval(), TimerProc) ; +} + +void CWndCtrl::OnLButtonDown(const LPARAM lParam) +{ + POINTS pt = MAKEPOINTS(lParam); + RECT rect; + GetClientRect(m_hWnd, &rect); + if (pt.y >= rect.bottom - 50 && pt.y < rect.bottom - 10 && + pt.x >= rect.left + 10 && pt.x < rect.left + 110) + { + m_ClrRef = GetColor(pt); + UpdatePen(m_ClrRef); + } + else + { + m_pressed = true; + SetCapture(m_hWnd); + m_lnDraw.SetBegin(lParam); + m_lnDraw.SetEnd(); + m_lnDraw.DrawLine(m_hWnd); + } +} + +void CWndCtrl::OnMouseMove(const LPARAM lParam) +{ + DrawMousePos(lParam); + if (m_pressed) + { + m_lnDraw.SetEnd(); + m_lnDraw.SetBegin(lParam); + m_lnDraw.DrawLine(m_hWnd); + } +} + +void CWndCtrl::OnLButtonUp() +{ + m_pressed = false; + ReleaseCapture(); +} + +void CWndCtrl::OnPaint() +{ + PAINTSTRUCT ps; + HDC hdc = BeginPaint(m_hWnd, &ps); + EndPaint(m_hWnd, &ps); +} + +void CWndCtrl::UpdatePen(COLORREF ClrRef) +{ + m_ClrRef = ClrRef; + HPEN hPen = CreatePen(PS_SOLID, m_size, m_ClrRef); + m_lnDraw.UpdatePen(hPen); +} + +void CWndCtrl::UpdatePen(int Size) +{ + m_size = Size; + HPEN hPen = CreatePen(PS_SOLID, m_size, m_ClrRef); + m_lnDraw.UpdatePen(hPen); +} + +void CWndCtrl::DrawMousePos(LPARAM lParam) +{ + POINTS point = MAKEPOINTS(lParam); + char krd[30]; + HBRUSH hBrush = CreateSolidBrush(RGB(0, 0, 0)); + RECT rect; + + HDC hdc = GetDC(m_hWnd); + + GetClientRect(m_hWnd, &rect); + sprintf(krd, "x : %d | y : %d", point.x, point.y); + int len = static_cast(strlen(krd)); + + SelectObject(hdc, hBrush); + Rectangle(hdc, 0, 17, 110, 0); + SetBkColor(hdc, BLACK_BRUSH); + SetTextColor(hdc, RGB(255, 255, 255)); + DrawText(hdc, krd, len, &rect, 0); + DeleteObject(hBrush); + ReleaseDC(m_hWnd, hdc); +} + +COLORREF CWndCtrl::GetColor(POINTS pt) const +{ + RECT rc; + GetClientRect(m_hWnd, &rc); + COLORREF ClrRef = RGB(0, 0, 0); + + if (pt.y >= rc.bottom - 50 && pt.y < rc.bottom - 30) + { + if (pt.x >= rc.left + 30 && pt.x < rc.left + 50) + ClrRef = RGB(255, 0, 0); + else if (pt.x >= rc.left + 50 && pt.x < rc.left + 70) + ClrRef = RGB(255, 255, 0); + else if (pt.x >= rc.left + 70 && pt.x < rc.left + 90) + ClrRef = RGB(0, 255, 0); + else if (pt.x >= rc.left + 90 && pt.x < rc.left + 110) + ClrRef = RGB(0, 0, 255); + } + else if (pt.y >= rc.bottom - 30) + { + if (pt.x >= rc.left + 10 && pt.x < rc.left + 30) + ClrRef = RGB(255, 255, 255); + else if (pt.x >= rc.left + 30 && pt.x < rc.left + 50) + ClrRef = RGB(255, 0, 255); + else if (pt.x >= rc.left + 50 && pt.x < rc.left + 70) + ClrRef = RGB(255, 150, 0); + else if (pt.x >= rc.left + 70 && pt.x < rc.left + 90) + ClrRef = RGB(0, 255, 255); + else if (pt.x >= rc.left + 90 && pt.x < rc.left + 110) + ClrRef = RGB(150, 0, 255); + } + return ClrRef; +} \ No newline at end of file diff --git a/crtanjeOOP/crtanjeOOP/wndcontrol.h b/crtanjeOOP/crtanjeOOP/wndcontrol.h new file mode 100755 index 0000000..68d2f2b --- /dev/null +++ b/crtanjeOOP/crtanjeOOP/wndcontrol.h @@ -0,0 +1,41 @@ +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifndef _WNDCONTROL_H_3895179F_857F_4626_9902_A8A5362317C1 +#define _WNDCONTROL_H_3895179F_857F_4626_9902_A8A5362317C1 + +#include "stdafx.h" + +namespace Win +{ + class CWndCtrl + { + public: + CWndCtrl(HWND hWnd) : m_hWnd(hWnd), m_lnDraw(), /*m_sl(),*/ m_pressed(false), + m_ClrRef(RGB(0,0,0)), m_size(1) {} + + void OnCreate(); + void OnLButtonDown(const LPARAM lParam); + void OnMouseMove(const LPARAM lParam); + void OnLButtonUp(); + void OnPaint(); + void UpdatePen(int); + void UpdatePen(COLORREF); + + private: + COLORREF GetColor(POINTS) const; + void DrawMousePos(LPARAM); + + HWND m_hWnd; + + CLineDrawer m_lnDraw; +// CSaveLine m_sl[10000]; + + bool m_pressed; + COLORREF m_ClrRef; + int m_size; + }; +}; + +#endif \ No newline at end of file