Ejemplo n.º 1
0
void CListBox::OnDraw(const SRect &rUpdate)
{
	if (mpDrawPrimitives == NULL) {
		mpDrawPrimitives = IDrawPrimitives::Create();
		mpDrawPrimitives->Init(GetParentWindow());
	}

	SRect rctDraw(GetPos(), SSize(GetSize().iCX, 10));

	tint32 iIndex = 0;
	std::list<std::string>::const_iterator it = mTexts.begin();
	for (; it != mTexts.end(); it++, iIndex++) {
		const std::string& sText = *it;

		DrawFont(dynamic_cast<IFontResource*>(GetBitmapResource()), rUpdate, rctDraw, (const tchar*)(sText.c_str()));

		if (iIndex == miDragIndex) {
			SRect rctInvert(rctDraw);
			rctInvert.iY -= 2;
			rctInvert.iCY += 4;
			mpDrawPrimitives->InvertRect(rUpdate, rctInvert);
		}

		rctDraw.iY += 14;
	}
} // OnDraw
void CProjectProcessingPage::CreateControls()
{    
////@begin CProjectProcessingPage content construction
    CProjectProcessingPage* itemWizardPage36 = this;

    wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxVERTICAL);
    itemWizardPage36->SetSizer(itemBoxSizer37);

    m_pTitleStaticCtrl = new wxStaticText;
    m_pTitleStaticCtrl->Create( itemWizardPage36, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
    m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
    itemBoxSizer37->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);

    itemBoxSizer37->Add(5, 80, 0, wxALIGN_LEFT|wxALL, 5);

    wxFlexGridSizer* itemFlexGridSizer40 = new wxFlexGridSizer(1, 3, 0, 0);
    itemFlexGridSizer40->AddGrowableRow(0);
    itemFlexGridSizer40->AddGrowableCol(0);
    itemFlexGridSizer40->AddGrowableCol(1);
    itemFlexGridSizer40->AddGrowableCol(2);
    itemBoxSizer37->Add(itemFlexGridSizer40, 0, wxGROW|wxALL, 5);

    itemFlexGridSizer40->Add(5, 5, 0, wxGROW|wxGROW|wxALL, 5);

    wxBitmap itemBitmap41(GetBitmapResource(wxT("res/wizprogress01.xpm")));
    m_pProgressIndicator = new wxStaticBitmap;
    m_pProgressIndicator->Create( itemWizardPage36, ID_PROGRESSCTRL, itemBitmap41, wxDefaultPosition, wxSize(184, 48), 0 );
    itemFlexGridSizer40->Add(m_pProgressIndicator, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    itemFlexGridSizer40->Add(5, 5, 0, wxGROW|wxGROW|wxALL, 5);
////@end CProjectProcessingPage content construction
}
Ejemplo n.º 3
0
/* return TRUE iff successful */
Bool InitializeGraphics3D(void)
{
	int i;
	BITMAPINFOHEADER* ptr;

   gBitsDC = CreateMemBitmap(MAXX, MAXY, &gOldBitmap, &gBits);
   gBufferDC = CreateMemBitmap(2*MAXX, 2*MAXY, &gOldBitmap, &gBufferBits);
   gMiniMapDC = CreateMemBitmap( MINIMAP_MAX_WIDTH, MINIMAP_MAX_HEIGHT, &gOldBitmap, &gMiniMapBits);

   SetBkMode(gBitsDC, TRANSPARENT);
   GraphicsResetFont();

//   if (gD3DEnabled)
//	D3DRenderFontInit(&gFont, GetFont(FONT_LABELS));

   BSPInitialize();

	//	Load view elements for corner treatment.
	for( i = 0; i < NUM_VIEW_ELEMENTS; i++ )
	{
		ptr = GetBitmapResource( hInst, ViewElements[i].id );
		if( ptr == NULL )
		{
			ViewElements[i].bits = NULL;
			continue;
		}
		ViewElements[i].width  = ptr->biWidth;
		ViewElements[i].height = ptr->biHeight;
		ViewElements[i].bits = ( (BYTE*)ptr ) + sizeof( BITMAPINFOHEADER ) + NUM_COLORS * sizeof( RGBQUAD );
	}

   return True;
}
Ejemplo n.º 4
0
void
TreeviewSample::Init()
{
  m_projectNewButton = NULL;
  m_projectOpenButton = NULL;
  m_projectCopyButton = NULL;
  m_projectDeleteButton = NULL;
  m_projectRemoveReferenceButton = NULL;
  m_projectFolderCtrl = NULL;
  m_statusBar = NULL;

  m_arrowUp     = GetBitmapResource(wxT("arrow_up.xpm"));
  m_arrowDown   = GetBitmapResource(wxT("arrow_down.xpm"));
  m_arrowUpDown = GetBitmapResource(wxT("arrow_up_down.xpm"));
  
  m_activeFolder = 1;
}
Ejemplo n.º 5
0
void CBitmap::OnDraw(const SRect &rUpdate)
{
	if( !IsVisible() )
		return;

	if (mSize == mSizeBitmap) {
		// Size of control equals size of bitmap
		DrawBitmapFrame(GetBitmapResource(), rUpdate, SRect(GetPos(), mSizeBitmap),
			miFrameCur, miFrames);
	}
	else {
		if (mSize.iCX < mSizeBitmap.iCX) {
			DrawBitmapFrame(GetBitmapResource(), rUpdate, SRect(GetPos(), mSize),
				miFrameCur, miFrames);
		}
		else if (mSize.iCY < mSizeBitmap.iCY) {
			DrawBitmapFrame(GetBitmapResource(), rUpdate, SRect(GetPos(), mSize),
				miFrameCur, miFrames);
		}
		else {
			SPos PosThis;
			GetPos(PosThis);
			// Size of control doesn't equal size of bitmap, so tiling is needed
			tint32 iYPos = rUpdate.iY - PosThis.iY - mSizeBitmap.iCY;
			if (iYPos < 0) {
				iYPos = 0;
			}
			while ((iYPos < mSize.iCY) &&
				(PosThis.iY + iYPos < rUpdate.iY + rUpdate.iCY)) {
				tint32 iXPos = rUpdate.iX - PosThis.iX - mSizeBitmap.iCX;
				if (iXPos < 0) {
					iXPos = 0;
				}
				while ((iXPos < mSize.iCX) &&
					(PosThis.iX + iXPos < rUpdate.iX + rUpdate.iCX)) {
					DrawBitmapFrame(GetBitmapResource(), rUpdate, SRect(PosThis + SPos(iXPos, iYPos), mSizeBitmap),
						miFrameCur, miFrames);

						iXPos += mSizeBitmap.iCX;
				}

				iYPos += mSizeBitmap.iCY;
			}
		}
	}
}
void CProjectProcessingPage::IncrementProgress(wxStaticBitmap* pBitmap) {
    m_iBitmapIndex += 1;
    if (12 < m_iBitmapIndex) m_iBitmapIndex = 1;
 
    wxString str;
    str.Printf(wxT("res/wizprogress%02d.xpm"), m_iBitmapIndex);
 
    pBitmap->SetBitmap(GetBitmapResource(str));
    Update();
}
Ejemplo n.º 7
0
/*
 * StatButtonsCreate:  Load bitmaps for stat buttons.
 */
