Skip to content

Commit

Permalink
Merge pull request #28 from nikodemak/master
Browse files Browse the repository at this point in the history
help menu rework
  • Loading branch information
BackTrak committed Nov 3, 2017
2 parents 785f18c + 2b06e0a commit 736a9e1
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
29 changes: 25 additions & 4 deletions src/effect/help.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "pch.h"

//////////////////////////////////////////////////////////////////////////////
//
// Help
Expand Down Expand Up @@ -60,6 +59,8 @@ class HelpPaneImpl :
TRef<INameSpace> m_pns;
TRef<ButtonPane> m_pbuttonBack;
TRef<ButtonPane> m_pbuttonClose;
TRef<ButtonPane> m_pbuttonDiscord;
TRef<ButtonPane> m_pbuttonWiki;
TRef<PagePane> m_ppageMain;
TRef<PagePane> m_ppageSecondary;
TRef<NavPane> m_pnavPane;
Expand Down Expand Up @@ -106,8 +107,12 @@ class HelpPaneImpl :
// mdvalley: OnButtonBack now pointered and with class named.
AddEventTarget(&HelpPaneImpl::OnButtonBack, m_pbuttonBack->GetEventSource());

CastTo(m_pbuttonClose, m_pns->FindMember("closeButton"));

CastTo(m_pbuttonClose, m_pns->FindMember("closeButton"));
CastTo(m_pbuttonDiscord, m_pns->FindMember("DiscordButton"));
AddEventTarget(&HelpPaneImpl::OnButtonDiscord, m_pbuttonDiscord->GetEventSource());
CastTo(m_pbuttonWiki, m_pns->FindMember("WikiButton"));
AddEventTarget(&HelpPaneImpl::OnButtonWiki, m_pbuttonWiki->GetEventSource());
//
// Default attributes
//
Expand Down Expand Up @@ -194,7 +199,10 @@ class HelpPaneImpl :
// Implementation methods
//
//////////////////////////////////////////////////////////////////////////////

void ShowWebPage(const char* szURL)
{
ShellExecute(NULL, NULL, szURL, NULL, NULL, SW_SHOWNORMAL);
}
void DoSetTopic()
{
const ZString& str = m_listHistory.GetFront();
Expand All @@ -211,7 +219,6 @@ class HelpPaneImpl :
// Events
//
//////////////////////////////////////////////////////////////////////////////

bool OnButtonBack()
{
if (m_listHistory.GetCount() > 1) {
Expand All @@ -229,6 +236,20 @@ class HelpPaneImpl :
}
return true;
}
bool OnButtonDiscord()
{

ShowWebPage("https://discord.gg/WcEJ9VH");
int Getwindow();
return true;
}
bool OnButtonWiki()
{

ShowWebPage("http://www.freeallegiance.org/FAW/index.php/Quick_Crash_Course");
int Getwindow();
return true;
}

bool OnSecondaryTopic(const ZString& str)
{
Expand Down
26 changes: 24 additions & 2 deletions src/effect/mmlpopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class MMLPopup :
TRef<Pane> m_ppane;
TRef<INameSpace> m_pns;
TRef<ButtonPane> m_pbuttonClose;
TRef<ButtonPane> m_pbuttonDiscord;
TRef<ButtonPane> m_pbuttonWiki;
TRef<PagePane> m_ppageMain;
TRef<ScrollPane> m_pscrollMain;

Expand Down Expand Up @@ -50,7 +52,10 @@ class MMLPopup :
CastTo(m_pbuttonClose, m_pns->FindMember("closeButton"));
// mdvalley: OnButtonClose now needs to be pointer and with class spelled out in 2005.
AddEventTarget(&MMLPopup::OnButtonClose, m_pbuttonClose->GetEventSource());

CastTo(m_pbuttonDiscord, m_pns->FindMember("DiscordButton"));
AddEventTarget(&MMLPopup::OnButtonDiscord, m_pbuttonDiscord->GetEventSource());
CastTo(m_pbuttonWiki, m_pns->FindMember("WikiButton"));
AddEventTarget(&MMLPopup::OnButtonWiki, m_pbuttonWiki->GetEventSource());
//
// Default attributes
//
Expand Down Expand Up @@ -108,12 +113,29 @@ class MMLPopup :
// Events
//
//////////////////////////////////////////////////////////////////////////////

void ShowWebPage(const char* szURL)
{
ShellExecute(NULL, NULL, szURL, NULL, NULL, SW_SHOWNORMAL);
}
bool OnButtonClose()
{
Close();
return true;
}
bool OnButtonDiscord()
{

ShowWebPage("https://discord.gg/WcEJ9VH");
int GetWindow();
return true;
}
bool OnButtonWiki()
{

ShowWebPage("http://www.freeallegiance.org/FAW/index.php/Quick_Crash_Course");
int GetWindow();
return true;
}

void Close()
{
Expand Down

0 comments on commit 736a9e1

Please sign in to comment.