UI.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. #include <TurboBadger/tb_core.h>
  2. #include <TurboBadger/tb_system.h>
  3. #include <TurboBadger/tb_debug.h>
  4. #include <TurboBadger/animation/tb_widget_animation.h>
  5. #include <TurboBadger/renderers/tb_renderer_batcher.h>
  6. #include <TurboBadger/tb_font_renderer.h>
  7. #include <TurboBadger/tb_node_tree.h>
  8. #include <TurboBadger/tb_widgets_reader.h>
  9. #include <TurboBadger/tb_window.h>
  10. #include <TurboBadger/tb_message_window.h>
  11. #include <TurboBadger/tb_editfield.h>
  12. #include <TurboBadger/tb_select.h>
  13. #include <TurboBadger/tb_inline_select.h>
  14. #include <TurboBadger/tb_tab_container.h>
  15. #include <TurboBadger/tb_toggle_container.h>
  16. #include <TurboBadger/tb_scroll_container.h>
  17. #include <TurboBadger/image/tb_image_widget.h>
  18. void register_tbbf_font_renderer();
  19. void register_stb_font_renderer();
  20. void register_freetype_font_renderer();
  21. using namespace tb;
  22. #include "../Core/CoreEvents.h"
  23. #include "../IO/Log.h"
  24. #include "../Input/Input.h"
  25. #include "../Input/InputEvents.h"
  26. #include "../Resource/ResourceCache.h"
  27. #include "../Graphics/Graphics.h"
  28. #include "../Graphics/GraphicsEvents.h"
  29. #include "../Graphics/Texture2D.h"
  30. #include "../Graphics/VertexBuffer.h"
  31. #include "UIEvents.h"
  32. #include "UIRenderer.h"
  33. #include "UI.h"
  34. #include "UIButton.h"
  35. #include "UITextField.h"
  36. #include "UIEditField.h"
  37. #include "UILayout.h"
  38. #include "UIImageWidget.h"
  39. #include "UIClickLabel.h"
  40. #include "UICheckBox.h"
  41. #include "UISelectList.h"
  42. #include "UIMessageWindow.h"
  43. #include "UISkinImage.h"
  44. #include "UITabContainer.h"
  45. #include "UISceneView.h"
  46. #include "UIDragDrop.h"
  47. #include "UIContainer.h"
  48. #include "UISection.h"
  49. #include "UIInlineSelect.h"
  50. #include "UIScrollContainer.h"
  51. #include "UISeparator.h"
  52. #include "UIDimmer.h"
  53. namespace tb
  54. {
  55. void TBSystem::RescheduleTimer(double fire_time)
  56. {
  57. }
  58. }
  59. namespace Atomic
  60. {
  61. WeakPtr<Context> UI::uiContext_;
  62. UI::UI(Context* context) :
  63. Object(context),
  64. rootWidget_(0),
  65. inputDisabled_(false),
  66. keyboardDisabled_(false),
  67. initialized_(false),
  68. skinLoaded_(false)
  69. {
  70. }
  71. UI::~UI()
  72. {
  73. if (initialized_)
  74. {
  75. tb::TBWidgetListener::RemoveGlobalListener(this);
  76. TBFile::SetReaderFunction(0);
  77. TBID::tbidRegisterCallback = 0;
  78. tb::TBWidgetsAnimationManager::Shutdown();
  79. widgetWrap_.Clear();
  80. delete rootWidget_;
  81. // leak
  82. //delete TBUIRenderer::renderer_;
  83. tb_core_shutdown();
  84. }
  85. uiContext_ = 0;
  86. }
  87. void UI::Shutdown()
  88. {
  89. SetInputDisabled(true);
  90. }
  91. void UI::Initialize(const String& languageFile)
  92. {
  93. Graphics* graphics = GetSubsystem<Graphics>();
  94. assert(graphics);
  95. assert(graphics->IsInitialized());
  96. graphics_ = graphics;
  97. vertexBuffer_ = new VertexBuffer(context_);
  98. uiContext_ = context_;
  99. TBFile::SetReaderFunction(TBFileReader);
  100. TBID::tbidRegisterCallback = UI::TBIDRegisterStringCallback;
  101. TBWidgetsAnimationManager::Init();
  102. renderer_ = new UIRenderer(graphics_->GetContext());
  103. tb_core_init(renderer_, languageFile.CString());
  104. //register_tbbf_font_renderer();
  105. //register_stb_font_renderer();
  106. register_freetype_font_renderer();
  107. rootWidget_ = new TBWidget();
  108. int width = graphics_->GetWidth();
  109. int height = graphics_->GetHeight();
  110. rootWidget_->SetSize(width, height);
  111. rootWidget_->SetVisibilility(tb::WIDGET_VISIBILITY_VISIBLE);
  112. // register the UIDragDrop subsystem
  113. context_->RegisterSubsystem(new UIDragDrop(context_));
  114. SubscribeToEvent(E_MOUSEBUTTONDOWN, HANDLER(UI, HandleMouseButtonDown));
  115. SubscribeToEvent(E_MOUSEBUTTONUP, HANDLER(UI, HandleMouseButtonUp));
  116. SubscribeToEvent(E_MOUSEMOVE, HANDLER(UI, HandleMouseMove));
  117. SubscribeToEvent(E_MOUSEWHEEL, HANDLER(UI, HandleMouseWheel));
  118. SubscribeToEvent(E_KEYDOWN, HANDLER(UI, HandleKeyDown));
  119. SubscribeToEvent(E_KEYUP, HANDLER(UI, HandleKeyUp));
  120. SubscribeToEvent(E_TEXTINPUT, HANDLER(UI, HandleTextInput));
  121. SubscribeToEvent(E_UPDATE, HANDLER(UI, HandleUpdate));
  122. SubscribeToEvent(E_RENDERUPDATE, HANDLER(UI, HandleRenderUpdate));
  123. tb::TBWidgetListener::AddGlobalListener(this);
  124. initialized_ = true;
  125. //TB_DEBUG_SETTING(LAYOUT_BOUNDS) = 1;
  126. }
  127. void UI::LoadSkin(const String& skin, const String& overrideSkin)
  128. {
  129. // Load the default skin, and override skin (if any)
  130. tb::g_tb_skin->Load(skin.CString(), overrideSkin.CString());
  131. skinLoaded_ = true;
  132. }
  133. void UI::LoadDefaultPlayerSkin()
  134. {
  135. LoadSkin("DefaultUI/skin/skin.tb.txt");
  136. AddFont("DefaultUI/fonts/vera.ttf", "Vera");
  137. SetDefaultFont("Vera", 12);
  138. }
  139. void UI::SetDefaultFont(const String& name, int size)
  140. {
  141. tb::TBFontDescription fd;
  142. fd.SetID(tb::TBIDC(name.CString()));
  143. fd.SetSize(tb::g_tb_skin->GetDimensionConverter()->DpToPx(12));
  144. tb::g_font_manager->SetDefaultFontDescription(fd);
  145. // Create the font now.
  146. tb::TBFontFace *font = tb::g_font_manager->CreateFontFace(tb::g_font_manager->GetDefaultFontDescription());
  147. // Render some glyphs in one go now since we know we are going to use them. It would work fine
  148. // without this since glyphs are rendered when needed, but with some extra updating of the glyph bitmap.
  149. if (font)
  150. font->RenderGlyphs(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~•·åäöÅÄÖ");
  151. }
  152. void UI::AddFont(const String& fontFile, const String& name)
  153. {
  154. tb::g_font_manager->AddFontInfo(fontFile.CString(), name.CString());
  155. }
  156. void UI::Render(VertexBuffer* buffer, const PODVector<UIBatch>& batches, unsigned batchStart, unsigned batchEnd)
  157. {
  158. if (batches.Empty())
  159. return;
  160. Vector2 invScreenSize(1.0f / (float)graphics_->GetWidth(), 1.0f / (float)graphics_->GetHeight());
  161. Vector2 scale(2.0f * invScreenSize.x_, -2.0f * invScreenSize.y_);
  162. Vector2 offset(-1.0f, 1.0f);
  163. Matrix4 projection(Matrix4::IDENTITY);
  164. projection.m00_ = scale.x_;
  165. projection.m03_ = offset.x_;
  166. projection.m11_ = scale.y_;
  167. projection.m13_ = offset.y_;
  168. projection.m22_ = 1.0f;
  169. projection.m23_ = 0.0f;
  170. projection.m33_ = 1.0f;
  171. graphics_->ClearParameterSources();
  172. graphics_->SetColorWrite(true);
  173. graphics_->SetCullMode(CULL_NONE);
  174. graphics_->SetDepthTest(CMP_ALWAYS);
  175. graphics_->SetDepthWrite(false);
  176. graphics_->SetFillMode(FILL_SOLID);
  177. graphics_->SetStencilTest(false);
  178. graphics_->ResetRenderTargets();
  179. graphics_->SetVertexBuffer(buffer);
  180. ShaderVariation* noTextureVS = graphics_->GetShader(VS, "Basic", "VERTEXCOLOR");
  181. ShaderVariation* diffTextureVS = graphics_->GetShader(VS, "Basic", "DIFFMAP VERTEXCOLOR");
  182. ShaderVariation* noTexturePS = graphics_->GetShader(PS, "Basic", "VERTEXCOLOR");
  183. ShaderVariation* diffTexturePS = graphics_->GetShader(PS, "Basic", "DIFFMAP VERTEXCOLOR");
  184. ShaderVariation* diffMaskTexturePS = graphics_->GetShader(PS, "Basic", "DIFFMAP ALPHAMASK VERTEXCOLOR");
  185. ShaderVariation* alphaTexturePS = graphics_->GetShader(PS, "Basic", "ALPHAMAP VERTEXCOLOR");
  186. unsigned alphaFormat = Graphics::GetAlphaFormat();
  187. for (unsigned i = batchStart; i < batchEnd; ++i)
  188. {
  189. const UIBatch& batch = batches[i];
  190. if (batch.vertexStart_ == batch.vertexEnd_)
  191. continue;
  192. ShaderVariation* ps;
  193. ShaderVariation* vs;
  194. if (!batch.texture_)
  195. {
  196. ps = noTexturePS;
  197. vs = noTextureVS;
  198. }
  199. else
  200. {
  201. // If texture contains only an alpha channel, use alpha shader (for fonts)
  202. vs = diffTextureVS;
  203. if (batch.texture_->GetFormat() == alphaFormat)
  204. ps = alphaTexturePS;
  205. else if (batch.blendMode_ != BLEND_ALPHA && batch.blendMode_ != BLEND_ADDALPHA && batch.blendMode_ != BLEND_PREMULALPHA)
  206. ps = diffMaskTexturePS;
  207. else
  208. ps = diffTexturePS;
  209. }
  210. graphics_->SetShaders(vs, ps);
  211. if (graphics_->NeedParameterUpdate(SP_OBJECT, this))
  212. graphics_->SetShaderParameter(VSP_MODEL, Matrix3x4::IDENTITY);
  213. if (graphics_->NeedParameterUpdate(SP_CAMERA, this))
  214. graphics_->SetShaderParameter(VSP_VIEWPROJ, projection);
  215. if (graphics_->NeedParameterUpdate(SP_MATERIAL, this))
  216. graphics_->SetShaderParameter(PSP_MATDIFFCOLOR, Color(1.0f, 1.0f, 1.0f, 1.0f));
  217. graphics_->SetBlendMode(batch.blendMode_);
  218. graphics_->SetScissorTest(true, batch.scissor_);
  219. graphics_->SetTexture(0, batch.texture_);
  220. graphics_->Draw(TRIANGLE_LIST, batch.vertexStart_ / UI_VERTEX_SIZE, (batch.vertexEnd_ - batch.vertexStart_) /
  221. UI_VERTEX_SIZE);
  222. }
  223. }
  224. void UI::SetVertexData(VertexBuffer* dest, const PODVector<float>& vertexData)
  225. {
  226. if (vertexData.Empty())
  227. return;
  228. // Update quad geometry into the vertex buffer
  229. // Resize the vertex buffer first if too small or much too large
  230. unsigned numVertices = vertexData.Size() / UI_VERTEX_SIZE;
  231. if (dest->GetVertexCount() < numVertices || dest->GetVertexCount() > numVertices * 2)
  232. dest->SetSize(numVertices, MASK_POSITION | MASK_COLOR | MASK_TEXCOORD1, true);
  233. dest->SetData(&vertexData[0]);
  234. }
  235. void UI::Render(bool resetRenderTargets)
  236. {
  237. SetVertexData(vertexBuffer_, vertexData_);
  238. Render(vertexBuffer_, batches_, 0, batches_.Size());
  239. }
  240. void UI::HandleRenderUpdate(StringHash eventType, VariantMap& eventData)
  241. {
  242. // Get rendering batches from the non-modal UI elements
  243. batches_.Clear();
  244. vertexData_.Clear();
  245. tb::TBRect rect = rootWidget_->GetRect();
  246. IntRect currentScissor = IntRect(0, 0, rect.w, rect.h);
  247. GetBatches(batches_, vertexData_, currentScissor);
  248. }
  249. void UI::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor)
  250. {
  251. //if (!initialized_)
  252. // return;
  253. TBAnimationManager::Update();
  254. rootWidget_->InvokeProcessStates();
  255. rootWidget_->InvokeProcess();
  256. tb::g_renderer->BeginPaint(rootWidget_->GetRect().w, rootWidget_->GetRect().h);
  257. renderer_->currentScissor_ = currentScissor;
  258. renderer_->batches_ = &batches;
  259. renderer_->vertexData_ = &vertexData;
  260. rootWidget_->InvokePaint(tb::TBWidget::PaintProps());
  261. tb::g_renderer->EndPaint();
  262. }
  263. void UI::SubmitBatchVertexData(Texture* texture, const PODVector<float>& vertexData)
  264. {
  265. UIBatch b(BLEND_ALPHA , renderer_->currentScissor_, texture, &vertexData_);
  266. unsigned begin = b.vertexData_->Size();
  267. b.vertexData_->Resize(begin + vertexData.Size());
  268. float* dest = &(b.vertexData_->At(begin));
  269. b.vertexEnd_ = b.vertexData_->Size();
  270. for (unsigned i = 0; i < vertexData.Size(); i++, dest++)
  271. {
  272. *dest = vertexData[i];
  273. }
  274. UIBatch::AddOrMerge(b, batches_);
  275. }
  276. void UI::TBFileReader(const char* filename, void** data, unsigned* length)
  277. {
  278. *data = 0;
  279. *length = 0;
  280. ResourceCache* cache = uiContext_->GetSubsystem<ResourceCache>();
  281. SharedPtr<File> file = cache->GetFile(filename);
  282. if (!file || !file->IsOpen())
  283. {
  284. LOGERRORF("UI::TBFileReader: Unable to load file: %s", filename);
  285. return;
  286. }
  287. unsigned size = file->GetSize();
  288. if (!size)
  289. return;
  290. void* _data = malloc(size);
  291. if (!_data)
  292. return;
  293. if (file->Read(_data, size) != size)
  294. {
  295. free(_data);
  296. return;
  297. }
  298. *length = size;
  299. *data = _data;
  300. }
  301. void UI::GetTBIDString(unsigned id, String& value)
  302. {
  303. if (!id)
  304. {
  305. value = "";
  306. }
  307. else
  308. {
  309. value = tbidToString_[id];
  310. }
  311. }
  312. void UI::TBIDRegisterStringCallback(unsigned id, const char* value)
  313. {
  314. uiContext_->GetSubsystem<UI>()->tbidToString_[id] = String(value);
  315. }
  316. bool UI::LoadResourceFile(TBWidget* widget, const String& filename)
  317. {
  318. tb::TBNode node;
  319. if (!node.ReadFile(filename.CString()))
  320. return false;
  321. tb::g_widgets_reader->LoadNodeTree(widget, &node);
  322. return true;
  323. }
  324. void UI::HandleScreenMode(StringHash eventType, VariantMap& eventData)
  325. {
  326. using namespace ScreenMode;
  327. rootWidget_->SetSize(eventData[P_WIDTH].GetInt(), eventData[P_HEIGHT].GetInt());
  328. //SetSize(eventData[P_WIDTH].GetInt(), eventData[P_HEIGHT].GetInt());
  329. }
  330. void UI::HandleUpdate(StringHash eventType, VariantMap& eventData)
  331. {
  332. TBMessageHandler::ProcessMessages();
  333. }
  334. bool UI::IsWidgetWrapped(tb::TBWidget* widget)
  335. {
  336. return widgetWrap_.Contains(widget);
  337. }
  338. bool UI::UnwrapWidget(tb::TBWidget* widget)
  339. {
  340. if (widgetWrap_.Contains(widget))
  341. {
  342. widgetWrap_.Erase(widget);
  343. return true;
  344. }
  345. return false;
  346. }
  347. void UI::PruneUnreachableWidgets()
  348. {
  349. HashMap<tb::TBWidget*, SharedPtr<UIWidget>>::Iterator itr;
  350. for (itr = widgetWrap_.Begin(); itr != widgetWrap_.End(); )
  351. {
  352. if ((*itr).first_->GetParent() || (*itr).second_->JSGetHeapPtr())
  353. {
  354. itr++;
  355. continue;
  356. }
  357. tb::TBWidget* toDelete = (*itr).first_;
  358. itr.GotoNext();
  359. delete toDelete;
  360. // this will likely be flagged by valgrind as accessing invalid memory
  361. assert(!widgetWrap_.Contains(toDelete));
  362. }
  363. }
  364. void UI::WrapWidget(UIWidget* widget, tb::TBWidget* tbwidget)
  365. {
  366. assert (!widgetWrap_.Contains(tbwidget));
  367. widgetWrap_[tbwidget] = widget;
  368. }
  369. UIWidget* UI::WrapWidget(tb::TBWidget* widget)
  370. {
  371. if (!widget)
  372. return NULL;
  373. if (widgetWrap_.Contains(widget))
  374. return widgetWrap_[widget];
  375. // switch this to use a factory?
  376. // this is order dependent as we're using IsOfType which also works if a base class
  377. if (widget->IsOfType<TBDimmer>())
  378. {
  379. UIDimmer* dimmer = new UIDimmer(context_, false);
  380. dimmer->SetWidget(widget);
  381. widgetWrap_[widget] = dimmer;
  382. return dimmer;
  383. }
  384. if (widget->IsOfType<TBScrollContainer>())
  385. {
  386. UIScrollContainer* container = new UIScrollContainer(context_, false);
  387. container->SetWidget(widget);
  388. widgetWrap_[widget] = container;
  389. return container;
  390. }
  391. if (widget->IsOfType<TBInlineSelect>())
  392. {
  393. UIInlineSelect* select = new UIInlineSelect(context_, false);
  394. select->SetWidget(widget);
  395. widgetWrap_[widget] = select;
  396. return select;
  397. }
  398. if (widget->IsOfType<TBSection>())
  399. {
  400. UISection* section = new UISection(context_, false);
  401. section->SetWidget(widget);
  402. widgetWrap_[widget] = section;
  403. return section;
  404. }
  405. if (widget->IsOfType<TBSeparator>())
  406. {
  407. UISeparator* sep = new UISeparator(context_, false);
  408. sep->SetWidget(widget);
  409. widgetWrap_[widget] = sep;
  410. return sep;
  411. }
  412. if (widget->IsOfType<TBContainer>())
  413. {
  414. UIContainer* container = new UIContainer(context_, false);
  415. container->SetWidget(widget);
  416. widgetWrap_[widget] = container;
  417. return container;
  418. }
  419. if (widget->IsOfType<TBButton>())
  420. {
  421. // don't wrap the close button of a TBWindow.close
  422. if (widget->GetID() == TBIDC("TBWindow.close"))
  423. return 0;
  424. UIButton* button = new UIButton(context_, false);
  425. button->SetWidget(widget);
  426. widgetWrap_[widget] = button;
  427. return button;
  428. }
  429. if (widget->IsOfType<TBTextField>())
  430. {
  431. UITextField* textfield = new UITextField(context_, false);
  432. textfield->SetWidget(widget);
  433. widgetWrap_[widget] = textfield;
  434. return textfield;
  435. }
  436. if (widget->IsOfType<TBEditField>())
  437. {
  438. UIEditField* editfield = new UIEditField(context_, false);
  439. editfield->SetWidget(widget);
  440. widgetWrap_[widget] = editfield;
  441. return editfield;
  442. }
  443. if (widget->IsOfType<TBSkinImage>())
  444. {
  445. UISkinImage* skinimage = new UISkinImage(context_, "", false);
  446. skinimage->SetWidget(widget);
  447. widgetWrap_[widget] = skinimage;
  448. return skinimage;
  449. }
  450. if (widget->IsOfType<TBImageWidget>())
  451. {
  452. UIImageWidget* imagewidget = new UIImageWidget(context_, false);
  453. imagewidget->SetWidget(widget);
  454. widgetWrap_[widget] = imagewidget;
  455. return imagewidget;
  456. }
  457. if (widget->IsOfType<TBClickLabel>())
  458. {
  459. UIClickLabel* nwidget = new UIClickLabel(context_, false);
  460. nwidget->SetWidget(widget);
  461. widgetWrap_[widget] = nwidget;
  462. return nwidget;
  463. }
  464. if (widget->IsOfType<TBCheckBox>())
  465. {
  466. UICheckBox* nwidget = new UICheckBox(context_, false);
  467. nwidget->SetWidget(widget);
  468. widgetWrap_[widget] = nwidget;
  469. return nwidget;
  470. }
  471. if (widget->IsOfType<TBSelectList>())
  472. {
  473. UISelectList* nwidget = new UISelectList(context_, false);
  474. nwidget->SetWidget(widget);
  475. widgetWrap_[widget] = nwidget;
  476. return nwidget;
  477. }
  478. if (widget->IsOfType<TBMessageWindow>())
  479. {
  480. UIMessageWindow* nwidget = new UIMessageWindow(context_, NULL, "", false);
  481. nwidget->SetWidget(widget);
  482. widgetWrap_[widget] = nwidget;
  483. return nwidget;
  484. }
  485. if (widget->IsOfType<TBTabContainer>())
  486. {
  487. UITabContainer* nwidget = new UITabContainer(context_, false);
  488. nwidget->SetWidget(widget);
  489. widgetWrap_[widget] = nwidget;
  490. return nwidget;
  491. }
  492. if (widget->IsOfType<SceneViewWidget>())
  493. {
  494. UISceneView* nwidget = new UISceneView(context_, false);
  495. nwidget->SetWidget(widget);
  496. widgetWrap_[widget] = nwidget;
  497. return nwidget;
  498. }
  499. if (widget->IsOfType<TBLayout>())
  500. {
  501. UILayout* layout = new UILayout(context_, (UI_AXIS) widget->GetAxis(), false);
  502. layout->SetWidget(widget);
  503. widgetWrap_[widget] = layout;
  504. return layout;
  505. }
  506. if (widget->IsOfType<TBWidget>())
  507. {
  508. UIWidget* nwidget = new UIWidget(context_, false);
  509. nwidget->SetWidget(widget);
  510. widgetWrap_[widget] = nwidget;
  511. return nwidget;
  512. }
  513. return 0;
  514. }
  515. void UI::OnWidgetDelete(tb::TBWidget *widget)
  516. {
  517. }
  518. bool UI::OnWidgetDying(tb::TBWidget *widget)
  519. {
  520. return false;
  521. }
  522. }