void StatButtonsCreate(void)
{
	int i;
	BITMAPINFOHEADER *ptr;

	for (i=0; i < NUM_BUTTONS; i++)
	{
		ptr = GetBitmapResource(hInst, buttons[i].idLeft);
		if (ptr == NULL)
		{
			buttons[i].bitsLeft = NULL;
			continue;
		}
		buttons[i].height = ptr->biHeight;
		buttons[i].bitsLeft = (char *) ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);
		buttons[i].iWidthLeft	= ptr->biWidth / 2;		//	Bitmap has up and down images in it, so divide by 2.

		ptr = GetBitmapResource(hInst, buttons[i].idMid);
		if (ptr == NULL)
		{
			buttons[i].bitsMid = NULL;
			continue;
		}
		buttons[i].bitsMid =  (char *) ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);
		buttons[i].iWidthMid	= ptr->biWidth / 2;		//	Bitmap has up and down images in it, so divide by 2.

		ptr = GetBitmapResource(hInst, buttons[i].idRight);
		if (ptr == NULL)
		{
			buttons[i].bitsRight = NULL;
			continue;
		}
		buttons[i].bitsRight	= (char *) ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);
		buttons[i].iWidthRight	= ptr->biWidth / 2;		//	Bitmap has up and down images in it, so divide by 2.
	}
}
Ejemplo n.º 8
0
/*
 * InterfaceLoadElement:  Initialize given InterfaceElements structure by
 *   getting pointer to bitmap from resource file.
 */
