Changeset 19240 for trunk/Mars/mbase


Ignore:
Timestamp:
10/20/18 21:34:48 (6 years ago)
Author:
tbretz
Message:
Allow to link the marslogo into the shared object so that no path is required.
Location:
trunk/Mars/mbase
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mbase/MGList.cc

    r8562 r19240  
    3939#include <TROOT.h>
    4040#include <TClass.h>
     41#include <TImage.h>
    4142#include <TGClient.h>
    4243#include <TGWidget.h>
     
    287288    return pic;
    288289}
     290
     291const TGPicture *MGList::GetPicture(const char *name, const char *xpm[])
     292{
     293    struct MGPicture : public TGPicture
     294    {
     295        MGPicture (const char *_n, Pixmap_t _p, Pixmap_t _m) : TGPicture(_n, _p, _m) { }
     296    };
     297
     298    // Add Mars logo picture
     299    TImage *img = TImage::Open(const_cast<char **>(xpm));
     300    if (!img)
     301        return 0;
     302
     303    TGPicture *pic = new MGPicture(name, img->GetPixmap(), img->GetMask());
     304    delete img;
     305    AddPicture(pic, name);
     306
     307    return pic;
     308}
     309
    289310// --------------------------------------------------------------------------
    290311//
  • trunk/Mars/mbase/MGList.h

    r5713 r19240  
    2929    const TGPicture *GetPicture(const char *name);
    3030    const TGPicture *GetPicture(const char *name, Int_t width, Int_t height);
     31    const TGPicture *GetPicture(const char *name, const char *xpm[]);
    3132
    3233    TObject *FindWidget(Int_t id) const;
  • trunk/Mars/mbase/MStatusDisplay.cc

    r18957 r19240  
    467467    f->AddFrame(l, lay);
    468468
    469     // Add Mars logo picture
    470     const TGPicture *pic2 = fList->GetPicture("marslogo.xpm");
    471     if (pic2)
    472     {
    473         TGPictureButton *mars  = new TGPictureButton(f, pic2, kPicMars);
    474         fList->Add(mars);
    475         mars->Associate(this);
    476 
    477         TGLayoutHints *lay2 = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 10, 10, 5, 5);
    478         fList->Add(lay2);
    479         f->AddFrame(mars, lay2);
     469    {
     470#define static static const
     471#include "marslogo.xpm"
     472#undef static
     473
     474        // Add Mars logo picture
     475        const TGPicture *pic2 = fList->GetPicture("marslogo", marslogo);
     476        if (pic2)
     477        {
     478            TGPictureButton *mars  = new TGPictureButton(f, pic2, kPicMars);
     479            fList->Add(mars);
     480            mars->Associate(this);
     481
     482            TGLayoutHints *lay2 = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 10, 10, 5, 5);
     483            fList->Add(lay2);
     484            f->AddFrame(mars, lay2);
     485        }
    480486    }
    481487
Note: See TracChangeset for help on using the changeset viewer.