Skip to content

Commit

Permalink
Added more unmanaged code (Added component render base structure)
Browse files Browse the repository at this point in the history
Fixed #11
  • Loading branch information
Anis Errais committed Feb 11, 2021
1 parent 9fe26ad commit 9608c40
Show file tree
Hide file tree
Showing 13 changed files with 211 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "BaseComponentRenderer.h"
23 changes: 23 additions & 0 deletions SimpleClassicThemeTaskbar.UnmanagedCode/BaseComponentRenderer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include "UIComponents.h"

#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment (lib,"Gdiplus.lib")

namespace SimpleClassicThemeTaskbar
{
namespace Unmanaged
{
class ComponentRenderer
{
virtual void Initialize() abstract;
virtual void DrawStartButton(StartWindow window) abstract;
virtual void DrawTaskbar(Taskbar taskbar) abstract;
virtual void DrawTaskList(TaskListWindow window) abstract;
virtual void Destroy() abstract;
};
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "ClassicComponentRenderer.h"

namespace SimpleClassicThemeTaskbar
{
namespace Unmanaged
{
void ClassicComponentRenderer::Initialize()
{

}

void ClassicComponentRenderer::DrawStartButton(StartWindow window)
{

}

void ClassicComponentRenderer::DrawTaskbar(Taskbar taskbar)
{
HDC hdc;
RECT rc;

hdc = GetDC(taskbar.WindowHandle);
GetClientRect(taskbar.WindowHandle, &rc);
// Paint line
Graphics graphics(hdc);
Pen pen(Color(GetSysColor(COLOR_BTNHIGHLIGHT) + 0xFF000000));
graphics.DrawLine(&pen, 0, 1, 1280, 1);

SwapBuffers(hdc);
ReleaseDC(taskbar.WindowHandle, hdc);
}

void ClassicComponentRenderer::DrawTaskList(TaskListWindow window)
{

}

void ClassicComponentRenderer::Destroy()
{

}
}
}
19 changes: 19 additions & 0 deletions SimpleClassicThemeTaskbar.UnmanagedCode/ClassicComponentRenderer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include "BaseComponentRenderer.h"

namespace SimpleClassicThemeTaskbar
{
namespace Unmanaged
{
class ClassicComponentRenderer : ComponentRenderer
{
void Initialize();
void DrawStartButton(StartWindow window);
void DrawTaskbar(Taskbar taskbar);
void DrawTaskList(TaskListWindow window);
void Destroy();
};
}
}

This file was deleted.

16 changes: 0 additions & 16 deletions SimpleClassicThemeTaskbar.UnmanagedCode/ComponentRenderer.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@
<ClCompile Include="BackgroundThread.cpp" />
<ClCompile Include="BaseWindow.cpp" />
<ClCompile Include="ButtonWindow.cpp" />
<ClCompile Include="ComponentRenderer.cpp" />
<ClCompile Include="BaseComponentRenderer.cpp" />
<ClCompile Include="ClassicComponentRenderer.cpp" />
<ClCompile Include="StartWindow.cpp" />
<ClCompile Include="Taskbar.cpp" />
<ClCompile Include="TaskListWindow.cpp" />
Expand All @@ -156,15 +157,21 @@
<ClInclude Include="BackgroundThread.h" />
<ClInclude Include="BaseWindow.h" />
<ClInclude Include="ButtonWindow.h" />
<ClInclude Include="ComponentRenderer.h" />
<ClInclude Include="BaseComponentRenderer.h" />
<ClInclude Include="ClassicComponentRenderer.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="resource1.h" />
<ClInclude Include="StartWindow.h" />
<ClInclude Include="Taskbar.h" />
<ClInclude Include="TaskListWindow.h" />
<ClInclude Include="UIComponents.h" />
<ClInclude Include="UnmanagedCode.h" />
<ClInclude Include="ProcessData.h" />
<ClInclude Include="Win32Window.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="SimpleClassicThemeTaskbar.UnmanagedCode1.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<Filter Include="Header Files\UI Components">
<UniqueIdentifier>{93042088-0ce7-4c50-b2e6-6234a6550c27}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Renderers">
<UniqueIdentifier>{98040295-b12a-43c7-97d5-53888d6f2d5a}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Renderers">
<UniqueIdentifier>{2d019d15-e1a4-49d7-93e7-718e0270956a}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="UnmanagedCode.cpp">
Expand Down Expand Up @@ -48,8 +54,11 @@
<ClCompile Include="Win32Window.cpp">
<Filter>Source Files\UI Components</Filter>
</ClCompile>
<ClCompile Include="ComponentRenderer.cpp">
<Filter>Source Files</Filter>
<ClCompile Include="BaseComponentRenderer.cpp">
<Filter>Source Files\Renderers</Filter>
</ClCompile>
<ClCompile Include="ClassicComponentRenderer.cpp">
<Filter>Source Files\Renderers</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -86,8 +95,22 @@
<ClInclude Include="Win32Window.h">
<Filter>Header Files\UI Components</Filter>
</ClInclude>
<ClInclude Include="ComponentRenderer.h">
<ClInclude Include="resource1.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UIComponents.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BaseComponentRenderer.h">
<Filter>Header Files\Renderers</Filter>
</ClInclude>
<ClInclude Include="ClassicComponentRenderer.h">
<Filter>Header Files\Renderers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="SimpleClassicThemeTaskbar.UnmanagedCode1.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Microsoft Visual C++ generated resource script.
//

#include "resource1.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 19, 1

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource1.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END

3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END

#endif // APSTUDIO_INVOKED

#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
10 changes: 10 additions & 0 deletions SimpleClassicThemeTaskbar.UnmanagedCode/UIComponents.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

#include "ApplicationWindow.h"
#include "BaseWindow.h"
#include "ButtonWindow.h"
#include "StartWindow.h"
#include "TaskListWindow.h"
#include "Win32Window.h"

#include "Taskbar.h"
14 changes: 14 additions & 0 deletions SimpleClassicThemeTaskbar.UnmanagedCode/resource1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by SimpleClassicThemeTaskbar.UnmanagedCode1.rc

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
1 change: 1 addition & 0 deletions SimpleClassicThemeTaskbar/ApplicationEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ static List<IntPtr> EnumerateProcessWindowHandles(int processId, string name)
return;
#endif
}
//Application.EnableVisualStyles();
Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled;
Application.SetCompatibleTextRenderingDefault(false);
Microsoft.Win32.SystemEvents.DisplaySettingsChanged += delegate
Expand Down
5 changes: 5 additions & 0 deletions SimpleClassicThemeTaskbar/Forms/Taskbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ private void timerUpdateUI_Tick(object sender, EventArgs e)
//Check if the foreground window was the start menu
startButton1.UpdateState(wnd);

//Put left side controls in the correct place
startButton1.Location = new Point(2, 4);
startButtonPanel.Width = startButton1.Width + 2;
quickLaunch1.Location = new Point(startButton1.Location.X + startButton1.Width + 2, 1);

//Calculate availabe space in taskbar and then divide that space over all programs
int startX = quickLaunch1.Location.X + quickLaunch1.Width + 4;
int programWidth = Primary ? Config.TaskbarProgramWidth + Config.SpaceBetweenTaskbarIcons : 24;
Expand Down

0 comments on commit 9608c40

Please sign in to comment.