File tree Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1010 *****************************************************************************/
1111
1212#include " StdInc.h"
13+ #include " CNewsBrowser.h"
1314#include < game/CGame.h>
1415#include < windowsx.h>
1516
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ class CLocalGUI;
2929#include " CSetCursorPosHook.h"
3030#include " CSingleton.h"
3131#include " CVersionUpdater.h"
32- #include " CNewsBrowser.h"
3332
3433#include < windows.h>
3534
Original file line number Diff line number Diff line change @@ -167,9 +167,14 @@ void CNewsBrowser::CreateGUI()
167167 m_pButtonOK->SetPosition (CVector2D (560 .0f - 60 , 480 .0f - 30 ));
168168 m_pButtonOK->SetZOrderingEnabled (false );
169169
170+ m_pButtonNewsLink = reinterpret_cast <CGUIButton*>(pManager->CreateButton (m_pWindow, _ (" Visit mtasa.com/news" )));
171+ m_pButtonNewsLink->SetPosition (CVector2D (560 .0f - 200 , 480 .0f - 30 ));
172+ m_pButtonNewsLink->SetZOrderingEnabled (false );
173+
170174 // Set up the events
171175 m_pWindow->SetEnterKeyHandler (GUI_CALLBACK (&CNewsBrowser::OnOKButtonClick, this ));
172176 m_pButtonOK->SetClickHandler (GUI_CALLBACK (&CNewsBrowser::OnOKButtonClick, this ));
177+ m_pButtonNewsLink->SetClickHandler (GUI_CALLBACK (&CNewsBrowser::OnNewsLinkButtonClick, this ));
173178
174179 // Create the tab panel and necessary tabs
175180 m_pTabPanel = reinterpret_cast <CGUITabPanel*>(pManager->CreateTabPanel (m_pWindow));
@@ -375,3 +380,13 @@ bool CNewsBrowser::OnOKButtonClick(CGUIElement* pElement)
375380 m_pWindow->SetVisible (false );
376381 return true ;
377382}
383+
384+ bool CNewsBrowser::OnNewsLinkButtonClick (CGUIElement* pElement)
385+ {
386+ // Visit the website
387+ ShellExecuteNonBlocking (" open" , " https://mtasa.com/news" );
388+
389+ // Close the window
390+ m_pWindow->SetVisible (false );
391+ return true ;
392+ }
Original file line number Diff line number Diff line change @@ -39,11 +39,13 @@ class CNewsBrowser
3939 void CreateGUI ();
4040 void DestroyGUI ();
4141 bool OnOKButtonClick (CGUIElement* pElement);
42+ bool OnNewsLinkButtonClick (CGUIElement* pElement);
4243
4344 std::vector<SNewsItem> m_NewsitemList;
4445 CGUIWindow* m_pWindow;
4546 CGUITabPanel* m_pTabPanel;
4647 CGUIButton* m_pButtonOK;
48+ CGUIButton* m_pButtonNewsLink;
4749 std::vector<CGUITab*> m_TabList;
4850 std::vector<CGUIWindow*> m_TabContentList;
4951};
You can’t perform that action at this time.
0 commit comments