OpenASIP  2.0
Static Public Member Functions | List of all members
WidgetTools Class Reference

#include <WidgetTools.hh>

Collaboration diagram for WidgetTools:
Collaboration graph

Static Public Member Functions

static void setWidgetLabel (wxWindow *widget, std::string text)
 
static void setWidgetLabel (wxStaticBoxSizer *widget, std::string text)
 
static void setLabel (Texts::TextGenerator *generator, wxWindow *widget, int textID)
 
static std::string lcStringSelection (wxListCtrl *list, int column)
 

Detailed Description

Helper functions for handling wxWidgets controls.

Definition at line 46 of file WidgetTools.hh.

Member Function Documentation

◆ lcStringSelection()

std::string WidgetTools::lcStringSelection ( wxListCtrl *  list,
int  column 
)
static

Returns wxListCtrl's first selected item as a string.

Parameters
listList to search for selected item.
columnColumn of the string to return.
Returns
Selected list item string, or empty string if no item is selected.

Definition at line 108 of file WidgetTools.cc.

108  {
109 
110  long item = -1;
111  item = list->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
112 
113  if (item == -1) {
114  return "";
115  }
116 
117  wxListItem info;
118  info.SetId(item);
119  info.SetColumn(column);
120  list->GetItem(info);
121 
122  return WxConversion::toString(info.GetText());
123 }

References WxConversion::toString().

Referenced by BlockImplementationDialog::doOK(), OperationDialog::onBindOperand(), FUImplementationDialog::onClearOpcode(), OperationDialog::onDeleteOperand(), GCUDialog::onDeleteOperation(), FUDialog::onDeleteOperation(), RFImplementationDialog::onDeleteSourceFile(), FUImplementationDialog::onDeleteSourceFile(), OperationPropertyDialog::onModifyInputOperand(), OperationPropertyDialog::onModifyOutputOperand(), OperationPropertyDialog::onMoveInputDown(), OperationPropertyDialog::onMoveInputUp(), OperationPropertyDialog::onMoveOutputDown(), OperationPropertyDialog::onMoveOutputUp(), RFImplementationDialog::onMoveSourceFileDown(), FUImplementationDialog::onMoveSourceFileDown(), RFImplementationDialog::onMoveSourceFileUp(), FUImplementationDialog::onMoveSourceFileUp(), FUImplementationDialog::onOpcodeSelection(), OperationDialog::onOperandSelection(), OperationPropertyDialog::onSelection(), FUImplementationDialog::onSetOpcode(), RFImplementationDialog::onSourceFileSelection(), FUImplementationDialog::onSourceFileSelection(), SimulateDialog::onUpdateValue(), OSEdInfoView::selectedModule(), FUDialog::selectedOperation(), GCUDialog::selectedOperation(), OSEdInfoView::selectedOperation(), OTAFormatListDialog::selectedOperation(), OSEdInfoView::selectedPath(), FUDialog::selectedPort(), GCUDialog::selectedPort(), and TemplateListDialog::selectedSlot().

Here is the call graph for this function:

◆ setLabel()

void WidgetTools::setLabel ( Texts::TextGenerator generator,
wxWindow *  widget,
int  textID 
)
static

◆ setWidgetLabel() [1/2]

void WidgetTools::setWidgetLabel ( wxStaticBoxSizer *  sizer,
std::string  text 
)
static

Sets a boxsizer label text.

Parameters
sizerwxStaticBoxSizer to set the label to.
textIdEnumerated ID which identifies the text label.

Definition at line 76 of file WidgetTools.cc.

77  {
78  wxControl* box = sizer->GetStaticBox();
79  wxString label = WxConversion::toWxString(text);
80  box->SetLabel(label);
81 }

References WxConversion::toWxString().

Here is the call graph for this function:

◆ setWidgetLabel() [2/2]

void WidgetTools::setWidgetLabel ( wxWindow *  widget,
std::string  text 
)
static

Sets a wxControl label text.

Parameters
widgetWidget to set the label to.
textIdEnumerated ID which identifies the text label.
Exceptions
WrongSubclassIf the widget was not a wxControl.

Definition at line 52 of file WidgetTools.cc.

52  {
53  // wxControls
54  if (widget->IsKindOf(CLASSINFO(wxControl))) {
55  wxControl* control = dynamic_cast<wxControl*>(widget);
56  assert(widget != NULL);
57  wxString label = WxConversion::toWxString(text);
58  control->SetLabel(label);
59  return;
60  }
61 
62 
63  string method = "GUITextGenerator::setWidgetLabel()";
64  string message = "Widget is not a wxControl, ";
65  message += "unable to set the widget label.";
66  throw WrongSubclass(__FILE__, __LINE__, method, message);
67 }

References assert, and WxConversion::toWxString().

Referenced by setLabel(), GCUDialog::setLabels(), OperationDialog::setTexts(), OTAFormatListDialog::setTexts(), RFDialog::setTexts(), TemplateListDialog::setTexts(), SocketDialog::setTexts(), BusDialog::setTexts(), IUDialog::setTexts(), SimulateDialog::setTexts(), InputOperandDialog::setTexts(), FUDialog::setTexts(), AddressSpaceDialog::setTexts(), and OperationPropertyDialog::setTexts().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
WxConversion::toWxString
static wxString toWxString(const std::string &source)
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
assert
#define assert(condition)
Definition: Application.hh:86
WrongSubclass
Definition: Exception.hh:336
WidgetTools::setWidgetLabel
static void setWidgetLabel(wxWindow *widget, std::string text)
Definition: WidgetTools.cc:52
WxConversion::toString
static std::string toString(const wxString &source)