void InterfaceLoadElement(InterfaceElement *element)
{
   BITMAPINFOHEADER *ptr;
   
   ptr = GetBitmapResource(hInst, element->id);
   if (ptr == NULL)
   {
     element->bits = NULL;
     return;
   }
   
   element->width  = ptr->biWidth;
   element->height = ptr->biHeight;
   element->bits = ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);
}
void PASL::OnMapBoxSelected( wxCommandEvent& event )
{
    Map = wxT("-l") + MapBox->GetValue() + wxT(" ");
    PrevImg.Destroy();
    if(wxFile::Exists(MapDir + MapBox->GetValue() + wxT(".png")))
        PrevImg.LoadFile(MapDir + MapBox->GetValue() + wxT(".png"));
    else if(wxFile::Exists(MapDir + MapBox->GetValue() + wxT(".jpg")))
        PrevImg.LoadFile(MapDir + MapBox->GetValue() + wxT(".jpg"));
    else if(wxFile::Exists(MapDir + MapBox->GetValue() + wxT(".bmp")))
        PrevImg.LoadFile(MapDir + MapBox->GetValue() + wxT(".bmp"));

	wxSize imgsize = PASL::ConvertDialogToPixels(wxSize(35, 35));
    imgsize.Set(64,64);

    if(PrevImg.IsOk())
        MapPrev->SetBitmap(wxBitmap(PrevImg.Rescale(imgsize.x,imgsize.y)));
    else
        MapPrev->SetBitmap(wxBitmap(GetBitmapResource(wxT("NoImage.xpm"))).ConvertToImage().Rescale(imgsize.x,imgsize.y));
    event.Skip();
}
Ejemplo n.º 10
0
bool CanalConfigWizard::Create( wxWindow* parent, 
                                    wxWindowID id, 
                                    const wxPoint& pos )
{
    for ( int i = 0; i < MAX_PARAMETERS; i++ ) {
        m_pgConfig[ i ] = NULL;
    }
    
    for ( int i = 0; i < MAX_FLAGS; i++ ) {
        m_pgConfigFlags[ i ] = NULL;
    }

    SetExtraStyle( wxWS_EX_BLOCK_EVENTS | wxWIZARD_EX_HELPBUTTON );
    wxBitmap wizardBitmap( GetBitmapResource( wxT( "vscp_logo.jpg" ) ) );
    wxWizard::Create( parent,
                      id,
                      CANAL_CONFIG_WIZARD_TITLE,
                      wizardBitmap,
                      pos,
                      wxDEFAULT_DIALOG_STYLE | wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX );

    return true;
}
Ejemplo n.º 11
0
void C2D::OnDraw(const SRect &rUpdate)
{
	if (IsVisible() == false) {
		return;
	}

	SPos BitmapPos;
	BitmapPos.iX = GetValue() >> 16;
	if (BitmapPos.iX < 0) {
		BitmapPos.iX = 0;
	}
	if (BitmapPos.iX >= (tint)muiXPositions) {
		BitmapPos.iX = muiXPositions - 1;
	}
	BitmapPos.iY = GetValue() & 0xffff;
	if (BitmapPos.iY < 0) {
		BitmapPos.iY = 0;
	}
	if (BitmapPos.iY >= (tint)muiYPositions) {
		BitmapPos.iY = muiYPositions - 1;
	}

	DrawBitmap(GetBitmapResource(), rUpdate, SRect(GetPos() + BitmapPos, mSizeBitmap));
}
Ejemplo n.º 12
0
void CAccountManagerProcessingPage::StartProgress(wxStaticBitmap* pBitmap) {
    m_iBitmapIndex = 1;
    pBitmap->SetBitmap(GetBitmapResource(wxT("res/wizprogress01.xpm")));
}
Ejemplo n.º 13
0
void CProjectPropertiesPage::StartProgress(wxStaticBitmap* pBitmap) {
    m_iBitmapIndex = 1;
    pBitmap->SetBitmap(GetBitmapResource(wxT("res/wizprogress01.xpm")));
}
Ejemplo n.º 14
0
//---------------------------------------------------------------------------------------
bool WizardDevicesPage::Create( wxWizard* parent )
{
    // member initialisation
    m_pOutCombo = NULL;
    m_pInCombo = NULL;

    // page creation
    wxBitmap wizardBitmap(GetBitmapResource("wizard.png"));
    wxWizardPageSimple::Create( parent, NULL, NULL, wizardBitmap );
    CreateControls();
    GetSizer()->Fit(this);

    // populate combo boxes with available Midi devices
    MidiServer* pMidi = m_appScope.get_midi_server();
    //int nInput=0;
    int nItem, nOutput=0;
    int nNumDevices = pMidi->CountDevices();
    int nOutDevId = pMidi->OutDevId();
    int iSelOut = 0;
//    //TODO: Un-comment when ready to use MIDI input
//    int nInDevId = pMidi->InDevId();
//    int iSelIn = 0;
    for (int i = 0; i < nNumDevices; i++)
    {
        wxMidiOutDevice* pMidiDev = LENMUS_NEW wxMidiOutDevice(i);
        if (pMidiDev->IsOutputPort())
        {
            nOutput++;
            nItem = m_pOutCombo->Append( pMidiDev->DeviceName() );
            m_pOutCombo->SetClientData(nItem, reinterpret_cast<void*>(i));
            //wxLogMessage("[WizardDevicesPage::Create] nItem=%d, i=%d", nItem, i);
            if (nOutDevId == i)
                iSelOut = nItem;
        }
		////TODO: Un-comment when ready to use MIDI input
        //if (pMidiDev->IsInputPort()) {
        //    nInput++;
        //    nItem = m_pInCombo->Append( pMidiDev->DeviceName() );
        //    m_pInCombo->SetClientData(nItem, (void *)i);
        //    if (nInDevId == i)
        //        iSelIn = nItem;
        //}
        delete pMidiDev;
    }

    //set current selection
    if (nOutput == 0)
    {
        nItem = m_pOutCombo->Append( _("None") );
        m_pOutCombo->SetClientData(nItem, (void *)(-1));
        iSelOut = 0;
    }
    m_pOutCombo->SetSelection(iSelOut);

	////TODO: Un-comment when ready to use MIDI input
	////set current selection
    //if (nInput == 0) {
    //    nItem = m_pInCombo->Append( _("None") );
    //    m_pInCombo->SetClientData(nItem, (void *)(-1));
    //    iSelIn = 0;
    //}
    //m_pInCombo->SetSelection(iSelIn);

    return true;
}
Ejemplo n.º 15
0
/*
 * ToolbarAddButton:  Add a button to the toolbar.
 *   s describes the properties of the button.
 *   Return True iff button created successfully.
 */
