MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OnPaint

Method OnPaint

src/toolbar_gui.cpp:1997–2010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1995 }
1996
1997 void OnPaint() override
1998 {
1999 /* If spectator, disable all construction buttons
2000 * ie : Build road, rail, ships, airports and landscaping
2001 * Since enabled state is the default, just disable when needed */
2002 this->SetWidgetsDisabledState(_local_company == COMPANY_SPECTATOR, WID_TN_RAILS, WID_TN_ROADS, WID_TN_TRAMS, WID_TN_WATER, WID_TN_AIR, WID_TN_LANDSCAPE);
2003 /* disable company list drop downs, if there are no companies */
2004 this->SetWidgetsDisabledState(Company::GetNumItems() == 0, WID_TN_STATIONS, WID_TN_FINANCES, WID_TN_TRAINS, WID_TN_ROADVEHS, WID_TN_SHIPS, WID_TN_AIRCRAFT);
2005
2006 this->SetWidgetDisabledState(WID_TN_GOAL, Goal::GetNumItems() == 0);
2007 this->SetWidgetDisabledState(WID_TN_STORY, StoryPage::GetNumItems() == 0);
2008
2009 this->DrawWidgets();
2010 }
2011
2012 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
2013 {

Callers

nothing calls this directly

Calls 3

DrawWidgetsMethod · 0.80

Tested by

no test coverage detected