Planeshift
pawstabwindow.h
Go to the documentation of this file.
1 /*
2 * pawstabwindow.h - Author: Andrew Dai
3 *
4 * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5 *
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation (version 2 of the License)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 */
19 #ifndef PAWS_TAB_WINDOW
20 #define PAWS_TAB_WINDOW
21 
22 #include "pawswidget.h"
23 #include "pawsbutton.h"
24 
33 class pawsTabWindow : public pawsWidget
34 {
35 public:
37  {
38  factory = "pawsTabWindow";
39  }
40  pawsTabWindow(const pawsTabWindow &origin);
41  virtual bool PostSetup();
42 
43  virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
44 
45  void SetTab(int id);
46  void SetTab(const csString &name);
47 
49  {
50  return activeTab;
51  }
52 
53  bool FlashButtonFor(pawsWidget* widget)
54  {
55  if(!widget->IsVisible())
56  {
57  pawsButton* button = dynamic_cast<pawsButton*>(FindWidget(widget->GetID() - 100));
58  if(!button)
59  return false;
60  button->Flash(true, FLASH_HIGHLIGHT);
61  return true;
62  }
63  return false;
64  }
65 
66 protected:
69 
70 };
71 
73 
76 #endif
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
pawsButton * lastButton
Definition: pawstabwindow.h:68
pawsWidget * FindWidget(const char *name, bool complain=true)
Find a child widget of this widget.
virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is pressed.
void SetTab(int id)
csString name
The name of this widget.
Definition: pawswidget.h:217
pawsWidget * GetActiveTab()
Definition: pawstabwindow.h:48
pawsWidget * activeTab
Definition: pawstabwindow.h:67
csString factory
factory name
Definition: pawswidget.h:124
bool FlashButtonFor(pawsWidget *widget)
Definition: pawstabwindow.h:53
virtual void Flash(bool state, FLASH_STATE type=FLASH_REGULAR)
Definition: pawsbutton.h:96
CREATE_PAWS_FACTORY(pawsTabWindow)
A simple button widget.
Definition: pawsbutton.h:43
int GetID()
Gets the id of a widget.
Definition: pawswidget.h:1265
This window is supposed to be a generic widget for using tabs to show and hide subwindows automatical...
Definition: pawstabwindow.h:33
bool IsVisible()
Is the widget currently set visible?
Definition: pawswidget.h:426
virtual bool PostSetup()
This is called after the widget and all of it&#39;s children have been created.