Bool __cdecl ToolbarAddButton(AddButton *s)
{
   HWND hwnd;
   int x, y;
   BITMAPINFOHEADER *ptr;
   BYTE *bits;
   
   if (num_buttons >= MAX_BUTTONS)
   {
      debug(("ToolbarAddButton: Too many buttons!\n"));
      return False;
   }

   x = TOOLBAR_X + num_buttons * (TOOLBAR_BUTTON_LEFT_SPACING + TOOLBAR_BUTTON_WIDTH);	//	+ num_separators * TOOLBAR_SEPARATOR_WIDTH;
   y = TOOLBAR_Y + TOOLBAR_BUTTON_TOP_SPACING;

   // If id = 0, create separator
   if (s->bitmap_id == 0)
   {
      num_separators++;
      return True;
   }

   hwnd = CreateWindow("button", "", WS_CHILD | BS_OWNERDRAW, 
		       x, y, TOOLBAR_BUTTON_WIDTH, TOOLBAR_BUTTON_HEIGHT,
		       hMain, (HMENU) IDC_TOOLBUTTON, hInst, NULL);

   if (hwnd == NULL)
   {
      debug(("ToolbarAddButton failed to create button window\n"));
      return False;
   }

   ptr = GetBitmapResource(s->hModule, s->bitmap_id);
   if (ptr == NULL)
      return False;

   bits = ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);

   if (ptr->biWidth != 2 * TOOLBAR_BUTTON_WIDTH || ptr->biHeight != TOOLBAR_BUTTON_HEIGHT)
   {
      debug(("ToolbarAddButton found button bitmap %d with bad size\n", s->bitmap_id));
      return False;
   }

   lpfnDefButtonProc = SubclassWindow(hwnd, ToolbarButtonProc);

   // Set up tooltip for button, if desired
   if (s->name != 0)
      TooltipAddWindow(hwnd, s->hModule, s->name);

   ToolbarSetButtonVisibility(hwnd);
   
   buttons[num_buttons].index        = num_buttons;
   buttons[num_buttons].hwnd         = hwnd;
   buttons[num_buttons].action       = s->action;
   buttons[num_buttons].action_data  = s->data;
   buttons[num_buttons].action2      = s->action2;
   buttons[num_buttons].action_data2 = s->data2;
   buttons[num_buttons].bits         = bits;
   buttons[num_buttons].x            = x;
   buttons[num_buttons].pressed      = False;
   num_buttons++;

   Lagbox_Reposition();

   return True;
}
void CAccountManagerPropertiesPage::FinishProgress(wxStaticBitmap* pBitmap) {
    m_iBitmapIndex = 12;
    pBitmap->SetBitmap(GetBitmapResource(wxT("res/wizprogress12.xpm")));
}
void CProjectProcessingPage::FinishProgress(wxStaticBitmap* pBitmap) {
    m_iBitmapIndex = 12;
    pBitmap->SetBitmap(GetBitmapResource(wxT("res/wizprogress12.xpm")));
}
Ejemplo n.º 18
0
/*
 * InventoryBoxCreate:  Create the inventory list box.
 */
