VIZ++ Class: OpenGLFileDialog

 VIZ++ Class Library  VIZ++ Samples  VIZ++ ClassTree 

Source code

/*
 * OpenGLFileDialog.h 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


#pragma once

#include <viz++/StringT.h>
#include <viz++/opengl/OpenGLMainView.h>

namespace VIZ {

class OpenGLFileDialog :public OpenGLObject {
private:
  OPENFILENAME ofn;
  char fileName[MAX_PATH];

public:
  OpenGLFileDialog(OpenGLMainView* view,
          const char* initialDir, 
          const char* filter, const char* ext)
  {
    ZeroMemory(&ofn, sizeof(ofn));
    ZeroMemory(fileName, MAX_PATH);
    ofn.lStructSize = sizeof(ofn); 
    ofn.hwndOwner = NULL;
    if (view) {
      ofn.hwndOwner =view -> getHwnd();
    }
    ofn.lpstrInitialDir = initialDir; 

    ofn.lpstrFilter = filter; //"JPG Files (*.jpg)\0*.jpg\0All Files (*.*)\0*.*\0";
    ofn.lpstrFile = fileName;
    ofn.nMaxFile = MAX_PATH;
    ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
    ofn.lpstrDefExt = ext; //"jpg";
  }

  OPENFILENAME& getOpenFileName()
  {
    return ofn;
  } 

  virtual bool popup() = 0;

  void getFileName(StringT<char>& name)
  {
     name = fileName;  
  } 
};

}

Last modified: 10 Feb 2017

Copyright (c) 2009-2017 Antillia.com ALL RIGHTS RESERVED.