Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv1039 Modified Files: MBitmapButton.cpp MBitmapButton.h MMultiButton.cpp MMultiButton.h MainDlg.cpp SBPanel.cpp SBPanel.h ServerWnd.cpp Log Message: New bitmapbuttons are now iconset-theme aware. Index: MBitmapButton.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MBitmapButton.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- MBitmapButton.cpp 25 Dec 2003 02:18:57 -0000 1.8 +++ MBitmapButton.cpp 27 Dec 2003 07:18:20 -0000 1.9 @@ -42,22 +42,21 @@ /* @id Identification code (int) for this control */ /* @name Name label to be shown on this button */ /* @image Image label to be shown on this button */ +/* @image_name Name of the StaticBitmap - needed for iconset changing engine */ /* @pos Position to insert this control to */ /* @size Size of this control */ /* @style Style flag - see wxWindow/wxControl style flags in wxHelp */ /******************************************************************************/ MBitmapButton::MBitmapButton( - wxWindow *parent, wxWindowID id, const wxString &name, const wxBitmap + wxWindow *parent, wxWindowID id, const wxString &name, const wxString &image, const wxPoint &pos, const wxSize &size, long style ) : wxButton(parent, id, name, pos, size, style) { - - wxString imgname; - imgname.Format(wxT("%simg_%s"), imgname.c_str(), name.c_str()); + wxBitmap bitmap = img->GetImage(image); wxFlexGridSizer *s_main = new wxFlexGridSizer(0, 0); wxStaticBitmap *img = new wxStaticBitmap( - this, 1000, image, wxDefaultPosition, - wxSize(image.GetWidth(), image.GetHeight()), 5, imgname + this, 1000, bitmap, wxDefaultPosition, + wxSize(bitmap.GetWidth(), bitmap.GetHeight()), 5, image ); s_main->Add(img, 0, wxALL, 5); Index: MBitmapButton.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MBitmapButton.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- MBitmapButton.h 25 Dec 2003 02:18:57 -0000 1.6 +++ MBitmapButton.h 27 Dec 2003 07:18:20 -0000 1.7 @@ -28,6 +28,8 @@ #include "wx/wx.h" #endif +#include "Images.h" + /* Image/Text positioning/sizing constants */ /* These constants adjust the positioning and sizing of this buttons bitmap */ /* label. Since all platforms have different "base" button sizes/borders etc, */ @@ -76,8 +78,8 @@ public: MBitmapButton( /* Constructor */ wxWindow *parent, wxWindowID id, const wxString &title, - const wxBitmap &image, const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, long style = + const wxString &image, const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, long style = wxNO_FULL_REPAINT_ON_RESIZE ); private: Index: MMultiButton.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MMultiButton.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- MMultiButton.cpp 23 Dec 2003 00:59:20 -0000 1.4 +++ MMultiButton.cpp 27 Dec 2003 07:18:20 -0000 1.5 @@ -30,9 +30,6 @@ #include "MMultiButton.h" -#include <wx/listimpl.cpp> -WX_DEFINE_LIST(MBitmapList); - BEGIN_EVENT_TABLE(MMultiButton, wxControl) EVT_PAINT(MMultiButton::OnPaint) END_EVENT_TABLE() @@ -88,8 +85,8 @@ /******************************************************************************/ MMultiButton::MMultiButton( wxWindow *parent, wxWindowID id, size_t count, const wxArrayString - &names, int ids[], const MBitmapList &images, const wxPoint &pos, const - wxSize &size, long style + &names, int ids[], const wxArrayString &images, const wxPoint &pos, + const wxSize &size, long style ) : wxControl(parent, id, pos, size, style) { MBitmapButton *btn; @@ -100,7 +97,7 @@ s_main->AddGrowableCol(0); for (size_t i=0;i<count;i++) { btn = new MBitmapButton( - this, ids[i], names[i], *(images.Item(i)->GetData()), + this, ids[i], names[i], images[i], wxDefaultPosition, wxDefaultSize, style ); s_main->Add(btn, 0, wxGROW, 0); Index: MMultiButton.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MMultiButton.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MMultiButton.h 22 Dec 2003 05:04:15 -0000 1.1 +++ MMultiButton.h 27 Dec 2003 07:18:20 -0000 1.2 @@ -30,8 +30,6 @@ #include "MBitmapButton.h" -WX_DECLARE_LIST(wxBitmap, MBitmapList); - /*************************************************************** MMultiButton */ /* MMultiButton is a control with multiple buttons. The buttons can either be */ /* normal buttons, or MBitmapButtons. */ @@ -46,7 +44,7 @@ ); MMultiButton( /* Constructs a multi-button with MBitmapButtons. */ wxWindow *parent, wxWindowID id, size_t count, const - wxArrayString &names, int ids[], const MBitmapList &images, + wxArrayString &names, int ids[], const wxArrayString &images, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxNO_BORDER| wxNO_FULL_REPAINT_ON_RESIZE Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- MainDlg.cpp 26 Dec 2003 11:36:32 -0000 1.40 +++ MainDlg.cpp 27 Dec 2003 07:18:20 -0000 1.41 @@ -293,11 +293,9 @@ bool show_tool; /* For storing values read from configuration */ unsigned int i; /* Loop counter */ wxArrayString names; /* Names for multibutton controls */ -MBitmapList images; /* Images for multibutton controls */ +wxArrayString images; /* Images for multibutton controls */ int ids[2]; /* Identifiers for multibutton controls */ - images.DeleteContents(true); - MyToolBar *toolbar = (MyToolBar*)GetToolBar(); delete toolbar; SetToolBar(NULL); @@ -337,11 +335,11 @@ names.Add(_("Log")); ids[1] = ID_BTN_CONNECT; ids[1] = ID_BTN_LOG; - images.Append(new wxBitmap(img->GetImage(wxT("connection")))); - images.Append(new wxBitmap(img->GetImage(wxT("log")))); + images.Add(wxT("connection")); + images.Add(wxT("log")); tb->AddControl(new MMultiButton(tb, -1, 2, names, ids, images)); images.Clear(); - names.Empty(); + names.Clear(); for (i=0;i<pages.GetCount();i++) { if (pages.IsEmpty()){ @@ -368,11 +366,11 @@ names.Add(_("Help")); ids[0] = ID_BTN_GUISETTINGS; ids[1] = ID_BTN_HELP; - images.Append(new wxBitmap(img->GetImage(wxT("options")))); - images.Append(new wxBitmap(img->GetImage(wxT("help")))); + images.Add(wxT("options")); + images.Add(wxT("help")); tb->AddControl(new MMultiButton(tb, -1, 2, names, ids, images)); images.Clear(); - names.Empty(); + names.Clear(); tb->Realize(); SetToolBar(tb); Index: SBPanel.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- SBPanel.cpp 25 Dec 2003 07:02:56 -0000 1.15 +++ SBPanel.cpp 27 Dec 2003 07:18:20 -0000 1.16 @@ -43,12 +43,12 @@ */ CSBPanel::CSBPanel( wxWindow *parent, wxWindowID id, const wxString &title, - const wxString &name, const wxBitmap &image + const wxString &name, const wxString &image ) : wxPanel( parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, name) { - if (image != wxNullBitmap) { + if (image != wxEmptyString) { use_image = true; } else { use_image = false; Index: SBPanel.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- SBPanel.h 22 Dec 2003 05:36:15 -0000 1.6 +++ SBPanel.h 27 Dec 2003 07:18:20 -0000 1.7 @@ -54,7 +54,7 @@ CSBPanel( wxWindow *parent, wxWindowID id, const wxString &title, const wxString &name, - const wxBitmap &image = wxNullBitmap + const wxString &image = wxEmptyString ); virtual ~CSBPanel(); Index: ServerWnd.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerWnd.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- ServerWnd.cpp 25 Dec 2003 07:22:10 -0000 1.51 +++ ServerWnd.cpp 27 Dec 2003 07:18:20 -0000 1.52 @@ -191,7 +191,7 @@ /* Sidebar sections */ CSBPanel *addserver = new CSBPanel( sidebar, -1, _("Add new server"), wxT("SideBar_AddServer"), - img->GetImage(wxT("newserver")) + wxT("newserver") ); addserver->SetContent(AddServerPanel(addserver, false, false)); sbmain->Add(addserver, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); @@ -199,21 +199,21 @@ CSBPanel *serversettings = new CSBPanel( sidebar, -1, _("Server settings"), wxT("SideBar_ServerSettings"), - img->GetImage(wxT("updateservers")) + wxT("updateservers") ); serversettings->SetContent(SettingsPanel(serversettings, false, false)); sbmain->Add(serversettings, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); CSBPanel *portsettings = new CSBPanel( sidebar, -1, _("Port settings"), wxT("SideBar_PortSettings"), - img->GetImage(wxT("server")) + wxT("server") ); portsettings->SetContent(PortSettingsPanel(portsettings, false, false)); sbmain->Add(portsettings, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); CSBPanel *logoptions = new CSBPanel( sidebar, -1, _("Log options"), wxT("SideBar_LoggingOptions"), - img->GetImage(wxT("log")) + wxT("log") ); logoptions->SetContent(LogOptionsPanel(logoptions, false, false)); sbmain->Add(logoptions, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); |