void InventoryBoxCreate(HWND hParent)
{
    BITMAPINFOHEADER *ptr;
    LOGBRUSH logbrush;

    hwndInvDialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_INVENTORY),
                                 hParent, InventoryDialogProc);

    hwndInv = CreateWindow("button", NULL,
                           WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
                           0, 0, 0, 0,
                           hwndInvDialog, (HMENU) IDC_INVENTORY, hInst, NULL);
    lpfnDefProc = SubclassWindow(hwndInv, InventoryProc);

    hwndInvScroll = CreateWindow("scrollbar", NULL,
                                 WS_CHILD | SBS_VERT,
                                 0, 0, 100, 100,  /* Make sure scrollbar drawn ok */
                                 hwndInvDialog, (HMENU) IDC_INVSCROLL, hInst, NULL);

    inventory_scrollbar_width = GetSystemMetrics(SM_CXVSCROLL);
    num_items = 0;
    top_row = 0;
    cursor_row = cursor_col = -1;
    items = NULL;
    capture = False;

    // Get bitmaps for cursor and in-use highlight
    ptr = GetBitmapResource(hInst, IDB_INVCURSOR);
    if (ptr == NULL)
        cursor_bits = NULL;
    else cursor_bits = ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);

    ptr = GetBitmapResource(hInst, IDB_INVINUSE);
    if (ptr == NULL)
        inuse_bits = NULL;
    else inuse_bits = ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);

    ptr = GetBitmapResource(hInst, IDB_SELFTRGT);
    if (ptr == NULL)
        selftrgt_bits = NULL;
    else selftrgt_bits = ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);

    if (!GetBitmapResourceInfo(hInst, IDB_INVBKGND, &inventory_bkgnd))
        debug(("InventoryBoxCreate couldn't load inventory background bitmap\n"));

    //	ajw begin...
//	hbmpScrollBack = GetHBitmapFromResource( hInst, IDB_INVBKGND );
//	if( !hbmpScrollBack )
//		debug(("InventoryBoxCreate couldn't create hbmpScrollBack\n"));
    if( !( ptr = GetBitmapResource( hInst, IDB_INVBKGND ) ) )
        debug(("InventoryBoxCreate couldn't load inventory scroll bar texture bitmap\n"));

