|
From: <ma...@us...> - 2003-12-22 05:36:19
|
Update of /cvsroot/sharedaemon/ui-wx/src
In directory sc8-pr-cvs1:/tmp/cvs-serv316
Modified Files:
SBPanel.cpp SBPanel.h
Log Message:
Got rid of some extranous ifs regarding headerbtn id.
Index: SBPanel.cpp
===================================================================
RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- SBPanel.cpp 22 Dec 2003 05:30:00 -0000 1.9
+++ SBPanel.cpp 22 Dec 2003 05:36:15 -0000 1.10
@@ -58,20 +58,22 @@
mainsizer = new wxStaticBoxSizer(box, wxVERTICAL);
if (use_image) {
- headerbmpbtn = new MBitmapButton(
+ MBitmapButton *headerbmpbtn = new MBitmapButton(
this, -1, title, image
);
headerbmpbtn->SetFont(
wxFont(SB_BTN_FONT_SIZE, wxROMAN, wxNORMAL, wxBOLD)
);
+ header_btn_id = headerbmpbtn->GetId();
mainsizer->Add(headerbmpbtn, 0, wxGROW|wxADJUST_MINSIZE, 5);
} else {
- headerbtn = new wxButton(
+ wxButton *headerbtn = new wxButton(
this, -1, title, wxDefaultPosition, wxDefaultSize, 0
);
headerbtn->SetFont(
wxFont(SB_BTN_FONT_SIZE, wxROMAN, wxNORMAL, wxBOLD)
);
+ header_btn_id = headerbtn->GetId();
mainsizer->Add(headerbtn, 0, wxGROW|wxADJUST_MINSIZE, 5);
}
@@ -101,16 +103,9 @@
* Layout() as neccesery.
*/
void CSBPanel::Toggle(wxCommandEvent &event) {
- if (use_image) {
- if (event.GetId() != headerbmpbtn->GetId()) {
- event.Skip();
- return;
- }
- } else {
- if (event.GetId() != headerbtn->GetId()) {
- event.Skip();
- return;
- }
+ if (event.GetId() != header_btn_id) {
+ event.Skip();
+ return;
}
if (shown) {
@@ -154,11 +149,7 @@
*/
if (!tmp) {
wxCommandEvent nullevent;
- if (use_image) {
- nullevent.SetId(headerbmpbtn->GetId());
- } else {
- nullevent.SetId(headerbtn->GetId());
- }
+ nullevent.SetId(header_btn_id);
Toggle(nullevent);
}
}
Index: SBPanel.h
===================================================================
RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- SBPanel.h 22 Dec 2003 05:30:00 -0000 1.5
+++ SBPanel.h 22 Dec 2003 05:36:15 -0000 1.6
@@ -65,8 +65,7 @@
wxStaticBoxSizer *mainsizer;
wxSizer *content;
- wxButton *headerbtn;
- MBitmapButton *headerbmpbtn;
+ int header_btn_id;
bool shown;
bool use_image;
};
|