//	logbrush.lbStyle = BS_DIBPATTERN;
//	logbrush.lbColor = DIB_RGB_COLORS;
//	logbrush.lbHatch = hbmpScrollBack;
    logbrush.lbStyle = BS_DIBPATTERNPT;
    logbrush.lbColor = DIB_RGB_COLORS;
    logbrush.lbHatch = (long)ptr;

    hbrushScrollBack = CreateBrushIndirect( &logbrush );
    //	ajw end...

    // Compute background palette index
    inventory_bg_index = GetClosestPaletteIndex(RGB(84, 40, 0));

    InventoryResetFont();
    InventoryChangeColor();
    InventoryDisplayScrollbar();
}
Ejemplo n.º 19
0
void ShareProperties::CreateControls()
{    
    ////@begin ShareProperties content construction
    if (!wxXmlResource::Get()->LoadDialog(this, GetParent(), _T("ID_DIALOG_SHARE_ADD")))
        wxLogError(wxT("Missing wxXmlResource::Get()->Load() in OnInit()?"));
    m_pCtrlLocalShares = XRCCTRL(*this, "ID_COMBOBOX_SHARE_LOCALNAME", wxBitmapComboBox);
    m_pCtrlSmbPrintOptions = XRCCTRL(*this, "ID_PANEL_SMB_PRINTER", wxPanel);
    m_pCtrlSmbDriver = XRCCTRL(*this, "ID_COMBOBOX_SMBDRIVER", wxComboBox);
    m_pCtrlSmbPrivate = XRCCTRL(*this, "ID_RADIOBUTTON_SMB_PRIVATE", wxRadioButton);
    m_pCtrlSmbPublic = XRCCTRL(*this, "ID_RADIOBUTTON_SMB_PUBLIC", wxRadioButton);
    m_pCtrlSmbPrintUsername = XRCCTRL(*this, "ID_TEXTCTRL_SMBPRINT_USERNAME", wxTextCtrl);
    m_pCtrlSmbPrintPassword = XRCCTRL(*this, "ID_TEXTCTRL_SMBPRINT_PASSWORD", wxTextCtrl);
    m_pCtrlCupsOptions = XRCCTRL(*this, "ID_PANEL_CUPSOPTIONS", wxPanel);
    m_pCtrlCupsPrivate = XRCCTRL(*this, "ID_RADIOBUTTON_CUPS_PRIVATE", wxRadioButton);
    m_pCtrlCupsPublic = XRCCTRL(*this, "ID_RADIOBUTTON_CUPS_PUBLIC", wxRadioButton);
    m_pCtrlUsbOptions = XRCCTRL(*this, "ID_PANEL_USBIP", wxPanel);
    m_pCtrlSmbDiskOptions = XRCCTRL(*this, "ID_PANEL_SMBOPTIONS", wxPanel);
    m_pCtrlMountPoint = XRCCTRL(*this, "ID_TEXTCTRL_SHARE_MOUNTPOINT", wxTextCtrl);
    m_pCtrlUsername = XRCCTRL(*this, "ID_TEXTCTRL_SHARE_USERNAME", wxTextCtrl);
    m_pCtrlPassword = XRCCTRL(*this, "ID_TEXTCTRL_SHARE_PASSWORD", wxTextCtrl);
    // Set validators
    if (FindWindow(XRCID("ID_COMBOBOX_SMBDRIVER")))
        FindWindow(XRCID("ID_COMBOBOX_SMBDRIVER"))->SetValidator( wxGenericValidator(& m_sSmbDriver) );
    if (FindWindow(XRCID("ID_RADIOBUTTON_SMB_PUBLIC")))
        FindWindow(XRCID("ID_RADIOBUTTON_SMB_PUBLIC"))->SetValidator( wxGenericValidator(& m_bSmbPublic) );
    if (FindWindow(XRCID("ID_TEXTCTRL_SMBPRINT_USERNAME")))
        FindWindow(XRCID("ID_TEXTCTRL_SMBPRINT_USERNAME"))->SetValidator( MyValidator(& m_sSmbPrintUsername) );
    if (FindWindow(XRCID("ID_TEXTCTRL_SMBPRINT_PASSWORD")))
        FindWindow(XRCID("ID_TEXTCTRL_SMBPRINT_PASSWORD"))->SetValidator( MyValidator(& m_sSmbPrintPassword) );
    if (FindWindow(XRCID("ID_COMBOBOX_CUPSDRIVER")))
        FindWindow(XRCID("ID_COMBOBOX_CUPSDRIVER"))->SetValidator( wxGenericValidator(& m_sCupsDriver) );
    if (FindWindow(XRCID("ID_RADIOBUTTON_CUPS_PUBLIC")))
        FindWindow(XRCID("ID_RADIOBUTTON_CUPS_PUBLIC"))->SetValidator( wxGenericValidator(& m_bCupsPublic) );
    if (FindWindow(XRCID("ID_TEXTCTRL_SHARE_MOUNTPOINT")))
        FindWindow(XRCID("ID_TEXTCTRL_SHARE_MOUNTPOINT"))->SetValidator( MyValidator(& m_sMountPoint) );
    if (FindWindow(XRCID("ID_TEXTCTRL_SHARE_USERNAME")))
        FindWindow(XRCID("ID_TEXTCTRL_SHARE_USERNAME"))->SetValidator( MyValidator(& m_sSmbDiskUsername) );
    if (FindWindow(XRCID("ID_TEXTCTRL_SHARE_PASSWORD")))
        FindWindow(XRCID("ID_TEXTCTRL_SHARE_PASSWORD"))->SetValidator( MyValidator(& m_sSmbDiskPassword) );
    ////@end ShareProperties content construction

    // Create custom windows not generated automatically here.

    ////@begin ShareProperties content initialisation
    ////@end ShareProperties content initialisation

    int minw = 0;
    int minh = 0;
    int w, h;
    m_pCtrlSmbDiskOptions->Show(false);
    m_pCtrlSmbPrintOptions->Show(true);
    m_pCtrlCupsOptions->Show(false);
    InvalidateBestSize();
    Layout();
    m_pCtrlSmbPrintOptions->SetMinSize(m_pCtrlSmbPrintOptions->GetBestSize());
    GetBestSize(&minw, &minh);

    m_pCtrlSmbDiskOptions->Show(false);
    m_pCtrlSmbPrintOptions->Show(false);
    m_pCtrlCupsOptions->Show(true);
    InvalidateBestSize();
    Layout();
    m_pCtrlCupsOptions->SetMinSize(m_pCtrlSmbDiskOptions->GetBestSize());
    GetBestSize(&w, &h);
    if (w > minw)
        minw = w;
    if (h > minh)
        minh = h;

    m_pCtrlCupsOptions->Show(false);
    m_pCtrlSmbDiskOptions->Show(true);
    m_pCtrlSmbPrintOptions->Show(false);
    InvalidateBestSize();
    Layout();
    m_pCtrlSmbDiskOptions->SetMinSize(m_pCtrlSmbPrintOptions->GetBestSize());
    GetBestSize(&w, &h);
    if (w > minw)
        minw = w;
    if (h > minh)
        minh = h;
    SetMinSize(wxSize(minw, minh));

    if (m_iCurrentShare != -1) {
        ShareGroup sg = m_pCfg->aGetShareGroups().Item(m_iCurrentShare);
        wxBitmap bm = wxNullBitmap;
        m_pCtrlLocalShares->Append(sg.m_sShareName, bm, &sg);
        m_pCtrlLocalShares->SetSelection(0);
        m_pCtrlLocalShares->Enable(false);
        SetTitle(_("Modify shared resource - OpenNX"));
        switch (sg.m_eType) {
            case SharedResource::SHARE_UNKNOWN:
                break;
            case SharedResource::SHARE_SMB_DISK:
                m_pCtrlCupsOptions->Show(false);
                m_pCtrlSmbPrintOptions->Show(false);
                m_pCtrlSmbDiskOptions->Show(true);
                m_sMountPoint = sg.m_sAlias;
                m_sSmbDiskUsername = sg.m_sUsername;
                if (m_sSmbDiskUsername.IsEmpty())
                    m_sSmbDiskUsername = ::wxGetUserId();
                m_sSmbDiskPassword = sg.m_sPassword;
                Layout();
                break;
            case SharedResource::SHARE_SMB_PRINTER:
                m_pCtrlCupsOptions->Show(false);
                m_pCtrlSmbDiskOptions->Show(false);
                m_pCtrlSmbPrintOptions->Show(true);
                m_sSmbDriver = sg.m_sDriver;
                m_sSmbPrintUsername = sg.m_sUsername;
                if (m_sSmbPrintUsername.IsEmpty())
                    m_sSmbPrintUsername = ::wxGetUserId();
                m_sSmbPrintPassword = sg.m_sPassword;
                if (sg.m_bPublic)
                    m_pCtrlSmbPublic->SetValue(true);
                else
                    m_pCtrlSmbPrivate->SetValue(true);
                Layout();
                break;
            case SharedResource::SHARE_CUPS_PRINTER:
                m_pCtrlSmbPrintOptions->Show(false);
                m_pCtrlSmbDiskOptions->Show(false);
                m_pCtrlCupsOptions->GetSizer()->Layout();
                m_pCtrlCupsOptions->Show(true);
                if (sg.m_bPublic)
                    m_pCtrlCupsPublic->SetValue(true);
                else
                    m_pCtrlCupsPrivate->SetValue(true);
                Layout();
                break;
        }
        m_pCtrlMountPoint->SetValue(m_sMountPoint);
    } else {
        // Fetch list of shares
        if (m_bUseSmb) {
            SmbClient sc;
            m_aShares = sc.GetShares();
        }
        if (m_bUseCups) {
            CupsClient cc;
            ArrayOfShares cupsShares = cc.GetShares();
            WX_APPEND_ARRAY(m_aShares, cupsShares);
        }
        // Apparently, wxGTK (perhaps GTK itself) has a bug which
        // results in data pointers not being associated properly to the
        // ComboBox, if that ComboBox is sorted (wxCB_SORT attribute).
        // As a woraround, we use an *unsorted* ComboBox and sort the
        // shares before adding them to the ComboBox.
        m_aShares.Sort(cmpshares);

        // Build ComboBox content
        for (size_t i = 0; i < m_aShares.GetCount(); i++) {
            wxBitmap bm;
            switch (m_aShares[i].sharetype) {
                case SharedResource::SHARE_SMB_DISK:
                    bm = GetBitmapResource(wxT("res/smbfolder.png"));
                    break;
                case SharedResource::SHARE_SMB_PRINTER:
                    bm = GetBitmapResource(wxT("res/smbprinter.png"));
                    break;
                case SharedResource::SHARE_CUPS_PRINTER:
                    bm = GetBitmapResource(wxT("res/cupsprinter.png"));
                    break;
                default:
                    bm = wxNullBitmap;
                    break;
            }
            m_pCtrlLocalShares->Append(m_aShares[i].name, bm, m_aShares[i].GetThisVoid());
        }

        if (m_aShares.GetCount() > 0) {
            // Select first element of ComboBox
            m_pCtrlLocalShares->SetSelection(0);
            SharedResource *res = wxDynamicCast(m_pCtrlLocalShares->GetClientData(0), SharedResource);
            wxASSERT(res);
            switch (res->sharetype) {
                case SharedResource::SHARE_UNKNOWN:
                    break;
                case SharedResource::SHARE_SMB_DISK:
                    m_pCtrlSmbPrintOptions->Show(false);
                    m_pCtrlCupsOptions->Show(false);
                    m_pCtrlSmbDiskOptions->Show(true);
                    m_sMountPoint = wxT("$(SHARES)/") + res->name;
                    Layout();
                    break;
                case SharedResource::SHARE_SMB_PRINTER:
                    m_pCtrlSmbDiskOptions->Show(false);
                    m_pCtrlCupsOptions->Show(false);
                    m_pCtrlSmbPrintOptions->Show(true);
                    m_sSmbDriver = wxT("laserjet");
                    Layout();
                    break;
                case SharedResource::SHARE_CUPS_PRINTER:
                    m_pCtrlSmbDiskOptions->Show(false);
                    m_pCtrlSmbPrintOptions->Show(false);
                    m_pCtrlCupsOptions->Show(true);
                    Layout();
                    break;
            }
        } else {
            wxLogMessage(_("No shares found"));
            m_pCtrlLocalShares->Enable(false);
            m_pCtrlMountPoint->Enable(false);
            m_pCtrlUsername->Enable(false);
            m_pCtrlPassword->Enable(false);
        }
    }
}